Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
As a XMMS user i can't see (yet) the titles of songs while listening to streaming radios. So i wrote a simple script to see what's on radiostorm.com anytime.
#!/usr/bin/perl use strict; use LWP::Simple;
my $urlmask = 'http://radiostorm.com/%s'; my %pls; my $config = <<EOF; News//ap24.pls 80s/80s.js/80s128.pls Classic Rock/classic.js/classic128.pls Alternative/alt.js/alt128.pls Hip-Hop/hh.js/hiphop128.pls Pop Top 40/pop.js/pop128.pls Hard Rock/hr.js/hr128.pls EOF my @radio = map {my @t = split "\/", $_; {caption => $t[0] ,js => $t[1], pls => $t[2]} } split "\n", $config; my $template = "%12s %s\n" . ' ' x 14 . "%s\n"; while (1) { for (@radio) { printf $template, $_->{caption}, getjs($_->{js}), getpls($_->{ +pls}); } print "\n" . ('- _ ' x 20) . "\n\n"; sleep 60; } sub getjs { my $js = shift; return unless $js; my ($t) = mget($js) =~ /"([^"]+)"/; return $t; } sub getpls { my $pls = shift; unless ($pls{$pls}) { my $file = mget($pls); my $num = $file =~ s/^(File\d=)/$1/gm; ($pls{$pls}) = $file =~ m!File$num=(.+)!; } return $pls{$pls}; } sub mget { return get sprintf($urlmask, shift); }

 
 UPDATE: caching using %pls now makes sense :)


 
$|=$_="1g2i1u1l2i4e2n0k",map{print"\7",chop;select$,,$,,$,,$_/7}m{..}g


In reply to Radiostorm song titles by giulienk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-20 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found