/usr/share/perl5/Net/UPnP/AV/Item.pm is in libnet-upnp-perl 1.4.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | package Net::UPnP::AV::Item;
#-----------------------------------------------------------------
# Net::UPnP::AV::Item
#-----------------------------------------------------------------
use strict;
use warnings;
use Net::UPnP::AV::Content;
use vars qw(@ISA $_URL $_CONTENTTYPE);
@ISA = qw(Net::UPnP::AV::Content);
$_URL = '_url';
$_CONTENTTYPE = '_contenttype';
#------------------------------
# new
#------------------------------
sub new {
my($class) = shift;
my($this) = $class->SUPER::new();
$this->{$Net::UPnP::AV::Item::_URL} = '';
$this->{$Net::UPnP::AV::Item::_CONTENTTYPE} = '';
bless $this, $class;
}
#------------------------------
# url
#------------------------------
sub seturl() {
my($this) = shift;
if (@_) {
$this->{$Net::UPnP::AV::Item::_URL} = $_[0];
}
}
sub geturl() {
my($this) = shift;
$this->{$Net::UPnP::AV::Item::_URL};
}
#------------------------------
# contenttype
#------------------------------
sub setcontenttype() {
my($this) = shift;
if (@_) {
$this->{$Net::UPnP::AV::Item::_CONTENTTYPE} = $_[0];
}
}
sub getcontenttype() {
my($this) = shift;
$this->{$Net::UPnP::AV::Item::_CONTENTTYPE};
}
#------------------------------
# is*
#------------------------------
sub isitem() {
1;
}
1;
__END__
=head1 NAME
Net::UPnP::AV::Item - Perl extension for UPnP.
=head1 SYNOPSIS
use Net::UPnP::ControlPoint;
use Net::UPnP::AV::MediaServer;
my $obj = Net::UPnP::ControlPoint->new();
@dev_list = $obj->search(st =>'upnp:rootdevice', mx => 3);
$devNum= 0;
foreach $dev (@dev_list) {
$device_type = $dev->getdevicetype();
if ($device_type ne 'urn:schemas-upnp-org:device:MediaServer:1') {
next;
}
print "[$devNum] : " . $dev->getfriendlyname() . "\n";
unless ($dev->getservicebyname('urn:schemas-upnp-org:service:ContentDirectory:1')) {
next;
}
$mediaServer = Net::UPnP::AV::MediaServer->new();
$mediaServer->setdevice($dev);
@content_list = $mediaServer->getcontentlist(ObjectID => 0);
foreach $content (@content_list) {
print_content($mediaServer, $content, 1);
}
$devNum++;
}
sub print_content {
my ($mediaServer, $content, $indent) = @_;
my $id = $content->getid();
my $title = $content->gettitle();
for ($n=0; $n<$indent; $n++) {
print "\t";
}
print "$id = $title";
if ($content->isitem()) {
print " (" . $content->geturl();
if (length($content->getdate())) {
print " - " . $content->getdate();
}
print " - " . $content->getcontenttype() . ")";
}
print "\n";
unless ($content->iscontainer()) {
return;
}
@child_content_list = $mediaServer->getcontentlist(ObjectID => $id );
if (@child_content_list <= 0) {
return;
}
$indent++;
foreach my $child_content (@child_content_list) {
print_content($mediaServer, $child_content, $indent);
}
}
=head1 DESCRIPTION
The package is a extention UPnP/AV media server, and a sub class of L<Net::UPnP::AV::Content>.
=head1 METHODS
=over 4
=item B<isitem> - Check if the content is a item.
$isItem = $item->isisitem();
Check if the content is a item.
=item B<getid> - Get the content ID.
$id = $item->getid();
Get the content ID.
=item B<gettitle> - Get the content title.
$title = $item->gettitle();
Get the content title.
=item B<getdate> - Get the content date.
$date = $item->getdate();
Get the content date.
=item B<geturl> - get the content URL
$url = $item->getcontenttype();
Get the content URL.
=item B<getcontenttype> - get the content type
$content_type = $item->getcontenttype();
Get the content type.
=back
=head1 SEE ALSO
L<Net::UPnP::AV::Content>
L<Net::UPnP::AV::Container>
=head1 AUTHOR
Satoshi Konno
skonno@cybergarage.org
CyberGarage
http://www.cybergarage.org
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2005 by Satoshi Konno
It may be used, redistributed, and/or modified under the terms of BSD License.
=cut
|