Skip to main content

Topic: foo_softplaylists (Read 167192 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • gaurav
  • [*]
foo_softplaylists
Reply #350
Cheers for the great plugin Johan!
I signed up at last.fm just yesterday, and started using your plugin in combination with MonoLite Plus 0.4.3
The softplaylists plugin provided with the skin (dated 2009) was buggy for two reasons:
1. It took a very long time to load when starting Foobar
2. When going to Library->Configure->Tools->Soft Playlists, it took a long time to display that page and to save any alterations.

So I updated the softplaylists to the latest 2011 build. The first issue was gone. The second issue was partly gone, it still takes time to save any changes in soft playlists settings. Moreover, the Love button with the skin no longer is able to Love the tracks, it seems there is some handshake issue with the new version?
The code for the Love button is:
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%skin\mono_lite\scripts\common.js"
// @import "%fb2k_path%skin\mono_lite\scripts\tooltip_buttons.js"
// @import "%fb2k_path%monolite_lastfm_config.js"
// ==/PREPROCESSOR==

var bw = 24;
var bh = 20;
var top_margin = 0;
var left_margin = 0;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var panel_id = window.GetProperty("panel_id", window.id);
var custom_background_file = settings_path + panel_id + "custom_background";
var custom_background = read(custom_background_file);
var username_file = settings_path + "username";
var username = read(username_file);
var api_key_file = settings_path + "api_key";
var api_key = read(api_key_file);

on_item_focus_change();

function on_notify_data(name, data) {
username = read(username_file);
api_key = read(api_key_file);
on_metadb_changed();
}

function update_button(b) {
switch(b) {
case 1:
n = "not_loved.png";
h = "exclamation.png";
tooltip = "Last.fm is disabled, run monolite_lastfm_install.bat to enable it first";
func = null;
break;
case 2:
n = "exclamation.png";
h = "exclamation.png";
tooltip = "Please enter your Last.fm username / api key through context menu";
func = null;
break;
case 3:
n = "love.png";
h = "love.png";
tooltip = "This track is already loved!";
func = null;
break;
case 4:
n = "not_loved.png";
h = "love_h.png";
tooltip = love_command;
func = function() {love_track();}
}
Buttons = {
but: new Button(left_margin,top_margin, bw, bh, {normal: images_path + n, hover: images_path + h}, func, tooltip)
};
window.Repaint();
}

function on_metadb_changed() {
if(!g_metadb) return;
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);
track = fb.TitleFormat("%title%").EvalWithMetadb(g_metadb);
love_command = "Last.fm Love '" + track + "' by '"+ artist + "'";
old_userloved = fb.TitleFormat("%LASTFM_LOVED_DB%").EvalWithMetadb(g_metadb)  == 1 ? 1 : 0;
switch(true) {
case (is_lastfm.length == 0):
update_button(1);
break;
case (username.length == 0):
case (api_key.length != 32):
update_button(2);
break;
default:
(old_userloved == 1) ? update_button(3) : update_button(4);
}
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_playback_time(time) {
if(time == 3) sync();
}

function love_track() {
fb.RunContextCommandWithMetadb(love_command, g_metadb);
sync();
}

function sync() {
if(username.length == 0 || api_key.length != 32) return(fb.trace("Playcount sync: Can't contact Last.fm. Check your username / API KEY settings."));
fb.trace("Playcount sync: Contacting Last.fm....");
lastfm("&method=track.getinfo&artist=" + encodeURIComponent(artist) + "&track=" + encodeURIComponent(track), "foo_playcount_sync", function() {process();});
}

function process() {
fb.trace("Playcount sync: Last.fm responded \"" + xmlhttp.statustext + "\"");
xmlDoc = xmlhttp.responseXML;
try { userplaycount = xmlDoc.getElementsByTagName("userplaycount")[0].childNodes[0].nodeValue; } catch(e) { userplaycount = 0;}
try { userloved = xmlDoc.getElementsByTagName("userloved")[0].childNodes[0].nodeValue; } catch(e) { userloved = 0; }
userloved == 1 ? update_button(2) : update_button(3);
fb.RunContextCommandWithMetadb("Customdb Love " + userloved, g_metadb);
fb.RunContextCommandWithMetadb("CustomdbU " + (userplaycount > 0 ? userplaycount.substring(userplaycount.length - 1) : "Erase"), g_metadb);
fb.RunContextCommandWithMetadb("CustomdbT " + (userplaycount > 9 ? userplaycount.substring(userplaycount.length - 2, userplaycount.length -1) : "Erase"), g_metadb);
fb.RunContextCommandWithMetadb("CustomdbH " + (userplaycount > 99 ? userplaycount.substring(userplaycount.length - 3, userplaycount.length - 2) : "Erase"), g_metadb);
fb.RunContextCommandWithMetadb("CustomdbTH " + (userplaycount> 999 ? userplaycount.substring(userplaycount.length - 4, userplaycount.length - 3) : "Erase"), g_metadb);
}

function on_size() {
ww = window.Width;
wh = window.Height;
}

function on_mouse_rbtn_up(x, y) {
var _menu = window.CreatePopupMenu();
var _child = window.CreatePopupMenu();
var idx;
_child.AppendMenuItem(MF_STRING, 101, "None");
_child.AppendMenuItem(MF_STRING, 102, (dui ? "Default UI " : "Columns UI ") + "default");
_child.AppendMenuItem(MF_STRING, 103, "Splitter");
_child.AppendMenuItem(MF_STRING, 104, "Custom ");
_child.AppendMenuItem(MF_SEPARATOR, 0, 0);
_child.AppendMenuItem(window.GetProperty("mode") == 104 ? MF_STRING : MF_GRAYED, 105, "Set custom colour...");
_child.CheckMenuRadioItem(101, 104, window.GetProperty("mode", 101));
_menu.AppendMenuItem(username.length > 0 ? MF_STRING : MF_GRAYED, 1, "Visit your Last.fm user profile page");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(is_lastfm.length > 0 ? MF_STRING : MF_GRAYED, 2, "Set your Last.fm username...");
_menu.AppendMenuItem(is_lastfm.length > 0 ? MF_STRING : MF_GRAYED, 3, "Set your API KEY...");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _child.ID, "Background");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
//_menu.AppendMenuItem(MF_STRING, 9, "Properties");
_menu.AppendMenuItem(MF_STRING, 10, "Configure...");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
case 1:
WshShell.run("http://www.last.fm/user/" + encodeURIComponent(username));
break;
case 2:
username = text_input_box("Playcount Sync", "Please enter your Last.fm username", username_file);
on_metadb_changed();
window.NotifyOthers("update", 1);
break;
case 3:
api_key = text_input_box("Playcount Sync", "Please enter your Last.fm API KEY\n\nhttp://www.last.fm/api/account", api_key_file);
on_metadb_changed();
window.NotifyOthers("update", 1);
break;
case 101:
case 102:
case 103:
case 104:
window.SetProperty("mode", idx);
window.Repaint();
break;
case 105:
custom_background = text_input_box("Playcount Sync", "Enter a custom colour for the background. Uses RGB. Example usage:\n\n234-211-74", custom_background_file);
window.Repaint();
break;
case 9:
window.ShowProperties();
break;
case 10:
window.ShowConfigure();
break;
}
_menu.Dispose();
_child.Dispose()
return true;
}

