manipulating playlist using php
manipulating playlist using php
I have got mp3 toolbox working a treat after changing hosting companies. It is fantastic and I\'m trying to add some nifty php functionality to the playlist configuration.
There are a few problems and I hope you can help.
First I thought it would be great to make the playlist time sensitive. Using worked - got an sequence and I can get a different start point according to the server time. It adds a whole new realm to the radio stream.
Then I though about getting the users local day and time using some simple javascript and setting the values in cookies. Hey we\'re now talking timezone free here - it would make a really neat feature. I can see all sorts of possiblities with it.
That part was easy. The cookie values I\'m able to get into php using and have done all sorts of things to check it works fine.
However when trying using it in the mp3 toolbox script, or calling it in from anywhere else and doing all the things you are meant to be able do with php, it refuse to work.
Tried alternatives too and or etc. etc. etc. and they works everywhere else. Basically I can do anything except what I want to do.
Is there anything you can suggest that I can do, hack, add or change, that will get those cookie values in there. I\'m so excited with the local time idea and I\'m so close..........
Globals are set to off by the way.
I\'m only testing at the moment on my live server and don\'t have the in the script there. But you can see that the cookies work fine. Clicking on the start player button sets them.
http://www.amsterdamonair.net/
Any help would be gratefully appreciated - since finding out it won\'t work I\'ve been sitting with it for over 24 hours non-stop Googling and trying fixes! It\'s a small but I think powerful addition to the mp3 toolbox radio function - when I make it work.
There are a few problems and I hope you can help.
First I thought it would be great to make the playlist time sensitive. Using
Code: Select all
php Date ()
Code: Select all
else if
Then I though about getting the users local day and time using some simple javascript and setting the values in cookies. Hey we\'re now talking timezone free here - it would make a really neat feature. I can see all sorts of possiblities with it.
That part was easy. The cookie values I\'m able to get into php using
Code: Select all
$hour =($_COOKIE[\'playlisthour\']);
However when trying using it in the mp3 toolbox script, or calling it in from anywhere else and doing all the things you are meant to be able do with php, it refuse to work.
Tried alternatives too
Code: Select all
S_GET
Code: Select all
S_REQUEST
Code: Select all
import_request_variables("c", "a_");
Is there anything you can suggest that I can do, hack, add or change, that will get those cookie values in there. I\'m so excited with the local time idea and I\'m so close..........
Globals are set to off by the way.
I\'m only testing at the moment on my live server and don\'t have the
Code: Select all
$hour =($_COOKIE[\'playlisthour\']);
http://www.amsterdamonair.net/
Any help would be gratefully appreciated - since finding out it won\'t work I\'ve been sitting with it for over 24 hours non-stop Googling and trying fixes! It\'s a small but I think powerful addition to the mp3 toolbox radio function - when I make it work.
- Jay
- Will work for food (Administrator)
- Posts: 2868
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
without any reference to any errors I am not sure why it wouldn't work, as long as the cookies are being set properly and in the scope of mp3 toolbox's directory then all of php's attempts to access cookie information should work. You could try pulling the stream up in your browser and turning off the user-agent protection and see if any php errors are displayed.
- Jay
Certainly I\'ll do it right now. The only thing is can you just explain how to do that exactly?
I\'ll get on to it straight away and post the results. Sorry to sound so eager and bother you like this, but I\'ve got so excited at the prospect at getting this to work and you have given me exactly the right encouragement -
Jay you do know your stuff. [/quote]
I\'ll get on to it straight away and post the results. Sorry to sound so eager and bother you like this, but I\'ve got so excited at the prospect at getting this to work and you have given me exactly the right encouragement -
Gotta get it going now - when I do I\'ll send it over to you - it might prove useful to others. I certainly have ideas with it.as long as the cookies are being set properly and in the scope of mp3 toolbox\'s directory then all of php\'s attempts to access cookie information should work.
Jay you do know your stuff. [/quote]
The mp3toolbox_conf.php? I just went there and it was set as nothing so I set it as this, based on what you had written above.
Having said that the link pasted in the browser afterwards just spat out a pls for me to open or download. I think I may have down the wrong thing somwhere. Sorry to sound so thick, but can you point me a bit more.
If you ever come to Amsterdam I promise I\\\'ll make it up to you with lots of thick Dutch beer.
Code: Select all
$agent_block = \\\"Mozilla\\\";
If you ever come to Amsterdam I promise I\\\'ll make it up to you with lots of thick Dutch beer.
Ah, just before resetting the agent block I put this into the browser
(it\'s on my local server at present) and it took me straight to the mp3 toolbox index.php page and not as a .pls
The page was fine and showed no errors.
Here\'s the code I\'m using for the cookie.
I haven\'t gone the whole hog yet with the day etc., although I might put the hour in the index.php for the appropriate mp3toolbox_conf.php - assuming it eventually goes okay.
Just done a few more checks and it shows no errors without the cookies being set. I\'ve tested it on text files, same code structure and it does work. Checking the text test without cookies being set show errors, but are fine once I set them.
The cookie paths are set to /
It doesn\'t sound promising does it? But as you rightly say there is no reason why it shouldn\'t work. Hand manipulating the values and it works, it did it with the server date too, so it ought to do it. I have no streaming issues with the way php is set up on either local or live sites.
And I\'m running at home on the new Easyphp1.8
Hope you might have an idea - I\'ve done every tutorial on the internet - all say this should work.
Code: Select all
http://terry/toolbox/index.php?cmd=radio
The page was fine and showed no errors.
Here\'s the code I\'m using for the cookie.
Code: Select all
$hour=($_COOKIE[\'playlisthour\']);
if ($a_hour <= \"15\"){
$playlist_scr[0] = $source_dir[0].\"/dump_1\";
$playlist_scr[1] = $source_dir[0].\"/promos\";
$playlist_scr[2] = $source_dir[0].\"/dump_1\";
$playlist_scr[3] = $source_dir[0].\"/promos\";
$playlist_scr[4] = $source_dir[0].\"/dump_1\";}
else if ($a_hour <= \"16\"){
$playlist_scr[0] = $source_dir[0].\"/dump_2\";
$playlist_scr[1] = $source_dir[0].\"/promos\";
$playlist_scr[2] = $source_dir[0].\"/dump_2\";
$playlist_scr[3] = $source_dir[0].\"/promos\";
$playlist_scr[4] = $source_dir[0].\"/dump_2\";}
else{
$playlist_scr[0] = $source_dir[0].\"/dump_3\";
$playlist_scr[1] = $source_dir[0].\"/promos\";
$playlist_scr[2] = $source_dir[0].\"/dump_3\";
$playlist_scr[3] = $source_dir[0].\"/promos\";
$playlist_scr[4] = $source_dir[0].\"/dump_3\";}
Just done a few more checks and it shows no errors without the cookies being set. I\'ve tested it on text files, same code structure and it does work. Checking the text test without cookies being set show errors, but are fine once I set them.
The cookie paths are set to /
It doesn\'t sound promising does it? But as you rightly say there is no reason why it shouldn\'t work. Hand manipulating the values and it works, it did it with the server date too, so it ought to do it. I have no streaming issues with the way php is set up on either local or live sites.
And I\'m running at home on the new Easyphp1.8
Hope you might have an idea - I\'ve done every tutorial on the internet - all say this should work.
- Jay
- Will work for food (Administrator)
- Posts: 2868
- Joined: Mon Jan 14, 2002 12:48 am
- Location: Next Door
- Contact:
If I were you I would take a step back and just make a single php script for reading and writing cookies and make sure it works there before getting too much into digging around mp3 toolbox.
Be sure that the reading and writing scripts exist in the same directory as you would like it to work in you mp3toolbox setup.
Be sure that the reading and writing scripts exist in the same directory as you would like it to work in you mp3toolbox setup.
- Jay
Oh I've done that, I have working examples,
http://www.amsterdamonair.net/
The Select Player button sets the cookie, takes you to a popup page, where at the moment I''ve placed confirmation script to check the cookies work.
In addition I've replicated the exact same paths I would use for the playlist configuration using a text file output - which only work once the cookie is set.
http://www.amsterdamonair.net/globecast/index.php
Separately I tested mp3 toolbox manually and using php Date(). Putting the one into the other has only come about after being sure what I was doing worked individually - and the idea is exactly not to dig around in the toolbox script. As you say in the conf.php
Please try the links and have a look at the cookies, it all works logically. Honestly I've done so much work developing what I think is a really sound feature, I just need to get over this last and unexpected hurdle of a long road.
http://www.amsterdamonair.net/
The Select Player button sets the cookie, takes you to a popup page, where at the moment I''ve placed confirmation script to check the cookies work.
In addition I've replicated the exact same paths I would use for the playlist configuration using a text file output - which only work once the cookie is set.
http://www.amsterdamonair.net/globecast/index.php
Separately I tested mp3 toolbox manually and using php Date(). Putting the one into the other has only come about after being sure what I was doing worked individually - and the idea is exactly not to dig around in the toolbox script. As you say in the conf.php
Most of what happens is, or can be outside and not inside the actual toolbox script. I hear what your saying, but believe I've learnt the hard way to take it one stage at a time.Place your script here, this is just a simple array of directory paths
Please try the links and have a look at the cookies, it all works logically. Honestly I've done so much work developing what I think is a really sound feature, I just need to get over this last and unexpected hurdle of a long road.
-
- Posts: 1
- Joined: Thu Mar 30, 2006 1:53 pm