23rd August 2008 - There was an issue with our name caching server at around 08:00AM GMT. It has been fixed.

Song List

HA... VIA Powerhome

Song List

Postby TonyNo on Sat Aug 02, 2008 10:26 pm

So, Jake was asking how I made my audio screen.

http://tonyno.ods.org/eh/eHAudio2.jpg

All I did was add seven text objects, called them txtPLM3, txtPLM2, txtPLM1, txtPL0, txtPL1, txtPL2, and txtPL3, then, in the ON_HA_SCRN_SWITCH section of eHomeClient.vbs, I update the text based on the current Winamp playlist.

Code: Select all
if sNewScreenName="scrAudio2" then
      plpos = ehCleanUpCRLF(g_oGbl.EH_PH_CALL_RETVAR("ph_winampinfo( 'listpos', 0, 0)"))

      ehHaLabelChgCaption "scrAudio2","txtPLM3", ehCleanUpCRLF(g_oGbl.EH_PH_CALL_RETVAR( "ph_winampinfo( 'listtitlename', " & plpos - 3 & ", 0)"))
      ehHaLabelChgCaption "scrAudio2","txtPLM2", ehCleanUpCRLF(g_oGbl.EH_PH_CALL_RETVAR( "ph_winampinfo( 'listtitlename', " & plpos - 2 & ", 0)"))
      ehHaLabelChgCaption "scrAudio2","txtPLM1", ehCleanUpCRLF(g_oGbl.EH_PH_CALL_RETVAR( "ph_winampinfo( 'listtitlename', " & plpos - 1 & ", 0)"))
      ehHaLabelChgCaption "scrAudio2","txtPL0", ehCleanUpCRLF(g_oGbl.EH_PH_CALL_RETVAR( "ph_winampinfo( 'listtitlename', " & plpos & ", 0)"))
      ehHaLabelChgCaption "scrAudio2","txtPL1", ehCleanUpCRLF(g_oGbl.EH_PH_CALL_RETVAR( "ph_winampinfo( 'listtitlename', " & plpos + 1 & ", 0)"))
      ehHaLabelChgCaption "scrAudio2","txtPL2", ehCleanUpCRLF(g_oGbl.EH_PH_CALL_RETVAR( "ph_winampinfo( 'listtitlename', " & plpos + 2 & ", 0)"))
      ehHaLabelChgCaption "scrAudio2","txtPL3", ehCleanUpCRLF(g_oGbl.EH_PH_CALL_RETVAR( "ph_winampinfo( 'listtitlename', " & plpos + 3 & ", 0)"))

end if


The master plan is to use the up and down arrows to move through the playlist and to have the play buttons play the selected song.
TonyNo
 
Posts: 351
Joined: Sat Mar 17, 2007 3:53 pm
Location: Illinois USA

Re: Song List

Postby JakeBullet on Thu Aug 07, 2008 9:17 am

Yep. Looks good. How is the speed?
JakeBullet
Site Admin
 
Posts: 1102
Joined: Thu Mar 23, 2006 8:13 am

Re: Song List

Postby TonyNo on Thu Aug 07, 2008 11:44 am

A bit slow.
TonyNo
 
Posts: 351
Joined: Sat Mar 17, 2007 3:53 pm
Location: Illinois USA

Re: Song List

Postby JakeBullet on Thu Aug 07, 2008 12:01 pm

Yeah. Problem with the socket server is you have to connect, send the msg and then PH closes the port.
OK - Create a macro, make 1 call and just put them in global vars... :)
JakeBullet
Site Admin
 
Posts: 1102
Joined: Thu Mar 23, 2006 8:13 am

Re: Song List

Postby TonyNo on Thu Aug 07, 2008 5:11 pm

Yup, that would make it easier to keep track of while scrolling through a playlist.
TonyNo
 
Posts: 351
Joined: Sat Mar 17, 2007 3:53 pm
Location: Illinois USA

Re: Song List

Postby JakeBullet on Thu Aug 07, 2008 5:29 pm

Also too... You could put them all in 1 string. Like track1$$track2$$track3$$track4
Then in eHome use the VBA SPLIT function and then its only 1 global var. 1 PH UDP message

Need help with on the EH side let me know. :P
JakeBullet
Site Admin
 
Posts: 1102
Joined: Thu Mar 23, 2006 8:13 am

Re: Song List

Postby JakeBullet on Tue Aug 12, 2008 2:37 pm

