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: WSH Panel Mod script discussion/help (Read 1387679 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod script discussion/help

Reply #3100
@mire777, thank you very much.

WSH Panel Mod script discussion/help

Reply #3101
that stopped working months ago when last.fm shut down their artist images API feed.

i have a workaround in place. the thumbs script in my current pack downloads exactly the same images but it's quite a bit slower than the old method. if you use it, make sure you read the Help dialog on the right click menu as it explains a few things.

the code is bit of a mess so i just suggest using as it is rather than trying to pick it apart.



I've also tried using your thumbs script - no errors, no new images automatically, however manually activating still works?

Damn feeds and their pesky APIs...

WSH Panel Mod script discussion/help

Reply #3102
the automatic download option is nothing to do with last.fm - it's my script that determines whether or not to download automatically.

first thing is check the automatic download option is turned on. i turned it off by default for new panels because it seemed quite slow when i last tested it. having said, i tried it recently and it was much faster. also, if you right click the panel and check the Help, it explains in more detail how automatic downloads are triggered. for example, it doesn't automatically do it on dynamic title changes from streams,

WSH Panel Mod script discussion/help

Reply #3103
the automatic download option is nothing to do with last.fm - it's my script that determines whether or not to download automatically.

first thing is check the automatic download option is turned on. i turned it off by default for new panels because it seemed quite slow when i last tested it. having said, i tried it recently and it was much faster. also, if you right click the panel and check the Help, it explains in more detail how automatic downloads are triggered. for example, it doesn't automatically do it on dynamic title changes from streams,



I'm using thumbs; latest version (checked update)

[automatic download / all tracks]

There is no action in the console and I don't think it's used, but art.exe never seems to get called from task manager.

when you mention "It will not download on a selection change" does that mean it won't activate when actual songs change? (e.g. shuffle play)
I also tried stopping and starting, but still nothing.

[manually selecting download artist art does always work]

WSH Panel Mod script discussion/help

Reply #3104
Marc, i was now switch to DUI, so now i can use your thumbs script with wsh 1.5.6.

Only thing that i miss from my modified script, is:
-when select -crop on top image , it doesn't move picture completely on top
-custom folder location where to save images
-And why it doesn't download images on dynamic title changes from streams?

In biography text script, i would like to have option to hide red last.fm button, and artist name..


Also i have suggestion how to improve your script to load images after download.
Your script download all images at once, but after one picture is downloaded script do ''im.update'' this brakes thumbs images until download is finished..

What you can do? You can check how many images web page have(''Math.min(urls.length..'') and what is download limit, then after download them all in folder(check on timer), you can do ''im.update''.
Or what i was do, after download first image -do update once, and after download them all do ''im.update'' again.
This work great on my script.. First image appear after 12-15 sec, and other after 30 sec...

WSH Panel Mod script discussion/help

Reply #3105
but art.exe never seems to get called from task manager.


that is obsolete and can be deleted. it uses the old API which last.fm have disabled.

Quote
when you mention "It will not download on a selection change"


the panel can be configured to follow the cursor so what i mean by that is that it will not download when you select something else in the playlist. it will display any existing images for the selected track but won't automatically download new images.

for it to download automatically, the following conditions musts be met:

the file being played must be local and not a stream. playback order should be irrelevant.
an appropriate automatic download option must be selected.
no images must exist for the artist.
the artist must be different from the previous track (if the artist is the same, the panel does nothing)
the download gets triggered when the playback time hits one second. if you somehow skip past this or use foo_skip to jump to another point in the track, the automatic download will not trigger.
if selection mode is not set to prefer to now playing, the selected item must also be the playing track. if you have it set to follow selected track then you should probably enable Cursor follows playback on the main Playback menu.


WSH Panel Mod script discussion/help

Reply #3107
for it to download automatically, the following conditions musts be met:



My current install meets all of those criteria. The only thing I can think of:

does it check for empty image folder, or is there a flag in the database for 'artist images exist'?

I'm running a new Foobar install with a copy of an old library db (to keep playcounts etc intact) - there are no artist images yet.

WSH Panel Mod script discussion/help

Reply #3108
images are stored in a separate folder for each artist so it simply checks to see if any images already exist.

there is no database. that is only used by my playcount sync script.

WSH Panel Mod script discussion/help

Reply #3109
images are stored in a separate folder for each artist so it simply checks to see if any images already exist.

there is no database. that is only used by my playcount sync script.


thanks Marc

I'm still not sure what the problem is - some sort of conflict with another script (or # of scripts?) - I tried just making the panel it's own theme to test and it worked fine.


WSH Panel Mod script discussion/help

Reply #3110
some sort of conflict with another script (or # of scripts?)


i doubt this. all panels should work independently of each other. i certainly have most of my scripts in a single layout and automatic downloading works fine.

i suppose one thing you could try is resetting all the defaults in your normal layout?? hold shift and right click the panel>properties. from there click the clear button. obviously automatic downloads will be off and you'll also need to change any other custom settings you had.

and not that it matters but i just realised this part of my previous post is untrue. 

Quote
the artist must be different from the previous track (if the artist is the same, the panel does nothing)


if there are no images each time a track is played, it will check everytime regardless of what the previous artist was.


WSH Panel Mod script discussion/help

Reply #3112
Regarding dynamic titles from streams did you ever look into my solution in post
http://www.hydrogenaud.io/forums/index.php...st&p=861702

It is working for me .


Yes it works fine for me..
All you must to do is to put im.download(); in on_metadb_changed();
I would like at least: custom folder where to save images and to download images on_metadb_changed(); .
I want to use original script, but i must to use my, or to change script every time when Marc do update, pity...

WSH Panel Mod script discussion/help

Reply #3113
@Zeremy

I downloaded your ''internet radio playlist importer'' looks nice..
But it have problem on this line: p.browser("http://lab.rolisoft.net/playlists.html"); }, "Provider", false) ,
You must remove ' , ' on end, or script will crash.
Also you don't need this: ''if (p.dui) window.MinHeight = window.MaxHeight = bh + 12;''
This line -lock panel size, and then you see only buttons. Idea is great, but menu must be better done if you have images you need scrollbar also, or use simple menu instead..

WSH Panel Mod script discussion/help

Reply #3114
@Zeremy

I downloaded your ''internet radio playlist importer'' looks nice..
But it have problem on this line: p.browser("http://lab.rolisoft.net/playlists.html"); }, "Provider", false) ,
You must remove ' , ' on end, or script will crash.
Also you don't need this: ''if (p.dui) window.MinHeight = window.MaxHeight = bh + 12;''
This line -lock panel size, and then you see only buttons. Idea is great, but menu must be better done if you have images you need scrollbar also, or use simple menu instead..


