#!/usr/bin/perl -wT use CGI qw(:all); use LWP::Simple qw(get); use strict; print header; my $song = param('song'); my $directory = "insert_directory_here"; my $historylength = 5; my $pass = "pass"; my $url = ""; my $result = ""; my $songentry = $directory . $song; #get the current position of the playing song 0=first song, 1=second s +ong, etc $url = "http://localhost:4800/getlistpos?p=$pass"; $result = get($url); if ( $result > $historylength ) { my $numbertotrim = ( $result - $historylength ); for ( my $i = 1 ; $i == $numbertotrim ; $i++ ) { $url = "http://localhost:4800/deletepos?p=$pass&index=0"; $result = get($url); if ( $result != 1 ) { $i = $numbertotrim; } } } # Change the working directory for sanity $url = "http://localhost:4800/chdir?p=$pass&dir=\"insert_directory_ +here\""; $result = get($url); if ( $result == 0 ) { &htmlsub("There was an error handling your request."); } # Load the list $url = "http://localhost:4800/getplaylistfile?p=$pass&delim=;"; $result = get($url); if ( $result eq 0 ) { &htmlsub("There was an error handling your request."); } else { my @songs = split( ';', $result ); my $playlistentry = ""; foreach $playlistentry (@songs) { if ( $songentry eq $playlistentry ) { &htmlsub("That song is already in the playlist."); } } } #queue it up, if there are no precedents $url = "http://localhost:4800/playfile?p=$pass&file=" . $songentry; $result = get($url); if ( $result == 0 ) { &htmlsub("There was an error handling your request."); } else { # report success/failure to queue, possibly name the place it is +queued in? &htmlsub("The song you requested has been queued."); } sub htmlsub { # this is where you format the HTML print $_[0]; print "<BR>"; exit(0); }

In reply to Winamp Playlist Queuing via httpQ Interaction by All_Star25

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.