Still looking to add up and down arrows? I have some code that will help?
JakeBullet
Site Admin
 
Posts: 1102
Joined: Thu Mar 23, 2006 8:13 am

Re: Song List

Postby TonyNo on Tue Aug 12, 2008 11:36 pm

Nice tip (the split)!

I have some code, but, I'd like to see what you have!
TonyNo
 
Posts: 351
Joined: Sat Mar 17, 2007 3:53 pm
Location: Illinois USA

Re: Song List

Postby TonyNo on Fri Aug 15, 2008 2:32 pm

Here's a PH formula to get the current and prev/next three songs and pack it up...

Code: Select all
ph_rtne(ph_setvar_a(1, 1, ph_winampinfo("listpos", 0, 0))) + ph_winampinfo( "listtitlename", ph_getvar_n(1,1)-3, 0)+"$$"+ph_winampinfo( "listtitlename", ph_getvar_n(1,1)-2, 0)+"$$"+ph_winampinfo( "listtitlename", ph_getvar_n(1,1)-1, 0)+"$$"+ph_winampinfo( "listtitlename", ph_getvar_n(1,1), 0)+"$$"+ph_winampinfo( "listtitlename", ph_getvar_n(1,1)+1, 0)+"$$"+ph_winampinfo( "listtitlename", ph_getvar_n(1,1)+2, 0)+"$$"+ph_winampinfo( "listtitlename", ph_getvar_n(1,1)+3, 0)


Sample output...

Shiny Magazine$$Prince - If Eye Was The Man In Ur Life$$The Fixx - One Thing Leads To Another$$The Jeff Healey Band - I Need to Be Loved$$Eric Johnson - Cliffs Of Dover$$Barenaked Ladies - Break Your Heart$$Prince - Peach
TonyNo
 
Posts: 351
Joined: Sat Mar 17, 2007 3:53 pm
Location: Illinois USA

Re: Song List

Postby JakeBullet on Sat Aug 16, 2008 7:14 am

I was thinking more about getting the whole play list. Is there a reason you are only getting a few songs?
reason i ask is The code I have will manage the whole list
JakeBullet
Site Admin
 
Posts: 1102
Joined: Thu Mar 23, 2006 8:13 am

Re: Song List

Postby TonyNo on Sat Aug 16, 2008 11:12 am

Big reason... Big playlist! Things grind to a halt when I try that. :wink:
TonyNo
 
Posts: 351
Joined: Sat Mar 17, 2007 3:53 pm
Location: Illinois USA

Re: Song List

Postby JakeBullet on Mon Aug 18, 2008 1:38 pm

EH or the PH side? Where is gthe list on the PH side? In a table?
JakeBullet
Site Admin
 
Posts: 1102
Joined: Thu Mar 23, 2006 8:13 am

Re: Song List

Postby TonyNo on Mon Aug 18, 2008 4:37 pm

The list is only in Winamp and I access it with the ph_winampinfo function.
TonyNo
 
Posts: 351
Joined: Sat Mar 17, 2007 3:53 pm
Location: Illinois USA

Re: Song List

Postby JakeBullet on Tue Aug 19, 2008 8:19 pm

ready... :)

Create a screen named 'scrWxtest'
Create 5 labels named lblSong0,lblSong1,lblSong2,lblSong3,lblSong4
Create 3 buttons named who cares! Make there captions 'Init' , 'Next page' , 'Prev page'

In Init button add this code:
Code: Select all
        dim v
        v = "ttack1$$track2$$track3$$track4$$track5$$track6$$track7$$"
        v = v & "track8$$track9$$tracka$$track10$$track11$$track12$$track13$$"
        v = v & "track14$$track15$$track16$$track17$$track18$$track19$$track20$$"
        v = v & "track21$$track22$$track23$$track24$$track25$$track26$$track27$$"
        v = v & "track28$$track29$$track30$$track31$$track32$$track33$$track34$$"
        v = v & "track35$$track36$$track37$$track38$$track39$$track40$$track41" 
        g_oGbl.Cargo_Add v,"LST_ITEM_STR"
       
        SongListManage "INIT","5"  '--- 5 is the total labels


In the Prev button
Code: Select all
SongListManage "PREV",0


Next Button
Code: Select all
SongListManage "NEXT",0


In your eHomeClient INI add this code.