@mire777

I removed your suggestions and the script still works or me. (I updated the download link)
My scripting knowledge is limited , and I adapted it to my window size needs on my laptop.

Maybe I will try the  simple menu solution when I find the time.
I'm glad someone found it useful.

WSH Panel Mod script discussion/help

Reply #3115
Regarding dynamic titles from streams did you ever look into my solution in post
http://www.hydrogenaud.io/forums/index.php...st&p=861702

It is working for me .


that "solution" is beyond awful.  a new web request to download images is being launched everytime the selection changes in the playlist regardless of what foobar is doing or what preferences you have set. potentially you be launching dozens of requests at a time if navigating a playlist with a keyboard or just randomly clicking stuff with your mouse. 

WSH Panel Mod script discussion/help

Reply #3116
Regarding dynamic titles from streams did you ever look into my solution in post
http://www.hydrogenaud.io/forums/index.php...st&p=861702

It is working for me .


that "solution" is beyond awful.  a new web request to download images is being launched everytime the selection changes in the playlist regardless of what foobar is doing or what preferences you have set. potentially you be launching dozens of requests at a time if navigating a playlist with a keyboard or just randomly clicking stuff with your mouse. 


@marc2003

I'm sorry I don't see that problem.
Only when the metabase is changed , I see network traffic downloading from last.fm.
Yes, requests are made on PLAY and when dynamic titles are changed in the stream , but not when navigating / selecting items in  the playlists.

If you need more information about my config , I am more than willing to share with you.

The only settings I changed are

function on_metadb_changed() {
   b.update();
   im.download();
    r.metadb_changed();
   im.metadb_changed();
   t.metadb_changed();
   c.metadb_changed();
   if (p.metadb) {
      line1.text = p.eval(line1.tf);
      line2.text = p.eval(line2.tf);
      line3.text = p.eval(line3.tf);
   }
   window.Repaint();
}

WSH Panel Mod script discussion/help

Reply #3117
@Zeremy

I downloaded your ''internet radio playlist importer'' looks nice..
But it have problem on this line: p.browser("http://lab.rolisoft.net/playlists.html"); }, "Provider", false) ,
You must remove ' , ' on end, or script will crash.
Also you don't need this: ''if (p.dui) window.MinHeight = window.MaxHeight = bh + 12;''
This line -lock panel size, and then you see only buttons. Idea is great, but menu must be better done if you have images you need scrollbar also, or use simple menu instead..


@mire777

I removed your suggestions and the script still works or me. (I updated the download link)
My scripting knowledge is limited , and I adapted it to my window size needs on my laptop.

Maybe I will try the  simple menu solution when I find the time.
I'm glad someone found it useful.


@mire777
Internet Radio Playlist Importer v2

I created the simple menu solution.

