Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_httpcontrol (Read 932982 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foo_httpcontrol

Reply #175
larski, it's the one of an interesting approach, nice.
regarding support of tagging, it is available via cmdline interface, I guess. just look a bit up the thread.

foo_httpcontrol

Reply #176
Thx, that works fine. Must have missed that post


 

foo_httpcontrol

Reply #178
I just discovered this today. Great Work, Thanks!
I would love to have some way of keyword searching the playlist or the directories. (other then using the *find* feature in the web browser) Maybe this is possible already, I'm just not aware of how to go about this. Thanks, again

foo_httpcontrol

Reply #179
Trying to get this to work on my nokia N82. Anyone who managed to get it to work on an Nseries phone?

foo_httpcontrol

Reply #180
Trying to get this to work on my nokia N82. Anyone who managed to get it to work on an Nseries phone?

perhaps you should start with stripping down as much javascript as possible and heavily reducing the amount of displayed information.

foo_httpcontrol

Reply #181
made my webui with firefox as well (IE is still not supported and will not be):

http://www.2shared.com/file/3717567/6947f4...ntrol_data.html
http://www.uploading.com/files/9XPZ4C6M/fo...l_data.zip.html

thanks for the port. I am using FF 3 on Vista. Ii looks really good and is a pretty reactive interface.

volumebar and progress bar are not clickable. (except extreme right/left). I am a nub, but tried to read your code and it seems your intention was to make the areas clickable. A bug ?

also, if i may : the layout is really big! could you reduce size so that it fits without scrolling on a regular size screen... i mean about 500 pixel height should be sufficient. For example, thiner prgress bar and put the volume % in the volumebar would save space and be even better looking.

are you working on playlist management in ajax as well ? the potential of this interface seems really great.

foo_httpcontrol

Reply #182
hm, overlooked the bars not working in FF. No idea why they don't work there, works fine in Opera (which is my main browser and thus the browser this was created for).
I'm not planning to make any further changes on this interface at the moment as it has all the features I need but feel free to built uppon it or reuse any of the code/ideas used

foo_httpcontrol

Reply #183
are you working on playlist management in ajax as well ? the potential of this interface seems really great.


I've been toying around with this a bit myself, with the goal of making an iPhone UI that is more consistent with the iPod app.  The playlist is a bit difficult to work with though, since there appears to be some table formatting built-in.

foo_httpcontrol

Reply #184
Would it be possible to move the playlist formatting (the table rows and links) out of the internal code and either into a parameter in the settings or an external file?

foo_httpcontrol

Reply #185
being exactly specific in what data you want to receive should really help me, as it will save my time.

removing builtin table formatting seems a good way except it doesn't answer to the question where playlist highlighting data should be going. we can't just drop it, right?

so, won't you mind to be a good sport, go ahead and elaborate on the request?

foo_httpcontrol

Reply #186
being exactly specific in what data you want to receive should really help me, as it will save my time.

removing builtin table formatting seems a good way except it doesn't answer to the question where playlist highlighting data should be going. we can't just drop it, right?

so, won't you mind to be a good sport, go ahead and elaborate on the request?


If you are referring to the odd, even and focus classes, you already mentioned one possibility earlier in this thread: store the playlist as an array in an external file.  You wouldn't need to pass the highlighting data because the user would have all the information he needs to make his own.  There are other possibilities too, but I think that would probably be the most efficient.

The only question is how to store the array.  XML might be the obvious choice, though I opted for JSON in my template since it does not require an external interpreter and is therefore faster.  The downside is that I ran in to a host of issues with quotes.  Since JSON data is really just a JavaScript array, it doesn't like quotes or apostrophes within the data.  The user-specified formatting strings in your component do not have this problem, as they are apparently stripped of quotes before being stored as a macro.  The extra formatting code (e.g. highlight classes), however, is not stripped of quotes.  At the moment, I'm using a few lines of JavaScript to parse the playlist and pull out the quotes where necessary.

foo_httpcontrol

Reply #187
The only question is how to store the array.  XML might be the obvious choice, though I opted for JSON in my template since it does not require an external interpreter and is therefore faster.

care to show example of your own JSON playlist data structures and code digging through them? it might help to push myself towards the right direction.

foo_httpcontrol

Reply #188
care to show example of your own JSON playlist data structures and code digging through them? it might help to push myself towards the right direction.


Sure.

The JSON data is stored in the foo_httpcontrol_controls_tpl file, much like Larskl's solution.  As I said, it's basically just a JavaScript array:
Code: [Select]
{
"playlist": "[PLAYLIST]",
"volume": "[VOLUME]",
"isplaying": "[IS_PLAYING]",
"ispaused": "[IS_PAUSED]",
"lastaction": "[LAST_ACTION]",
"trackpos": "[TRACK_POS]",
"tracklen": "[TRACK_LEN]",
"helper1": "[HELPER1]",
"helper2": "[HELPER2]",
"helper3": "[HELPER3]",
"albumart": "[ALBUMART]"
}

Here's the code that parses it, taken from the AJAX function called on state changes:
Code: [Select]
jsonString = httpRequestStatus.responseText;
plString = jsonString.substring(jsonString.indexOf('<'),jsonString.indexOf('",'));
plStringNew = plString.replace(/"/g,'');
plStringNew = plStringNew.replace(/'/g,"");
h1String = jsonString.substring(jsonString.indexOf("<div>"),jsonString.indexOf('</div>"'));
h1StringNew = h1String.replace(/"/g,'');
jsonString = jsonString.replace(plString,plStringNew);
jsonString = jsonString.replace(h1String,h1StringNew);
fooVars = eval("(" + jsonString + ")");

7 of those 9 lines are doing nothing but stripping quotes.  Since the JSON data structure itself uses quotes, I can't just strip all of them out of the file, so those lines isolate the playlist and helper1 macros -- the ones that potentially have quotes in them -- and strip their quotes.  The code only makes sense if you know that the playlist macro is the very first "<" in the data array, and the helper1 macro is the first div.  I apologize for the confusing code; cleanup will come later.

In any case, the import bit is the eval() function.  You can use the built-in JavaScript interpreter to parse JSON data instead of having to load a DOM parser for XML.

foo_httpcontrol

Reply #189
thanks for the tip on JSON! it looked easy enough, so the following quick and dirty fb2k state structure based on your example came upon my mind:
Code: [Select]
var fb2k = 
{
    "playlist": [ { entry_1 }, { entry_etc } ],        // to implement
// example of custom titleformatted entry:
// "track": "Some track title", "len": "5:01", "playing": "%is_playing%", "focus": "{IS_FOCUSED}", "previously_played": "{PREVIOUSLY_PLAYED}", "q_num" : "{QUEUE_NUM}"
//
// {IS_FOCUSED}, {QUEUE_NUM}, {PREVIOUSLY_PLAYED} need to be implemented, this data is not available in titleformatting
    "playlist_page": "[PLAYLIST_PAGE]",                // to implement
    "playlist_total_pages": "[PLAYLIST_PAGES]",        // to implement
    "playlist_total_time": "[PLAYLIST_TOTAL_TIME]",
    "queue_total_time": "[QUEUE_TOTAL_TIME]",
    "playlists": [                                  // to implement
       { "name": "Playlist 1", "items" : "102" },
       { "name": "Playlist etc", "items" : "54" } ],
    "playlists_current": "[PLAYLIST_CURRENT]",        // to implement
    "playlists_total": "[PLAYLIST_TOTAL]",            // to implement
    "playback_order": "[PLAYBACK_ORDER]",            // to implement
    "volume": "[VOLUME]",
    "isplaying": "[IS_PLAYING]",
    "ispaused": "[IS_PAUSED]",
    "isenqueueing": "[IS_ENQUEUEING]",
    "lastaction": "[LAST_ACTION]",
    "stopaftercurrent": "[SAC]",
    "autorefresh": "[AUTO_REFRESH]",
    "trackpos": "[TRACK_POS]",
    "tracklen": "[TRACK_LEN]",
    "tracknum": "[TRACK_NUM]",
    "trackstotal": "[TRACKS_TOTAL]",
    "helper1": "[HELPER1]",
    "helper2": "[HELPER2]",
    "helper3": "[HELPER3]",
    "albumart": "[ALBUMART]"
}

please correct me if anything neccessary is forgotten.
the quotes issue can be avoided by replacing " with &quote; in every titleformatted field within the plugin.

foo_httpcontrol

Reply #190
Looks good, except for a few minor typos.  %is_playing% should be [IS_PLAYING], {IS_FOCUSED} should be [IS_FOCUSED], etc, but I'm sure you would've caught that before implementation.

foo_httpcontrol

Reply #191
I do realise this might look somewhat scary, but at least it seems to work
Code: [Select]
    v0.78 10 Aug
        add: [PLAYLIST_ACTIVE] - active playlist index,
             [PLAYLIST_PAGE] - current page of active playlist,
             [PLAYLIST_PAGES_COUNT] - number of playlist pages,
             [PLAYLIST_ITEM_FOCUSED], [PLAYLIST_ITEM_PLAYING], and
             [PLAYLIST_ITEM_PREV_PLAYED] - focused, now playing
             and previously played playlist items.

             [PLAYLIST_JS] - javascript array with current playlist items.
             each array element is defined by playlist row titleformatting
             string set in preferences. for example, the following
             playlist row value:
             { "track": "$replace(%title%,",)", "len": "%length%", "queue" : "%queue_indexes%" }
             creates you this array:
             [ { "track": "Laila", "len": "5:29", "queue" : "?" },
               { "track": "Outward bound", "len": "4:53", "queue" : "?" },
               ...etc...
               { "track": "December", "len": "3:19", "queue" : "?" },
               { "track": "South", "len": "4:49", "queue" : "?" } ]

             [PLAYLIST_JS] - javascript array with current playlist info
             (playlist name and playlist items count).
             sample return value:
             [ { "name": "local", "count": "0" }, { "name": "test", "count": "3" } ]

             these additions allows you to have important parts of fb2k state
             exported as a javascript array, for example:

             var fb2k =
             {
                 "playlist_items": [PLAYLIST_JS],
                "playlist": { "currentpage": "[PLAYLIST_PAGE]",
                              "totalpages": "[PLAYLIST_PAGES]",
                              "item_focus": "[PLAYLIST_ITEM_FOCUS]",
                              "item_playing": "[PLAYLIST_ITEM_PLAYING]",
                              "item_previouslyplayed": "[PLAYLIST_ITEM_PREV_PLAYED]" },
                            "playlist_total_time": "[PLAYLIST_TOTAL_TIME]",
                            "queue_total_time": "[QUEUE_TOTAL_TIME]",
                            "playlists": [PLAYLISTS_JS],
                            "playlist_current": "[PLAYLIST_ACTIVE]",
                            "playback_order": "[PLAYBACK_ORDER]",
                            "volume": "[VOLUME]",
                            "isplaying": "[IS_PLAYING]",
                            "ispaused": "[IS_PAUSED]",
                            "isenqueueing": "[IS_ENQUEUEING]",
                            "lastaction": "[LAST_ACTION]",
                            "stopaftercurrent": "[SAC]",
                            "autorefresh": "[AUTO_REFRESH]",
                            "trackpos": "[TRACK_POS]",
                            "tracklen": "[TRACK_LEN]",
                            "tracknum": "[TRACK_NUM]",
                            "trackstotal": "[TRACKS_TOTAL]",
                            "helper1": "[HELPER1]",
                            "helper2": "[HELPER2]",
                            "helper3": "[HELPER3]",
                            "albumart": "[ALBUMART]"
             }

foo_httpcontrol

Reply #192
The JSON playlist works great, thanks!

On a side note, it seems that the macros are only updated when no command is sent in the HTTP request, in other words to retrieve the playlist.  If a command is sent, such as to play or pause, the macro data is incomplete.

Here's an example:
Code: [Select]
{

"playlist": [ { "number": "01", "track": "The Pretender", "len": "4:29" }, { "number": "02", "track": "Let It Die", "len": "4:05" }, { "number": "03", "track": "Erase Replace", "len": "4:13" }, { "number": "04", "track": "Long Road To Ruin", "len": "3:45" }, { "number": "05", "track": "Come Alive", "len": "5:11" }, { "number": "06", "track": "Stranger Things Have Happened", "len": "5:21" }, { "number": "07", "track": "Cheer Up Boys, Your Make-up Is Running", "len": "3:41" }, { "number": "08", "track": "Summer's End", "len": "4:38" }, { "number": "09", "track": "The Ballad of the Beaconsfield Miners", "len": "2:32" }, { "number": "10", "track": "Statues", "len": "3:48" }, { "number": "11", "track": "But Honestly", "len": "4:36" }, { "number": "12", "track": "Home", "len": "4:53" } ],
"volume": "99",
"isPlaying": "1",
"currentTrack": "4294967295",
"trackpos": "0",
"tracklen": "0",
"helper1": "",
"helper2": "",
"helper3": "",
"albumArt": "/nocoverinfo.jpg"
}


The PLAYLIST_JS, VOLUME and IS_PLAYING macros are there, but the others are either empty or -- in the case of PLAYLIST_ITEM_PLAYING (currentTrack) -- just wacky.  The album in the example does have available cover art, so that macro isn't working either.

I've been working around it by running the request function with no command on an interval timer, but that's not very efficient.  Any idea what might be causing this?


Also, for anyone interested, here's a screenshot of my playlist, just like the iPod UI:

foo_httpcontrol

Reply #193
On a side note, it seems that the macros are only updated when no command is sent in the HTTP request, in other words to retrieve the playlist.  If a command is sent, such as to play or pause, the macro data is incomplete.

you should re-request data a few moments after playback has been started. the thing is that playback starts immediately after request, but the information about playing track won't available in the same command request session.
I don't know any workaround or what am I doing wrong, so I suggest the approach similar to the one used in the default template:

if ([HELPER1] == '' && ([IS_PLAYING] || [IS_PAUSED])) // if playing but track info is not loaded yet, reload page
   setTimeout('pc()',500);

foo_httpcontrol

Reply #194
The JSON playlist works great, thanks!

On a side note, it seems that the macros are only updated when no command is sent in the HTTP request, in other words to retrieve the playlist.  If a command is sent, such as to play or pause, the macro data is incomplete.

Here's an example:
Code: [Select]
{

"playlist": [ { "number": "01", "track": "The Pretender", "len": "4:29" }, { "number": "02", "track": "Let It Die", "len": "4:05" }, { "number": "03", "track": "Erase Replace", "len": "4:13" }, { "number": "04", "track": "Long Road To Ruin", "len": "3:45" }, { "number": "05", "track": "Come Alive", "len": "5:11" }, { "number": "06", "track": "Stranger Things Have Happened", "len": "5:21" }, { "number": "07", "track": "Cheer Up Boys, Your Make-up Is Running", "len": "3:41" }, { "number": "08", "track": "Summer's End", "len": "4:38" }, { "number": "09", "track": "The Ballad of the Beaconsfield Miners", "len": "2:32" }, { "number": "10", "track": "Statues", "len": "3:48" }, { "number": "11", "track": "But Honestly", "len": "4:36" }, { "number": "12", "track": "Home", "len": "4:53" } ],
"volume": "99",
"isPlaying": "1",
"currentTrack": "4294967295",
"trackpos": "0",
"tracklen": "0",
"helper1": "",
"helper2": "",
"helper3": "",
"albumArt": "/nocoverinfo.jpg"
}


The PLAYLIST_JS, VOLUME and IS_PLAYING macros are there, but the others are either empty or -- in the case of PLAYLIST_ITEM_PLAYING (currentTrack) -- just wacky.  The album in the example does have available cover art, so that macro isn't working either.

I've been working around it by running the request function with no command on an interval timer, but that's not very efficient.  Any idea what might be causing this?


Also, for anyone interested, here's a screenshot of my playlist, just like the iPod UI:


will you be making this available?

foo_httpcontrol

Reply #195
will you be making this available?


Yes, when it's done, and assuming Apple won't jump down my throat about copyright issues.  Pandora uses almost the exact same UI though, so I don't think it'll be a problem.


foo_httpcontrol

Reply #197
Any chance we could get the browser macro formatted with JSON like the playlist?

foo_httpcontrol

Reply #198
yes, it is doable, but only if you or anyone else will actually use this one.

foo_httpcontrol

Reply #199
yes, it is doable, but only if you or anyone else will actually use this one.


I can't speak for anyone else, but I certainly would, just as I'm using the JSON playlist now.  I don't want to release my template without browser functionality, which is why I haven't posted it yet.