Code: Select all
Function SongListManage(sAction, sVars)

    Dim xx, nCurrentPage
   

    With g_oGbl
    Select Case sAction

      Case "SELECT_SONG"
            '--- code to select song here

      Case "CLEAR"
            ehHaLabelChgCaption "scrWxtest", "lblSong0", ""
            ehHaLabelChgCaption "scrWxtest", "lblSong1", ""
            ehHaLabelChgCaption "scrWxtest", "lblSong2", ""
            ehHaLabelChgCaption "scrWxtest", "lblSong3", ""
            ehHaLabelChgCaption "scrWxtest", "lblSong4", ""
     

        Case "INIT"
             '--- initing! just a flag to let us know
            .Cargo_Add "1", "LST_INIT"

            '--- spit the list and store
            Dim arrList
            arrList = Split(.Cargo_Item("LST_ITEM_STR"), "$$")
            .Cargo_Add arrList, "LST_ITEMS"

            .Cargo_Add sVars, "LST_PAGE_SIZE"
            .Cargo_Add UBound(arrList), "LST_ITEM_TTL"

            '--- calc total pages
            Dim nTotalPage, nAddOne
         nAddOne = IIf(((.Cargo_Item("LST_ITEM_TTL") + 1) Mod (sVars)), 1, 0)
         nTotalPage = Int(cInt(.Cargo_Item("LST_ITEM_TTL") + 1) / (sVars)) + nAddOne
         
         '--- store total pages   
            .Cargo_Add nTotalPage, "LST_PAGES_TTL"

            '--- store current page
             .Cargo_Add 1, "LST_CURR_PAGE"

            '--- show the 1st page
         SongListManage "SHOW_PAGE",1
         
         
      Case "SHOW_PAGE"
            '--- call myself and clear the list
         SongListManage "CLEAR", 0

            '--- calc start and end array index pointers
            Dim nStart, nEnd, nIndex, nCount
            Dim nPage: nPage = sVars
            nStart = (nPage * .Cargo_Item("LST_PAGE_SIZE")) - (.Cargo_Item("LST_PAGE_SIZE"))
            nEnd = nStart + .Cargo_Item("LST_PAGE_SIZE") - 1
            If nEnd > .Cargo_Item("LST_ITEM_TTL") Then
                nEnd = .Cargo_Item("LST_ITEM_TTL")
            End If

            '--- paint them to the screens
            nIndex = 0
            For nCount = nStart To nEnd
                ehHaLabelChgCaption "scrWxtest", "lblSong" & Trim(cStr(nIndex)), Cargo_Item("LST_ITEMS")(nCount)
                nIndex = nIndex + 1
            Next
         
      Case "PREV"
            '--- move to the prev page
            nCurrentPage = .Cargo_Item("LST_CURR_PAGE") - 1
            If nCurrentPage <= 0 Then
                nCurrentPage = 1
            Else
                SongListManage "SHOW_PAGE", nCurrentPage
            End If
            .Cargo_Add nCurrentPage, "LST_CURR_PAGE"


        Case "NEXT"
            '--- move to the next page
            nCurrentPage = .Cargo_Item("LST_CURR_PAGE") + 1
            If nCurrentPage > .Cargo_Item("LST_PAGES_TTL") Then
                 nCurrentPage = nCurrentPage - 1
            Else
                 SongListManage "SHOW_PAGE", nCurrentPage
            End If
            .Cargo_Add nCurrentPage, "LST_CURR_PAGE"
   
       
    End Select
    End With

End Function

Function IIf( expr, truepart, falsepart )
   IIf = falsepart
   If expr Then IIf = truepart
End Function



Let me know how that works. Once that is done we can get the song select working and the speed issue with playlist
JakeBullet
Site Admin
 
Posts: 1102
Joined: Thu Mar 23, 2006 8:13 am

Re: Song List

Postby TonyNo on Wed Aug 20, 2008 12:20 am

That's another way to do it! I'll try it out.
TonyNo
 
Posts: 351
Joined: Sat Mar 17, 2007 3:53 pm
Location: Illinois USA

Next

Return to HA Stuff - Powerhome

Who is online

Users browsing this forum: No registered users and 1 guest



FREE FORUM Hosting by AtFreeForum. Create your Free WEB FORUM Hosting now!
GROUP DISCUSSION Features - Free FORUM HOSTING Directory Listing - DISCUSSION FORUM Terms of Service - FREE PHPBB Hosting Privacy
- FASHION ACCESSORIES
cron