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

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

✨ NAME ✨

so bestie, this page is the man page for Net::U...Server(3pm) from the Perl User Contributed Documentation crew, and the actual thing it documents is Net::UPnP::AV::MediaServer β€” a Perl extension for UPnP. that's it, that's the name, periodt πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

like, here's the whole vibe in code. copy it exactly, don't freestyle:

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 🌸

okay so real talk: this package is an extension UPnP/AV media server. that's the whole pitch. iconic, honestly. 🫢


πŸ‘‘ METHODS πŸ‘‘

πŸ’– new β€” create new Net::UPnP::AV::MediaServer.

$mservier = Net::UPnP::AV::MediaServer();

creates a new object. read perldoc perlboot if you don't understand that. no shame, we've all been there bestie 😭

the new object is not associated with any UPnP devices. please use setdevice() to set the device. don't skip this step, fr fr.

πŸ’– setdevice β€” set a UPnP devices

$mservier->setdevice($dev);

set a device to the object. boom, now it's connected. πŸ’…

πŸ’– browse β€” browse the content directory.

@action_response = $mservier->browse(
                                    ObjectID => $objid, # 0
                                    BrowseFlag => $browseFlag, # 'BrowseDirectChildren'
                                    Filter => $filter, # "*'
                                    StartingIndex => $startIndex, # 0
                                    RequestedCount => $reqCount, # 0
                                    SortCriteria => $sortCrit # ''
                                    );

browse the content directory and return the action response, Net::UPnP::ActionResponse. that's the return value, don't lose it. ✨

πŸ’– getcontentlist β€” get the content list.

@content_list = $mservier->getcontentlist(
                                    ObjectID => $objid, # 0
                                    Filter => $filter, # "*'
                                    StartingIndex => $startIndex, # 0
                                    RequestedCount => $reqCount, # 0
                                    SortCriteria => $sortCrit # ''
                                    );

browse the content directory and return the content list. please see Net::UPnP::AV::Content, Net::UPnP::AV::Item and Net::UPnP::AV::Container. they're the supporting cast and they ate πŸ”₯


🌈 SEE ALSO 🌈

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

πŸŽ€ 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.


and that's the whole page bestie, you made it to the end 🧚 this was perl v5.36.0, dated 2022-12-06, and the page is Net::U...Server(3pm) β€” slay, go browse some content directories πŸ’–βœ¨

πŸ“¦ where this page comes from