function on_paint(gr) {
switch(window.GetProperty("mode", 102)) {
case 101:
col = null;
break;
case 102:
col = g_backcolor;
break;
case 103:
col = utils.GetSysColor(4);
break;
case 104:
temp_col = custom_background.split("-");
col = RGB(temp_col[0], temp_col[1], temp_col[2]);
break;
}
if(col) gr.FillSolidRect(0, 0, ww, wh, col);
buttonsDraw(gr);
}


I'm a complete newbie at foobar related programming, and was trying to go over the code for hours last night, but to no avail. The Console gives the following when trying to love a track:
Quote
Playcount sync: Contacting Last.fm....
Playcount sync: Last.fm responded "OK"

Can you tell what's wrong?
  • Last Edit: 14 March, 2011, 07:33:56 AM by gaurav

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #351
this thread isn't the place to talk about a 3rd party script that just happens to use foo_softplaylists. it has nothing to do with this component's author at all.

however, the latest version of the script can be found here: http://cid-649d3bfeaf541fbb.skydrive.live....ount%20sync.zip
read the instructions carefully. discussion goes here: http://www.hydrogenaudio.org/forums/index....showtopic=76772

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #352
Cheers for the great plugin Johan!

Thanks!
2. When going to Library->Configure->Tools->Soft Playlists, it took a long time to display that page and to save any alterations.
It fetches top tags and your personal playlist list from last.fm.
foo_softplaylists: http://tiny.cc/kh9m9

  • gaurav
  • [*]
