Winamp does not load playlist when sending m3u file using php-script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Emil

    Winamp does not load playlist when sending m3u file using php-script

    This is my problem:

    I'm writing a script that...
    1. creates a customized pls/m3u playlist
    2. sends the pls or a m3u playlist to the webbrowser.

    The browser should open Winamp/Windows Media Player and load the
    downloaded playlist.


    However this doesnt seem to work. Everything winamp shows is the
    playlist-filename. It seems that the playlist-file that was sent to
    Internet Explorer does not exist when winamp tries to read it.

    If I take the output of the script and places it in a .m3u-file
    everything will
    work perfect, but I do not want a .m3u-file for each of my mp3s!

    This is the code for my script:
    -----------------------------------------------------------
    <?php
    include ('playlist.php' ); // include playlist-class

    $playlist = new Playlist("m3u") ; // Create instance of playlist
    $output = $playlist->getPlaylist( ); // Generate dynamic playlist

    header("Content-Type: audio/mpegurl");
    header("Content-Disposition: filename=playli st.m3u");

    print($output);
    ?>
    -----------------------------------------------------------
  • Dan Tripp

    #2
    Re: Winamp does not load playlist when sending m3u file using php-script

    Emil wrote:[color=blue]
    > This is my problem:
    >
    > I'm writing a script that...
    > 1. creates a customized pls/m3u playlist
    > 2. sends the pls or a m3u playlist to the webbrowser.
    >
    > The browser should open Winamp/Windows Media Player and load the
    > downloaded playlist.
    >
    >
    > However this doesnt seem to work. Everything winamp shows is the
    > playlist-filename. It seems that the playlist-file that was sent to
    > Internet Explorer does not exist when winamp tries to read it.
    >
    > If I take the output of the script and places it in a .m3u-file
    > everything will
    > work perfect, but I do not want a .m3u-file for each of my mp3s!
    >
    > This is the code for my script:
    > -----------------------------------------------------------
    > <?php
    > include ('playlist.php' ); // include playlist-class
    >
    > $playlist = new Playlist("m3u") ; // Create instance of playlist
    > $output = $playlist->getPlaylist( ); // Generate dynamic playlist
    >
    > header("Content-Type: audio/mpegurl");
    > header("Content-Disposition: filename=playli st.m3u");
    >
    > print($output);
    > ?>
    > -----------------------------------------------------------[/color]


    Hiya!

    I'm wondering if there isn't something askew with the playlist class.

    I uploaded an .m3u playlist up to my server, then wrote a php file to
    read it and echo it out with the headers. IE and Mozilla will both ask
    if I want to open it in the default app (Moz wants the file to have
    ".m3u" at the end, which could be passed as a bogus parameter. ie.:
    playlist.php?.m 3u)

    Here's what worked for me:

    =============== =============== =============== =============== ===============
    test.m3u:
    =============== =============== =============== =============== ===============
    #EXTM3U
    #EXTINF:213,01 - The DTs - Travis.mp3

    #EXTINF:201,09 - The DTs - Jam in A (The Stoned Paradigm).mp3


    =============== =============== =============== =============== ===============
    playlist.php
    =============== =============== =============== =============== ===============
    <?php

    $fileName = "./test.m3u";
    $fp = fopen($fileName ,"r");
    $contents = fread($fp,files ize($fileName)) ;

    header("Content-Type: audio/mpegurl");
    header("Content-Disposition: filename=playli st.m3u");

    echo $contents;

    ?>
    =============== =============== =============== =============== ===============

    Regards,

    - Dan

    Comment

    • Emil

      #3
      Re: Winamp does not load playlist when sending m3u file using php-script

      Dan Tripp <thisIsNot@MyEM ailAddress.com> wrote in message news:<aFzTb.208 90$1Y2.14493@ne wssvr25.news.pr odigy.com>...[color=blue]
      > Emil wrote:[color=green]
      > > This is my problem:
      > >
      > > I'm writing a script that...
      > > 1. creates a customized pls/m3u playlist
      > > 2. sends the pls or a m3u playlist to the webbrowser.
      > >
      > > The browser should open Winamp/Windows Media Player and load the
      > > downloaded playlist.
      > >
      > >
      > > However this doesnt seem to work. Everything winamp shows is the
      > > playlist-filename. It seems that the playlist-file that was sent to
      > > Internet Explorer does not exist when winamp tries to read it.
      > >
      > > If I take the output of the script and places it in a .m3u-file
      > > everything will
      > > work perfect, but I do not want a .m3u-file for each of my mp3s!
      > >
      > > This is the code for my script:
      > > -----------------------------------------------------------
      > > <?php
      > > include ('playlist.php' ); // include playlist-class
      > >
      > > $playlist = new Playlist("m3u") ; // Create instance of playlist
      > > $output = $playlist->getPlaylist( ); // Generate dynamic playlist
      > >
      > > header("Content-Type: audio/mpegurl");
      > > header("Content-Disposition: filename=playli st.m3u");
      > >
      > > print($output);
      > > ?>
      > > -----------------------------------------------------------[/color]
      >
      >
      > Hiya!
      >
      > I'm wondering if there isn't something askew with the playlist class.
      >
      > I uploaded an .m3u playlist up to my server, then wrote a php file to
      > read it and echo it out with the headers. IE and Mozilla will both ask
      > if I want to open it in the default app (Moz wants the file to have
      > ".m3u" at the end, which could be passed as a bogus parameter. ie.:
      > playlist.php?.m 3u)
      >
      > Here's what worked for me:
      >
      > =============== =============== =============== =============== ===============
      > test.m3u:
      > =============== =============== =============== =============== ===============
      > #EXTM3U
      > #EXTINF:213,01 - The DTs - Travis.mp3
      > http://www.servername.com/01_-_The_DTs_-_Travis.mp3
      > #EXTINF:201,09 - The DTs - Jam in A (The Stoned Paradigm).mp3
      > http://www.servername.com/09_-_The_D..._Paradigm).mp3
      >
      > =============== =============== =============== =============== ===============
      > playlist.php
      > =============== =============== =============== =============== ===============
      > <?php
      >
      > $fileName = "./test.m3u";
      > $fp = fopen($fileName ,"r");
      > $contents = fread($fp,files ize($fileName)) ;
      >
      > header("Content-Type: audio/mpegurl");
      > header("Content-Disposition: filename=playli st.m3u");
      >
      > echo $contents;
      >
      > ?>
      > =============== =============== =============== =============== ===============
      >
      > Regards,
      >
      > - Dan
      > http://blog.dantripp.com/[/color]

      Thanks for your help!


      I have now solved the problem:

      Before I tried to send the headers I started a session with:
      session_start() ;

      ....when I removed this line, everything worked perfect!

      /E

      Comment

      • Dan Tripp

        #4
        Re: Winamp does not load playlist when sending m3u file using php-script

        Emil wrote:
        [color=blue]
        > Dan Tripp <thisIsNot@MyEM ailAddress.com> wrote in message news:<aFzTb.208 90$1Y2.14493@ne wssvr25.news.pr odigy.com>...
        >[color=green]
        >>Emil wrote:
        >>[color=darkred]
        >>>This is my problem:
        >>>
        >>>I'm writing a script that...
        >>>1. creates a customized pls/m3u playlist
        >>>2. sends the pls or a m3u playlist to the webbrowser.
        >>>
        >>>The browser should open Winamp/Windows Media Player and load the
        >>>downloaded playlist.
        >>>
        >>>
        >>>However this doesnt seem to work. Everything winamp shows is the
        >>>playlist-filename. It seems that the playlist-file that was sent to
        >>>Internet Explorer does not exist when winamp tries to read it.
        >>>
        >>>If I take the output of the script and places it in a .m3u-file
        >>>everything will
        >>>work perfect, but I do not want a .m3u-file for each of my mp3s!
        >>>
        >>>This is the code for my script:
        >>>-----------------------------------------------------------
        >>><?php
        >>> include ('playlist.php' ); // include playlist-class
        >>>
        >>> $playlist = new Playlist("m3u") ; // Create instance of playlist
        >>> $output = $playlist->getPlaylist( ); // Generate dynamic playlist
        >>>
        >>> header("Content-Type: audio/mpegurl");
        >>> header("Content-Disposition: filename=playli st.m3u");
        >>>
        >>> print($output);
        >>>?>
        >>>-----------------------------------------------------------[/color]
        >>
        >>
        >>Hiya!
        >>
        >>I'm wondering if there isn't something askew with the playlist class.
        >>
        >>I uploaded an .m3u playlist up to my server, then wrote a php file to
        >>read it and echo it out with the headers. IE and Mozilla will both ask
        >>if I want to open it in the default app (Moz wants the file to have
        >>".m3u" at the end, which could be passed as a bogus parameter. ie.:
        >>playlist.php? .m3u)
        >>
        >>Here's what worked for me:
        >>
        >>============= =============== =============== =============== =============== ==
        >>test.m3u:
        >>============= =============== =============== =============== =============== ==
        >>#EXTM3U
        >>#EXTINF:213,0 1 - The DTs - Travis.mp3
        >>http://www.servername.com/01_-_The_DTs_-_Travis.mp3
        >>#EXTINF:201,0 9 - The DTs - Jam in A (The Stoned Paradigm).mp3
        >>http://www.servername.com/09_-_The_D..._Paradigm).mp3
        >>
        >>============= =============== =============== =============== =============== ==
        >>playlist.ph p
        >>============= =============== =============== =============== =============== ==
        >><?php
        >>
        >>$fileName = "./test.m3u";
        >>$fp = fopen($fileName ,"r");
        >>$contents = fread($fp,files ize($fileName)) ;
        >>
        >>header("Conte nt-Type: audio/mpegurl");
        >>header("Conte nt-Disposition: filename=playli st.m3u");
        >>
        >>echo $contents;
        >>
        >>?>
        >>============= =============== =============== =============== =============== ==
        >>
        >>Regards,
        >>
        >>- Dan
        >>http://blog.dantripp.com/[/color]
        >
        >
        > Thanks for your help!
        >
        >
        > I have now solved the problem:
        >
        > Before I tried to send the headers I started a session with:
        > session_start() ;
        >
        > ...when I removed this line, everything worked perfect!
        >
        > /E[/color]

        Awesome! I've done something akin to that a time or two myself. =)

        Regards,

        - Dan

        Comment

        Working...