Net::UPnP(3pm)

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

✨ Net::UPnP ✨

okay bestie, welcome to Net::UPnP β€” the Perl extension for UPnP πŸ’– (that's User Contributed Perl Documentation, for the record, and yeah we're in the 3pm manual section πŸŽ€)


🌸 SYNOPSIS 🌸

here's the whole vibe, verbatim, no edits, copy it exactly:

use Net::UPnP::ControlPoint;

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;
    }
    $condir_service = $dev->getservicebyname('urn:schemas-upnp-org:service:ContentDirectory:1');
    unless (defined(condir_service)) {
        next;
    }
    %action_in_arg = (
            'ObjectID' => 0,
            'BrowseFlag' => 'BrowseDirectChildren',
            'Filter' => '*',
            'StartingIndex' => 0,
            'RequestedCount' => 0,
            'SortCriteria' => '',
        );
    $action_res = $condir_service->postcontrol('Browse', \%action_in_arg);
    unless ($action_res->getstatuscode() == 200) {
        next;
    }
    $actrion_out_arg = $action_res->getargumentlist();
    unless ($actrion_out_arg->{'Result'}) {
        next;
    }
    $result = $actrion_out_arg->{'Result'};
    while ($result =~ m/<dc:title>(.*?)<\/dc:title>/sgi) {
        print "\t$1\n";
    }
    $devNum++;
}

like, it's giving full discovery-to-browse pipeline and honestly? iconic πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this package hands you a bunch of functions for controlling UPnP devices 🌈

as of right now, it only ships functions for the control point side of things. wanna actually control UPnP devices? go look at Net::UPnP::ControlPoint πŸ‘‘

and as a lil sample of what a control point can do, the package also gives you Net::UPnP::AV::MediaServer for wrangling devices like DLNA media servers πŸ“Ίβœ¨. for an example in the wild, check out dms2vodcast.pl, which converts from MPEG2 movies to MPEG4 ones and spits out the RSS file for Vodcasting πŸŽ¬βž‘οΈπŸ“» no cap.


πŸ’œ SEE ALSO πŸ’œ

  • Net::UPnP::ControlPoint
  • Net::UPnP::AV::MediaServer

go read those too, bestie, they're the main characters of this whole saga 🫢


πŸ‘‘ 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 the BSD License πŸ“œ β€” slay, permissive licensing is so real

and that's the whole page, bestie!! πŸ’– this was perl v5.36.0, dated 2022-12-06 β€” tysm for reading, mwah, go browse some ContentDirectory like the queen you are πŸ‘‘πŸ’…βœ¨

πŸ“¦ where this page comes from