foo_softplaylists
Reply #353
however, the latest version of the script can be found here: http://cid-649d3bfeaf541fbb.skydrive.live....ount%20sync.zip
read the instructions carefully. discussion goes here: http://www.hydrogenaudio.org/forums/index....showtopic=76772

I'll go over the revised code. I had seen it before but mistook it for a component rather than a script.

It fetches top tags and your personal playlist list from last.fm.

Ah, makes sense.

  • carmenm
  • [*][*][*][*][*]
foo_softplaylists
Reply #354
I must i now find this plugin really essential!
At first i though why would i need to make a local playlist of my lastfm library... and the i started to use the Loved Tracks playlist. With it i can easily make playlist of my loved tracks and then push that playlist (with the files i mean)  on my iPhone. It makes the best playlist ever when driving!

Know there is one thing i miss which is a way of filtering in that playlist. For example i see that loved tracks are sorted by love date which is GREAT. What i think would be awesome is to have a way when opening that playlist to choose the number of item we want in the playlist. It would allow to have the 40 or 50 last loved tracks.

Another way to do that (the most awesome way!) would be to have a custom tag in those playlist with love date (like done on lastfm radio playlists). That would create an infinity of possibilities. That way i could create filters like loved tracks of 2009 or last 50 loved tracks.
Is that somehting doable?

Thanks

  • .misiek
  • [*]
foo_softplaylists
Reply #355
First of all it is a brilliant plugin, but i've noticed that when i'm listening streaming radio from internet plugin reports:
Quote
foo_softplaylists: failed to love track: title and/or artist tag not present
, although title and artist is visible in foobar on both playlist and item details info, and plugin foo_audioscrobbler reports:
Quote
Audioscrobbler: Submitting track...
Audioscrobbler: Submission succeeded.
.
I suspect, that plugin takes title and artist directly from file tag instead of variables %title% and %artist%. Is that correct?
my english sucks ... forgive me :/

foo_softplaylists
Reply #356
Just signed in to say thank you! This plugin was all I was missing at foobar2000. Can't see why I haven't seen this all the times. Thanks!

I just have a tiny question though. Not a big issue for me, so you can think this as a tiny suggestion. Sometimes the playlist adds same artist's (even same album's) tracks repedately. Is this normal ? After getting the queue, can the playlist be auto-shuffled and then generated?

Thanks again.

  • JJForums
  • [*][*]
foo_softplaylists
Reply #357
it's possible to create a link to the feature "love track", by clicking in something in the playlist, just to fast love the track and click again to unlove?

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #358
add buttons to an existing toolbar (right click>customise). you'll probably need to find your own image resources though. or you could create keyboard shortcuts instead (file>preferences>keyboard shortcuts)

  • JJForums
  • [*][*]
foo_softplaylists
Reply #359
not to toolbar, but to playlist, like creating rating for music... did you get it?

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #360
nope, that isn't possible.

  • JJForums
  • [*][*]
foo_softplaylists
Reply #361
so, isn't there a way to check if I marked a track with "love track"? and what happens if I forget that I already marked that track and mark it again as loved track?

  • Joffi
  • [*]
