gmusicbrowser Forum

Main board => Customization => Topic started by: laite on March 17, 2011, 06:59:32

Title: Small script for importing last.fm playcounts (lastfm_laite)
Post by: laite on March 17, 2011, 06:59:32
EDIT: This script is deprecated, due to my plugin 'lastfm_pcGet'.

Topic here: http://forum.gmusicbrowser.org/index.php?topic=419.0 (http://forum.gmusicbrowser.org/index.php?topic=419.0)
Title: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: mgrubert on March 18, 2011, 19:27:55
I don't understand in wich folder I must extract your files.
I try in .config/gmusicbrowser but the plugin doesn't appear in gmb\plugin choices.
Could you help me ?

An old foobar2000 user.
Title: Re: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: laite on March 19, 2011, 09:58:23
Quote from: mgrubert on March 18, 2011, 19:27:55
I don't understand in wich folder I must extract your files.
I try in .config/gmusicbrowser but the plugin doesn't appear in gmb\plugin choices.
Could you help me ?

Sure. This is not 'plugin' as such, merely a small script, so it doesn't matter where you extract it. It uses existing plugin called "Now Playing" to get data from gmb (I tried to make instructions above a bit clearer, hope you get it working).
Title: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: mgrubert on March 19, 2011, 22:19:53
OK, thx, I will try it now !

Edit : no effect (no sync) !
Title: Re: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: laite on March 20, 2011, 05:25:47
Quote from: mgrubert on March 19, 2011, 22:19:53
Edit : no effect (no sync) !

Hm. Try running script manually from terminal:
1) make sure gmb is running
2) find some song you are certain has playcount at last.fm
3) find songs filepath (from right clicking track -> "song properties", it should show at top of the edit dialog)
4) open terminal and go to directory where you extracted script
5) run script with command:  python lastfm_laite.py "artist" "tracks title" "filepath"
(of course, you have to change these according to your selected track, make sure the spelling is correct)

It should look something like the screenshot attached. If not, please post everything script prints to terminal (or take a screenshot).
Title: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: mgrubert on March 20, 2011, 20:12:37
It's ok :
python lastfm_laite.py "Broken Bells" "The High Road" "/home/majorgrubert/Musique/B/Broken Bells/2010 - Broken Bells/01 - The High Road.mp3"
Sending 94 to perl ->
//home/majorgrubert/Musique/B/Broken Bells/2010 - Broken Bells/01 - The High Road.mp3
Playcount before: 29
? 1

And the new playcount is now 94  8)
But in GMB, it doesn't rule.

Perhaps a mistake here (I try with /home/ instead of ~/ with no effect) ?
(http://perpendiculaires.free.fr/documents/Lastfm_laite.png)
Title: Re: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: laite on March 21, 2011, 05:33:40
Quote from: mgrubert on March 20, 2011, 20:12:37
Perhaps a mistake here (I try with /home/ instead of ~/ with no effect) ?

Yes, you need to add word 'python' before the path, so the whole line is formatted (without quotation marks): "python /home/USERNAME/.config/gmusicbrowser/lastfm_laite/lastfm_laite.py %a %t %f".

Also, I think you need to give the full path with /home/USERNAME etc. , not with ~.
Title: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: mgrubert on March 21, 2011, 06:29:01
Yeah ! It rocks ! Thx !
May be you know too how to make lastfm2gmb works ?
When I try "lastfm2gmb.pl -u mgrubert" or "lastfm2gmb -u mgrubert" (in my favorite directory, with gmb loaded) or "python lastfm2gmb.pl -u mgrubert" : look :


majorgrubert@GrosPC:~/Bureau/Lien vers gmusicbrowser/bor-lastfm2gmb-b06d676/bin$ lastfm2gmb -u mgrubert
lastfm2gmb : commande introuvable
majorgrubert@GrosPC:~/Bureau/Lien vers gmusicbrowser/bor-lastfm2gmb-b06d676/bin$ lastfm2gmb.pl -u mgrubert
lastfm2gmb.pl : commande introuvable
majorgrubert@GrosPC:~/Bureau/Lien vers gmusicbrowser/bor-lastfm2gmb-b06d676/bin$ python lastfm2gmb.pl -u mgrubert
  File "lastfm2gmb.pl", line 10
    use strict;
             ^
SyntaxError: invalid syntax
Title: Re: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: laite on March 21, 2011, 06:30:23
Quote from: mgrubert on March 21, 2011, 06:29:01
Yeah ! It rocks ! Thx !
May be you know too how to make lastfm2gmb works ?
When I try "lastfm2gmb.pl -u mgrubert" or "lastfm2gmb -u mgrubert" (in my favorite directory, with gmb loaded) or "python lastfm2gmb.pl -u mgrubert" : look :

It's witten in Perl instead of python (two different programming languages), so perhaps you should try: "perl lastfm2gmb.pl -u mgrubert"
Title: Re : Small script for importing last.fm playcounts (lastfm_laite)
Post by: mgrubert on March 21, 2011, 06:34:48
You are the king !

Thx a lot !