Author |
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 05 2006 at 11:07 | IP Logged
|
|
|
Here is a bit of code that you can drop into a PSP page which shows the currently playing track and a few songs before and after (count set by LOCAL2, three in this example: the ph_setvar_a( 1, 2, 3) bit).
Code:
<% ph_rtne( ph_setvar_a( 1, 1, ph_winampinfo( "listpos", 0, 0) ) + ph_setvar_a( 1, 2, 3) + ph_setvar_a( 1, 3, "")) + ph_rtne( ph_setvar_a( 1, 4, ph_getvar_n( 1, 1) - ph_getvar_n( 1, 2)) ) + ph_rtne( ph_forloop("ph_concatvar( 1, 3, ph_getvar_n( 1, 4) + ': ' + if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '> ', '' ) + ph_winampinfo( 'listtitlename', ph_getvar_n( 1, 4), 0) + '<br>') + ph_addtovar( 1, 4, 1)",ph_getvar_n( 1, 1) - ph_getvar_n( 1, 2),ph_getvar_n( 1, 1) + ph_getvar_n( 1, 2),1)) + ph_getvar_s( 1, 3) %> |
|
|
Edited by TonyNo - November 05 2006 at 11:16
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 06 2006 at 12:57 | IP Logged
|
|
|
Tony,
You are too cool for words .
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 07 2006 at 14:45 | IP Logged
|
|
|
Here is a complete PSP page that allows you to scroll through the current playlist...
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> PH Playlist </TITLE>
</HEAD>
<BODY>
<font face="verdana" size=2>
<% ph_rtne( ph_setvar_a( 1, 1, ph_winampinfo( "listpos", 0, 0 ) ) + ph_setvar_a( 1, 2, 5 ) + ph_setvar_a( 1, 3, "" ) + ph_setvar_a( 1, 4, if( ph_getwebparm( "start" )="", ph_getvar_n( 1, 1) - ph_getvar_n( 1, 2), number( ph_getwebparm( "start" ))) ) + ph_setvar_a( 1, 5, ph_getvar_n( 1, 4) ) ) %>
<% ph_rtne( ph_forloop("ph_concatvar( 1, 3, if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '<b>', '' ) + ph_getvar_n( 1, 4 ) + ': ' + ph_winampinfo( 'listtitlename', ph_getvar_n( 1, 4 ), 0) + '<br>' + if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '</b>', '' )) + ph_addtovar( 1, 4, 1)", ph_getvar_n( 1, 5), ph_getvar_n( 1, 5) + ph_getvar_n( 1, 2) * 2, 1) ) %>
<% ph_getvar_s( 1, 3) %><br>
<a href="/playlist.psp?start=<% ph_getvar_n( 1, 5) - (ph_getvar_n( 1, 2)*2 + 1) %>">Prev</a> •
<a href="/playlist.psp">Home</a> •
<a href="/playlist.psp?start=<% ph_getvar_n( 1, 5) + ph_getvar_n( 1, 2)*2 + 1 %>">Next</a>
</BODY>
</HTML> |
|
|
Edited by TonyNo - November 07 2006 at 21:20
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 07 2006 at 23:26 | IP Logged
|
|
|
OK, my brain is fried! Dave, can ya help me with the proper quote usage here (the href tag)?
Code:
<% ph_rtne( ph_forloop("ph_concatvar( 1, 3, if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '<b>', '' ) + ph_getvar_n( 1, 4 ) + ': ' + '<a href=~"/ph-cgi/evalformula?formula=ph_winampctrl(~~"seeklist ~~", ' + ph_getvar_n( 1, 4) + ', 0)~">' + ph_winampinfo( 'listtitlename', ph_getvar_n( 1, 4 ), 0) + '<br>' + if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '</b>', '' ) + '</a>') + ph_addtovar( 1, 4, 1)", ph_getvar_n( 1, 5), ph_getvar_n( 1, 5) + ph_getvar_n( 1, 2) * 2, 1) ) %> |
|
|
Edited by TonyNo - November 07 2006 at 23:28
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 08 2006 at 01:02 | IP Logged
|
|
|
Tony,
Just a quick stab (I get the href string returned anyways) would be:
Code:
ph_rtne(ph_forloop("ph_concatvar( 1, 3, if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '<b>', '' ) + ph_getvar_n( 1, 4 ) + ': ' + '<a href=~~"/ph-cgi/evalformula?formula=ph_winampctrl(%22seeklis t%22, ' + ph_getvar_n( 1, 4) + ', 0)~~">' + ph_winampinfo( 'listtitlename', ph_getvar_n( 1, 4 ), 0) + '<br>' + if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '</b>', '' ) + '</a>') + ph_addtovar( 1, 4, 1)", ph_getvar_n( 1, 5), ph_getvar_n( 1, 5) + ph_getvar_n( 1, 2) * 2, 1))
|
|
|
You may have to be careful of forum induced spaces and such in the code above. The key differences are the single tilde quotes were replaced with double tilde quotes and the double tilde quotes were replaced with HTML escaped doubled quotes (around seeklist). If you think about it, the double tilde quotes are for PowerHome escape benefits and it does not good for them to appear in the HTML. You need these quotes escaped for HTML instead.
Anyways, I think it's at least a step in the right direction.
HTH,
Dave.
Edited by dhoward - November 08 2006 at 01:03
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 08 2006 at 07:49 | IP Logged
|
|
|
Thanks Dave! I'm closer now.
Adding "play" after "seeklist" does not work in the link but it does work in the formula evaluator...
Code:
<% ph_rtne( ph_forloop("ph_concatvar( 1, 3, ph_getvar_n( 1, 4 ) + ': ' + if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '<b>', '' ) + '<a href=~"/ph-cgi/evalformula?formula=ph_winampctrl(%22seeklist %22,' + ph_getvar_n( 1, 4) + ',%22%22)+ph_winampctrl(%22play%22,0,%22%22)&nexturl=/playli st2.psp~">' + ph_winampinfo( 'listtitlename', ph_getvar_n( 1, 4 ), 0) + '<br>' + if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '</b>', '' ) + '</a>') + ph_addtovar( 1, 4, 1)", ph_getvar_n( 1, 5), ph_getvar_n( 1, 5) + ph_getvar_n( 1, 2) * 2, 1) ) %> |
|
|
Any ideas?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 13 2006 at 15:34 | IP Logged
|
|
|
Tony,
Sorry to take so long .
The problem above should now be the "+" symbol. The webserver will substitute the plus symbol for a space character. Generally when you submit a URL, the browser will take space characters and convert them to "+" symbols that the webserver then converts back to a space.
Sooo, you'll need to http escape the "+" symbol as well. Check out the ph_htmlescape function. You may want to pass the whole URL text into this function to escape everything for you.
HTH,
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 13 2006 at 18:01 | IP Logged
|
|
|
Ah! Thanks!
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 13 2006 at 20:03 | IP Logged
|
|
|
Yup! That was it!
Here is the revised code that allows you to click on a displayed track and play it...
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> PH Playlist </TITLE>
</HEAD>
<BODY>
<font face="verdana" size=2>
<% ph_rtne( ph_setvar_a( 1, 1, ph_winampinfo( "listpos", 0, 0 ) ) + ph_setvar_a( 1, 2, 5 ) + ph_setvar_a( 1, 3, "" ) + ph_setvar_a( 1, 4, if( ph_getwebparm( "start" )="", ph_getvar_n( 1, 1) - ph_getvar_n( 1, 2), number( ph_getwebparm( "start" ))) ) + ph_setvar_a( 1, 5, ph_getvar_n( 1, 4) ) ) %>
<% ph_rtne( ph_forloop("ph_concatvar( 1, 3, ph_getvar_n( 1, 4 ) + ': ' + if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '<b>', '' ) + '<a href=~"/ph-cgi/evalformula?formula=ph_winampctrl(%22seeklist %22,' + ph_getvar_n( 1, 4) + ',%22%22)%2bph_winampctrl(%22play%22,0,%22%22)&nexturl=/play list2.psp~">' + ph_winampinfo( 'listtitlename', ph_getvar_n( 1, 4 ), 0) + '<br>' + if( ph_getvar_n( 1, 4) = ph_getvar_n( 1, 1), '</b>', '' ) + '</a>') + ph_addtovar( 1, 4, 1)", ph_getvar_n( 1, 5), ph_getvar_n( 1, 5) + ph_getvar_n( 1, 2) * 2, 1) ) %>
<% ph_getvar_s( 1, 3) %><br>
<a href="/playlist.psp?start=<% ph_getvar_n( 1, 5) - (ph_getvar_n( 1, 2)*2 + 1) %>">Prev</a> •
<a href="/playlist.psp">Home</a> •
<a href="/playlist.psp?start=<% ph_getvar_n( 1, 5) + ph_getvar_n( 1, 2)*2 + 1 %>">Next</a>
</BODY>
</HTML> |
|
|
Next comes a version with a search function.
|
Back to Top |
|
|
theowl Groupie
Joined: February 24 2006 Location: United States
Online Status: Offline Posts: 59
|
Posted: February 22 2008 at 18:29 | IP Logged
|
|
|
Tried to use the last version posted, but it failed to seek to the correct position and play the song. After a little investigation, I found the issue to be an extra space after seeklist...
Code:
'<a href=~"/ph-cgi/evalformula?formula=ph_winampctrl(%22seeklist %22,' |
|
|
Removed that space and all is well.
Thanks much Tony!
Now just to figure out if I can put this directly into the CC page or just link to it. I'm not at the point where I want to redo my entire web control in PHP.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 22 2008 at 19:18 | IP Logged
|
|
|
Yeah, the forum adds random spaces for some reason.
|
Back to Top |
|
|
|
|