It now requires the component foo_cmd_playlist from http://www.hydrogenaud.io/forums/index.php?showtopic=47148 , as each selection in the menu now creates a new playlist of your selection.

https://www.dropbox.com/s/t5q0xmz101r5ysf/s...nshot2.png?dl=0

https://www.dropbox.com/s/h9b1b3ydvh2h40j/w...simple.rar?dl=0

WSH Panel Mod script discussion/help

Reply #3118
@mire777
Internet Radio Playlist Importer v2

I created the simple menu solution.

It now requires the component foo_cmd_playlist from http://www.hydrogenaud.io/forums/index.php?showtopic=47148 , as each selection in the menu now creates a new playlist of your selection.

https://www.dropbox.com/s/t5q0xmz101r5ysf/s...nshot2.png?dl=0

https://www.dropbox.com/s/h9b1b3ydvh2h40j/w...simple.rar?dl=0



Works great. Only one thing, you don't need  ''foo_cmd_playlist''.
Use something like this to create playlist:

Code: [Select]
//Make Playlist
function PlaylistID(Playlist_Name)
{
for (var i = 0; i < fb.PlaylistCount; i++)
{
if (fb.GetPlaylistName(i) == Playlist_Name)
{
return i;
}
}

//Create playlist if it doesn't exist
fb.CreatePlaylist(fb.PlaylistCount, Playlist_Name);
return i;
}


//Focus on playlist
function set_focus()
{  
fb.ActivePlaylist = (PlaylistID("your name for playlist"));
}

WSH Panel Mod script discussion/help

Reply #3119
zeremy, concerning when on_metadb_changed() is called in thumbs.txt:

add the following line under function on_metadb_changed() in thumbs.txt:
Code: [Select]
fb.trace("function on_metadb_changed was called");

Then navigate around a playlist.  What do you see in the console?
Try this for any of the context menu selection modes.  Do you see any different behavior in what is shown in the console?

WSH Panel Mod script discussion/help

Reply #3120
zeremy, concerning when on_metadb_changed() is called in thumbs.txt:

add the following line under function on_metadb_changed() in thumbs.txt:
Code: [Select]
fb.trace("function on_metadb_changed was called");

Then navigate around a playlist.  What do you see in the console?
Try this for any of the context menu selection modes.  Do you see any different behavior in what is shown in the console?


I was put only im.download(); in metadb, this trigger double download, if download is start, and something other in playlist is focused..
This can be solved i think..

Edit:

Solution:
This trigger download only on 'playback new track'. But works for streams also:

Code: [Select]
function on_metadb_changed() {

im.metadb_changed();

if (on_playback_time(1)) {

im.download();

}
window.Repaint();
}

WSH Panel Mod script discussion/help

Reply #3121
zeremy, concerning when on_metadb_changed() is called in thumbs.txt:

add the following line under function on_metadb_changed() in thumbs.txt:
Code: [Select]
fb.trace("function on_metadb_changed was called");

Then navigate around a playlist.  What do you see in the console?
Try this for any of the context menu selection modes.  Do you see any different behavior in what is shown in the console?


Yes , using the thumbs.txt , when selecting other item in playlist function on_metadb_changed was called and artwork gets downloaded.
I don't use that script and thats why it probably had no difference.

I was originally taking only about the Now Playing script , which was the only script I modified with the im.download entry and it doesn't affect my navigation.

WSH Panel Mod script discussion/help

Reply #3122
My solution works  on 'playback new track' only but this include radio streams
There can be added option for this in 'selection menu'. Why not?...

WSH Panel Mod script discussion/help

Reply #3123
After further investigation , I have to admit that marc2003 was correct as multiple requests are made while browsing the playlist entries.

The if statement on metadb_changed  that we need could be if %path% begins with "http" then im.download.

That way requests will be made only when streams are playing.

What would the code be to implement such a solution?

WSH Panel Mod script discussion/help

Reply #3124
After further investigation , I have to admit that marc2003 was correct as multiple requests are made while browsing the playlist entries.

The if statement on metadb_changed  that we need could be if %path% begins with "http" then im.download.

That way requests will be made only when streams are playing.

What would the code be to implement such a solution?

@mire777
Forget about on metadb_changed solution.
Can you test my code  please?

Code: [Select]
function on_playback_dynamic_info_track() {
    fb.trace("playback_dynamic_info_track called");
    fb.trace("Current Title");
   
    im.metadb_changed();
   
    p.console (fb.TitleFormat("%_path_raw%").Eval());
    p.console (fb.TitleFormat("%artist%").Eval());
    var url = new RegExp("http://", "i");
        if(fb.TitleFormat("%_path_raw%").Eval(true).match(url))
        {
            fb.trace("http:// url true - forcing last.fm artist image download ");
            im.download();
        }
        else
        {
           
            fb.trace("not a http:// url - ignoring ");
        }
 
}