1Net::UPnP::AV::Content(U3s)er Contributed Perl DocumentatNieotn::UPnP::AV::Content(3)
2
3
4

NAME

6       Net::UPnP::AV::Content - 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, and a super class of
66       Net::UPnP::AV::Container and Net::UPnP::AV::Item.
67

METHODS

69       getid - Get the content ID.
70               $id = $item->getid();
71
72           Get the content ID.
73
74       gettitle - Get the content title.
75               $title = $item->gettitle();
76
77           Get the content title.
78
79       getdate - Get the content date.
80               $date = $item->getdate();
81
82           Get the content date.
83

SEE ALSO

85       Net::UPnP::AV::Item
86
87       Net::UPnP::AV::Container
88

AUTHOR

90       Satoshi Konno skonno@cybergarage.org
91
92       CyberGarage http://www.cybergarage.org
93
95       Copyright (C) 2005 by Satoshi Konno
96
97       It may be used, redistributed, and/or modified under the terms of BSD
98       License.
99
100
101
102perl v5.34.0                      2021-07-22         Net::UPnP::AV::Content(3)
Impressum