1Net::UPnP::AV::MediaSerUvseerr(3C)ontributed Perl DocumeNnetta:t:iUoPnnP::AV::MediaServer(3)
2
3
4

NAME

6       Net::UPnP::AV::MediaServer - Perl extension for UPnP.
7

SYNOPSIS

9           use Net::UPnP::ControlPoint;
10           use Net::UPnP::AV::MediaServer;
11
12           my $obj = Net::UPnP::ControlPoint->new();
13
14           @dev_list = $obj->search(st =>'upnp:rootdevice', mx => 3);
15
16           $devNum= 0;
17           foreach $dev (@dev_list) {
18               $device_type = $dev->getdevicetype();
19               if  ($device_type ne 'urn:schemas-upnp-org:device:MediaServer:1') {
20                   next;
21               }
22               print "[$devNum] : " . $dev->getfriendlyname() . "\n";
23               unless ($dev->getservicebyname('urn:schemas-upnp-org:service:ContentDirectory:1')) {
24                   next;
25               }
26               $mediaServer = Net::UPnP::AV::MediaServer->new();
27               $mediaServer->setdevice($dev);
28               @content_list = $mediaServer->getcontentlist(ObjectID => 0);
29               foreach $content (@content_list) {
30                   print_content($mediaServer, $content, 1);
31               }
32               $devNum++;
33           }
34
35           sub print_content {
36               my ($mediaServer, $content, $indent) = @_;
37               my $id = $content->getid();
38               my $title = $content->gettitle();
39               for ($n=0; $n<$indent; $n++) {
40                   print "\t";
41               }
42               print "$id = $title";
43               if ($content->isitem()) {
44                   print " (" . $content->geturl();
45                   if (length($content->getdate())) {
46                       print " - " . $content->getdate();
47                   }
48                   print " - " . $content->getcontenttype() . ")";
49               }
50               print "\n";
51               unless ($content->iscontainer()) {
52                   return;
53               }
54               @child_content_list = $mediaServer->getcontentlist(ObjectID => $id );
55               if (@child_content_list <= 0) {
56                   return;
57               }
58               $indent++;
59               foreach my $child_content (@child_content_list) {
60                   print_content($mediaServer, $child_content, $indent);
61               }
62           }
63

DESCRIPTION

65       The package is a extention UPnP/AV media server.
66

METHODS

68       new - create new Net::UPnP::AV::MediaServer.
69               $mservier = Net::UPnP::AV::MediaServer();
70
71           Creates a new object. Read `perldoc perlboot` if you don't
72           understand that.
73
74           The new object is not associated with any UPnP devices. Please use
75           setdevice() to set the device.
76
77       setdevice - set a UPnP devices
78               $mservier->setdevice($dev);
79
80           Set a device to the object.
81
82       browse - browse the content directory.
83               @action_response = $mservier->browse(
84                                                   ObjectID => $objid, # 0
85                                                   BrowseFlag => $browseFlag, # 'BrowseDirectChildren'
86                                                   Filter => $filter, # "*'
87                                                   StartingIndex => $startIndex, # 0
88                                                   RequestedCount => $reqCount, # 0
89                                                   SortCriteria => $sortCrit # ''
90                                                   );
91
92           Browse the content directory and return the action response,
93           Net::UPnP::ActionResponse.
94
95       getcontentlist - get the content list.
96               @content_list = $mservier->getcontentlist(
97                                                   ObjectID => $objid, # 0
98                                                   Filter => $filter, # "*'
99                                                   StartingIndex => $startIndex, # 0
100                                                   RequestedCount => $reqCount, # 0
101                                                   SortCriteria => $sortCrit # ''
102                                                   );
103
104           Browse the content directory and return the content list. Please
105           see Net::UPnP::AV::Content, Net::UPnP::AV::Item and
106           Net::UPnP::AV::Container.
107

SEE ALSO

109       Net::UPnP::AV::Content
110
111       Net::UPnP::AV::Item
112
113       Net::UPnP::AV::Container
114

AUTHOR

116       Satoshi Konno skonno@cybergarage.org
117
118       CyberGarage http://www.cybergarage.org
119
121       Copyright (C) 2005 by Satoshi Konno
122
123       It may be used, redistributed, and/or modified under the terms of BSD
124       License.
125
126
127
128perl v5.28.1                      2018-12-23     Net::UPnP::AV::MediaServer(3)
Impressum