foo_softplaylists
Reply #362
so, isn't there a way to check if I marked a track with "love track"? and what happens if I forget that I already marked that track and mark it again as loved track?

http://www.hydrogenaudio.org/forums/index....showtopic=76772 might have what you want

but it doesn't matter if you relove a track; it doesn't affect your last.fm account
  • Last Edit: 28 April, 2011, 04:38:48 PM by Joffi

  • romor
  • [*][*][*][*][*]
foo_softplaylists
Reply #363
I got playlist stream in XSPF format, but foobar (Ctrl U) could not handle it. Searched for component and there are perhaps two available - foo_xspf which is outdated and can't be loaded and this one.

So after installing this component I expected that foobar could recognize XSPF stream (it's just like any other playlist only in XML format), but it couldn't unfortunately - it seems that this component can only load XSPF playlist from disk, and does not provide handle to foobar. Or am I wrong?

  • slyman
  • [*]
foo_softplaylists
Reply #364
First of all it is a brilliant plugin, but i've noticed that when i'm listening streaming radio from internet plugin reports:
Quote
foo_softplaylists: failed to love track: title and/or artist tag not present
, although title and artist is visible in foobar on both playlist and item details info, and plugin foo_audioscrobbler reports:
Quote
Audioscrobbler: Submitting track...
Audioscrobbler: Submission succeeded.
.
I suspect, that plugin takes title and artist directly from file tag instead of variables %title% and %artist%. Is that correct?

im having the same problem did you ever figure this out?

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #365
So after installing this component I expected that foobar could recognize XSPF stream (it's just like any other playlist only in XML format), but it couldn't unfortunately - it seems that this component can only load XSPF playlist from disk, and does not provide handle to foobar. Or am I wrong?


Indeed foo_xspf is made for playlists that reference to the location of a music file.

This plugin is made for playlists that only reference the tag data like which artist, which track, which album.
If you load such a playlist it will match the tags with your local library and make a playlist with all the tracks it could match.
It can also save a playlist to such a XSPF file.
This can be very handy if you want use the playlist on another computer with all your music but in different paths.
Is also very handy if you play your music from your ipod in disk mode from within foobar and want to use the same playlists that you use elsewhere.
foo_softplaylists: http://tiny.cc/kh9m9

  • romor
  • [*][*][*][*][*]
foo_softplaylists
Reply #366
Johan, I knew about some nifty features like matching XSPF contents with local library which can have many interesting scenarios and that's great

I found updated version of foo_xspf for foobar2000 v1.0 (hidden at the bottom of author's blog) and while it adds support for this playlists it can't parse some, resulting only in partial playlist contents

I don't know how popular XSPF format is, but I parsed XSPF with sed (extracting only links) to M3U and for some I liked I embedded playlist in one of available Flash XSPF players (like http://www.xspf-player.com)

  • BASGTA
  • [*]
foo_softplaylists
Reply #367
How do you set up the Media Library?  I have mine set to view G:\Music but it doesn't see anything.  Does the Media Library not look into subfolders?

  • the
  • [*]
foo_softplaylists
Reply #368
@JohanDeBock: Is it maybe possible to get the feature to save and load xspf playlists in an own component? I like to keep my foobar menu simple and unfortunately the foo_xspf component seems not to work correctly as romor states.

  • squrl
  • [*]
foo_softplaylists
Reply #369
Hi there,

I am using this awesome foobar2000 skin, it has a little "heart" icon which, when clicked, sets the rating of currently played song to five * (stars). When clicked again, it resets the rating back to 0 *. Using foo_softplaylists, I'd like to turn this into Last.fm Love/Unlove button, but I have no experince in scripting, is there someone kind a patient enough, who would care to help me out, or at least point me in the right direction??

The rating script looks like this:
Code: [Select]
var Path =  fb.FoobarPath+"skins\\Metro\\";
var BgImage = gdi.Image(Path + "heart_empty.png");
var HeartImage = gdi.Image(Path + "heart.png");
var Rating = fb.TitleFormat("%rating%").eval();

function UpdateRating(rate){
    fb.RunContextCommand("Rating/" + rate);
    var new_rate = fb.TitleFormat("%rating%").eval();
    if(new_rate == "?"){
        var meta = fb.GetNowPlaying();
        meta.UpdateFileInfoSimple("RATING",rate);
    }
    Rating = rate;
}

function ClearRating(){
    fb.RunContextCommand("Rating/<not set>");
    var meta = fb.GetNowPlaying();
    meta.UpdateFileInfoSimple("RATING","");
    Rating = 0;
}

function on_paint(gr){
    var g_bgcolor = window.GetColorCUI(3);
    gr.FillSolidRect(0, 0, window.Width, window.Height, g_bgcolor);
    if(Rating == 5){
        gr.DrawImage(HeartImage, 0, 0, 15, 13, 0, 0, 15, 13 , 0);}
    else{
        gr.DrawImage(BgImage, 0, 0, 15, 13, 0, 0, 15, 13 , 0);
    }
}

function on_mouse_lbtn_down(x, y) {
    if(!fb.IsPlaying){return}
    if(Rating == 5){ClearRating()}else{UpdateRating(5)}
    window.Repaint();
}

function on_playback_new_track(info){
    Rating = fb.TitleFormat("%rating%").eval();
    window.Repaint();
}

function on_metadb_changed(metadb, fromhook) {
    Rating = fb.TitleFormat("%rating%").eval();
    window.Repaint();
}

function on_colors_changed() {
    window.Repaint();  
}

Shouldn't be hard to modify, should it?

Any help is very much appreciated. Thanks in advance, squrl.

foo_softplaylists
Reply #370
Hi! I have a feature request: could you add the ability to change the tag fields for sending track information to the last.fm DB?
For example: I want to replace %artist% with %composer%.
Please!
  • Last Edit: 09 July, 2011, 07:18:14 AM by Steve Forte Rio

  • jayg30
  • [*]
foo_softplaylists
Reply #371
Hello,

I've never seemed to be able to use this plugin for what I want, love/ban tracks. It will create playlists from the top/loved/recent tracks tho. No matter what I try it just won't work for love/unlove/ban/unban.

Here is the console error;
Quote
foo_softplaylists: feed downloading: error
foo_softplaylists: failed to love track: authentication failed: empty reply
foo_softplaylists: failed to love track 'Good Directions' by 'Billy Currington'


Again this is what I get regardless of what track I try.
Yes, I have provided my username and password in the softplaylist menu and I'm very confident it is correct.
They are the same that I provide for foo_audioscrobbler and foo_lastfm_radio which both work perfectly.
No, I do not use any buttons, just access it through the context menu.
I even installed a brand new portable installation with no other components and it still fails.
I've tried with all different file types (flac, ogg, mp3) but that doesn't make a difference.

I'd really like to have this feature working, could someone please help me.

  • maXelo
  • [*]
foo_softplaylists
Reply #372
I love this plugin, but I've been wondering if it is possible to exclude "EP"s (Extended Play) versions of songs? on the playlists. I know that one can choose oldest or latest tracks, but it will be great to avoid certain types of songs.

  • tg2k3
  • [*]
foo_softplaylists
Reply #373
hey, awesome component!!

does your component or the xspf format in general have a way of dealing with matching tags that are only partially identical? i have a way of creating xspf playlists from public databases. often however my files are tagged slightly differently, e.g. mentioning some extra information or a little less in comparison to the xspf file. right now, i need to manually edit the xspf file which kind of defeats the whole purpose of it.

thanks a lot for your time!

  • hymerman
  • [*][*]
foo_softplaylists
Reply #374
Do you think you could make the source to this available, Johan? I'd like to play around with how it chooses tracks from my library (specifically, prefer original releases rather than live/ep/compilations, and use original date rather than release date). I know it's probably annoying to have all these feature requests; open sourcing it and letting people do it themselves will help