Net::U...tainer(3pm)

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

okay bestie, sit down, hydrate, because we're reading a manpage together πŸ’–

This is Net::U...tainer(3pm) β€” yeah, that's the whole name, truncated and mysterious and honestly kinda iconic β€” living in User Contributed Perl Documentation. Its real, full government name is Net::UPnP::AV::Container, and it's a Perl extension for UPnP. She's a container. She contains things. Slay.


✨ NAME ✨

Net::UPnP::AV::Container β€” Perl extension for UPnP.

that's it. that's the whole name section. short, sweet, main character energy πŸ‘‘


🌈 SYNOPSIS 🌈

okay so this is the whole vibe, copy it exactly, no notes:

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

like, look at her go πŸ¦‹ β€” searching for devices, checking that $device_type isn't 'urn:schemas-upnp-org:device:MediaServer:1', skipping anyone who doesn't have 'urn:schemas-upnp-org:service:ContentDirectory:1', then walking the content tree recursively with print_content and tabs for indent. a whole little ecosystem. we love to see it.


πŸ’… DESCRIPTION πŸ’…

So. The package is an extension for a UPnP/AV media server, and it's a sub class of Net::UPnP::AV::Content. That's the tea, fr fr β€” it inherits, it extends, it does container things. 🫢


πŸŽ€ METHODS πŸŽ€

every method, in order, nothing skipped, because we are thorough girlies πŸ’…

iscontainer β€” Check if the content is a container.

$isContainer = $container->iscontainer();

Check if the content is a container. that's literally the whole job. is it a container? yes or no. vibe check complete πŸ’€

getid β€” Get the content ID.

$id = $item->getid();

Get the content ID. you want the ID? here's the ID. ✨

gettitle β€” Get the content title.

$title = $item->gettitle();

Get the content title. the name. the label. the whole branding moment. πŸŽ€

getdate β€” Get the content date.

$date = $item->getdate();

Get the content date. when it happened. timestamped. ⭐


πŸ‘€ SEE ALSO πŸ‘€

go read these too, bestie, they're the extended universe:

  • Net::UPnP::AV::Content
  • Net::UPnP::AV::Item

πŸ‘‘ AUTHOR πŸ‘‘

Satoshi Konno β€” skonno@cybergarage.org πŸ’–

CyberGarage β€” http://www.cybergarage.org

the way that a real human wrote this and we're all just out here using it. iconic. give them their flowers. 🌸

Copyright (C) 2005 by Satoshi Konno

It may be used, redistributed, and/or modified under the terms of BSD License. periodt. use it, share it, remix it, just respect the BSD terms πŸ’œ


and that's the whole page, bestie!! πŸŒˆπŸ’– this one came from perl v5.36.0 and is dated 2022-12-06, and yeah β€” the footer calls her Net::U...tainer(3pm) one last time because the manpage name is long and the terminal is a hater. go forth and recurse through some containers. mwah. 🧚✨

πŸ“¦ where this page comes from