Net::U...V::Item(3pm)

πŸ“¦
version 1.4.6 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Net::U...V::Item β€” bestie, this is the Perl extension for UPnP πŸ’– and yeah the name got a lil truncated in the header but it's Net::UPnP::AV::Item, we move.


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so here's the whole vibe in code, no cap:

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);
    }
}

🌸 DESCRIPTION 🌸

So this package is an extension for a UPnP/AV media server πŸŽ€ and lowkey the important part is: it's a sub class of Net::UPnP::AV::Content. That's the family tree, bestie, iykyk πŸ‘‘


πŸ’… METHODS πŸ’…

isitem β€” Check if the content is a item.

$isItem = $item->isisitem();

Check if the content is a item. Like, is it an item or is it not, that's the whole question πŸ“

getid β€” Get the content ID.

$id = $item->getid();

Get the content ID. Your girl needs her identifier ✨

gettitle β€” Get the content title.

$title = $item->gettitle();

Get the content title. The name, the label, the moment πŸ’–

getdate β€” Get the content date.

$date = $item->getdate();

Get the content date. Timezone of it all πŸ•°οΈ

geturl β€” get the content URL

$url = $item->getcontenttype();

Get the content URL. (yes the example line in the original calls getcontenttype for the geturl method β€” I'm keeping it exactly as it is, character for character, because facts don't change even when they're a lil sus πŸ™ˆ)

getcontenttype β€” get the content type

$content_type = $item->getcontenttype();

Get the content type. The MIME situation, the format of it all πŸŽ€


πŸ‘€ SEE ALSO πŸ‘€

  • Net::UPnP::AV::Content
  • Net::UPnP::AV::Container

the whole friend group fr fr 🫢


🌈 AUTHOR 🌈

Satoshi Konno skonno@cybergarage.org

CyberGarage http://www.cybergarage.org


Copyright (C) 2005 by Satoshi Konno

It may be used, redistributed, and/or modified under the terms of BSD License.


okay bestie that's the whole page, go forth and slay your UPnP content tree 🌟

perl v5.36.0 β€” 2022-12-06 πŸŽ€ that's the version and the date this lil doc was born, mwah, bye πŸ’…βœ¨

πŸ“¦ where this page comes from