[WSH Panel Mod]LastFM suite, a suite of wsh panels based on lastfm infos
[WSH Panel Mod]LastFM suite, a suite of wsh panels based on lastfm infos
Jan 25 2010, 17:18
Joined: 24-November 05
Member No.: 25981
It s finally time for me to release what i have put together so far.
Everything here is based on one single panel, the manager. It s aim is to allow to have one single configuration shared by many wsh panel mods. It will allow you to set properties.
The first thing you have to know about those properties is that you may use variables in them. If what you want is a foobar variable (related to a song) enter it just like you would in other components(%artist% for example). But there is also other variables related to wsh panel mod and that suite. They must differ from foobar properties so the syntax is different. Right now there is 2 of them, ?foobarpath? and ?lastfmdatapath?. I might introduce more in the future.
- First you have lastfm settings. You need to set a lastfm data path where everything will be cached. This might be the most important property. You must also set a LastFm API key and an account name. For that you obviously need a LastFM account!
- One very important setting is the path to wget(tools.wget). This is very important as it is used to download lastfm data. If wget is not found the manager will download directly in foobar and so it might freeze foobar while downloading!
In this release wget in installed in the directory "tools" in your foobar directory, though the "?foobarpath?tools/wget.exe" but you may change it if you want (but dont forget the dlls that goes with wget!!!).
- Then come the settings related to the art downloader. Here i use AlbumArtDownloader to download album art as well as artist art. But as other tools exist to download artist art, i made it possible to use a different tool for artist and album art. So there is a "albumad.gui" and "artistad.gui". Those properties are optional, but if there are empty or the file doesnt exist, related features will be removed in the different panels. After that there are related properties like args, minsize or ouptut(where you can use foobar variables as well as ?? variables).
Finally there is "skin.imgpath". The idea is to have a single variables shared by all panel. So one skin shared by all panels. Makes it easier to switch skin.
All those settings are saved in a INI file. Why? Because i like to save my datas, because it means that you can share a WSH suite config without sharing your all config.Because it means that you can clear properties without actually loosing all your settings. And mostly because other panels need it to read the config!!!
The ini file is saved everytime you modify your properties, yet it s not lost when you clear your properties!
The ini file is in your foobar folder under the name WSH.ini. This is the only hardcoded propertym and there is no other way around.
Still you can change it in scripts\utils.js
When you have set the properties, the manager is up and running.
- How does it work? if playing or pause, the manager will first look at the cache for playing track data (if stopped it will look for selected track data). If found all panels will be notified and so updated with the data.
After 3 seconds of playing the manager will start looking for new data. It will look for biography, Artist mega art, similar artists and thumbnail images for similar(i might add more in the future). Bios and similars will always be grabbed, if they are different from the cache then the cache is updated. For images only missing data is fetched.
After 4 seconds of playing, the manager will look for LOVE and PLAYCOUNT stats from lastfm (thanks to marc2003). The same way, other panels will be notified.
- how do i insert the manager in my config? Just like any other panel, the one thing you need to now is that the only thing drawn in this panel is a button to open properties. It also gives feedback on errors
As you can see images are used. The manager will look for "ok.png" and "error.png" in your skin.imgpath directory. If not found there will be nothing drawn. If found the button will have the size of the image.
By the way i use a different version of "tooltip_buttons.js"(packaged in the release) where the hover image does not need to have the "border", the border is drawn by the object. So only image suffice for a button.
The manager is made so that you dont have to change anything in the script itself, i wont support any modified version of it, just the one i use everyday. Yet i am more than ok to add new features if they look necessary.
- How does the manager notify other panels? That s the magic of WSH panel Mod. TPWang made an amazing work and made things very easy.
The manager sends different signals. A signal is made of a name and value. If you want to catch those notifications in your panel just use the function "on_notify_data(name, info)". Switching the name you can get which notification you are getting. And if the notification comes with a value it s in "option"
Here is the list of notifications that the manager sends"
- name:"config_updated" , "info": path to the inifile(mostly unecessary if you include utils.js)
- name:"lastfm_bio" , "info": the actual biography
- name:"lastfm_similars" , "info": list of similars. (';' separated)
- name:"lastfm_newArtistImage", "info": path to the newly downloaded image
- name:"lastfm_loved", "info": lastfm love and playcount info (';' separated)
The art panel
The art panel is the first of my panel Suite. It s also the most complicated one. It s made to be used in many different configs
All the options are set through properties and contextual menu.
Most of them dont need any explanation. For the others:
- Buttons: THe art panel has the possibility to have buttons. Those buttons will fade in when the mouse enter the panel. Fade even more when the mouse is over them. And fade out when the mouse leave.
BUttons are defined through properties. buttons.show must be set to 1 to show buttons. buttons.list contains the names of the buttons. For each button, a corresponding image must be in your skin.imgpath.
Available buttons are prev(prev.png), playpause(play.png and pause.png), next(next.png), refresh(refresh.png) and download(download.png).
Buttons will appear in the order you enter them (';' separated).
buttons.VA decide of the vertical alignment (0=top, 1=center, 2=bottom). The horizontal alignment is always centered. I dont see the point of left or right. But if requested i can add the option.
- Downloader: As explained in the manager, you can set up an album art downloader and an artist art downloader. This is where you use them! You can use it through double click, contextual menu or button. But those options will only appear if the downloader path is correct! When a download is finished, the panel will refresh itself automatically. Only one instance of the downloader at a time per panel!
- FillImage: I wrote a special algorithm taht i use for artist art panel. It will take your panel rectangle and choose the best according rectangle in the image. That way no ratio, no blank areas. After in the properties you can help the algorithm choose the rectangle by choosing vertical and horizontal alignments.
Note that this panel uses foobar 1.0 artreader. Also the manager will notify it if there is a new image available.
This is a simple panel showing similar artists of the playing or selected song. It waits for notification from the manager for new entries.
There are simple properties for now. I will let you look at them. This panel uses the lastfm.datapath to look for images.
For each artist there are feature on click and right click.
Simple bio panel using the manager, scroll, drag and right click menu.
A very simple panel with one button to love a track. It s based on marc2003 work and has not been updated to the latest version for customdb.
As others there is no lastfm query in there!!! It works with the manager.
That s about everything you need to know. You can easily write you own panels. Please if you want new features in the manager or the existing panels. Ask for it and i ll implement it. I prefer that than seeing too many forks.
Requirements & Package
You need WSH Panel Mod 1.3.0 to run that suite. Everything else is in the package.
Just extract the package in your foobar config.
In the wsh folder you will find the scripts.
In the tools folder, there are everything wget related.
In the scripts folder are common scripts used by all panels.
You will also find in the package a WSHExample.ini. If you want to use it you have to rename it to WSH.ini
I gave a skin example in the folder skin/example with all necessary images.
That s about it. Hope you will all like it. And dont hesitate to ask, i am willing to answer to any question
I will finish with an amazing thanks for TPWang without who none of that would have been possible.
WSHSuite.rar ( 1.26MB ) Number of downloads: 1680
Feb 28 2010, 09:15
Joined: 27-January 05
Member No.: 19379
i assume there will be a WshShell.Run command somewhere that is triggering wget. edit it so there is a 0 as the 2nd parameter like this.
WshShell.Run("some command", 0, true);
that should suppress any popup windows from showing.
|Lo-Fi Version||Time is now: 6th March 2015 - 11:15|