Hydrogenaudio Forums

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: NoahTheDuke on 2016-05-12 06:24:19

Title: Last.fm Playcount Sync through Python and foo_customdb
Post by: NoahTheDuke on 2016-05-12 06:24:19
After the demise of the previous attempt, I've devised a new method for tracking plays in Foobar. It's complicated to set up, but works flawlessly afterwards. It's built on the foundations marc2003 created (https://hydrogenaud.io/index.php/topic,76772.0.html), using beets (http://beets.io/) and foo_customdb to display the play counts.

Requirements:

Instructions:
Code: [Select]
plugins: lastexport
lastfm:
    user: [your last.fm username here]
    sqlite3_custom_db: [the noted location of your foo_customdb database as above]

Kind of complicated, I know, but a breeze once you get used to it. beets is magical and what I use to track and update all of the metadata info on my files behind foobar. Foobar is a near perfect player and interface for me, but it's not a great organizer, so I highly suggest beets if you feel frustrated by foobar's lackluster organizational support.

Please let me know if you have any questions or comments or pull requests! I'm very interested in making this better. (I'd honestly like to decouple it from beets, but beets is kind of magic, so I don't mind too much.)
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: aloola on 2016-05-20 09:35:46
I got this error :(

C:\WINDOWS\system32>beet lastexport
** error loading plugin lastexport:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\beets\plugins.py", line 255, in load_plugins
    namespace = __import__(modname, None, None)
  File "c:\python27\lib\site-packages\beetsplug\lastexport.py", line 18, in <module>
    import pylast
ImportError: No module named pylast

error: unknown command 'lastexport'
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: NoahTheDuke on 2016-05-20 16:13:05
Oh crap! Okay, good to know. I forgot that beets requires pylast when touching Last.fm.

On the blank command line, type "pip install pylast". Close the window, and then reopen it and try "beet lastexport" again.
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: aloola on 2016-05-20 18:46:51
thank you very much ! it works
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: audiophool on 2016-05-22 05:20:57
Thanks! I had been waiting for something like this to come around.
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: elenhil on 2016-09-09 11:37:21
This is working great! I wonder if it can be customised to get more data from last.fm, like last played time?
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: vonBernburg on 2016-12-11 17:11:11
Thank you! I'm very excited about this!

I'm stuck at "beet config -e" though.
It keeps saying 'failed to create process'
What coud be the problem?
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: zeremy on 2016-12-11 19:17:24
You can edit the config file manually.

http://beets.readthedocs.io/en/v1.4.1/reference/config.html

Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: vonBernburg on 2016-12-12 16:18:40
You can edit the config file manually.

http://beets.readthedocs.io/en/v1.4.1/reference/config.html



That worked, thanks!
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: audiophool on 2017-08-05 17:27:41
(Bumping old post.)

I just wanted to say thanks. Just tried the tool--worked great!
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: tanjidoor on 2017-08-08 15:08:40
Getting this error with latest Python (3.5)
Code: [Select]
Traceback (most recent call last):
  File "C:\Users\SKP\AppData\Local\Programs\Python\Python35\Scripts\beet-script.
py", line 11, in <module>
    load_entry_point('beets==1.4.5', 'console_scripts', 'beet')()
  File "c:\users\skp\appdata\local\programs\python\python35\lib\site-packages\be
ets\ui\__init__.py", line 1256, in main
    _raw_main(args)
  File "c:\users\skp\appdata\local\programs\python\python35\lib\site-packages\be
ets\ui\__init__.py", line 1243, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "c:\users\skp\appdata\local\programs\python\python35\lib\site-packages\be
etsplug\lastexport.py", line 50, in func
    import_lastfm(lib, self._log)
  File "c:\users\skp\appdata\local\programs\python\python35\lib\site-packages\be
etsplug\lastexport.py", line 114, in import_lastfm
    user = config['lastfm']['user'].get(unicode)
NameError: name 'unicode' is not defined

Do I need to use Python 2.7 instead?
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: zeremy on 2017-08-09 12:42:42

Getting this error with latest Python (3.5)
Code: [Select]
Traceback (most recent call last):
  File "C:\Users\SKP\AppData\Local\Programs\Python\Python35\Scripts\beet-script.
py", line 11, in <module>
    load_entry_point('beets==1.4.5', 'console_scripts', 'beet')()
  File "c:\users\skp\appdata\local\programs\python\python35\lib\site-packages\be
ets\ui\__init__.py", line 1256, in main
    _raw_main(args)
  File "c:\users\skp\appdata\local\programs\python\python35\lib\site-packages\be
ets\ui\__init__.py", line 1243, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "c:\users\skp\appdata\local\programs\python\python35\lib\site-packages\be
etsplug\lastexport.py", line 50, in func
    import_lastfm(lib, self._log)
  File "c:\users\skp\appdata\local\programs\python\python35\lib\site-packages\be
etsplug\lastexport.py", line 114, in import_lastfm
    user = config['lastfm']['user'].get(unicode)
NameError: name 'unicode' is not defined

Do I need to use Python 2.7 instead?

The docs recommend Python 3.6 for the latest version 1.4.5.
http://beets.readthedocs.io/en/v1.4.5/guides/main.html#installing-on-windows
Title: Re: Last.fm Playcount Sync through Python and foo_customdb
Post by: wdekler on 2017-08-19 14:52:21
Thanks for the package!

I also had some problems with the beet config -e command and in the end I just edited the config.yaml file in the beets folder. Also the plugin wasn't recognised by beets until I moved it to the beetsplug folder instead of the beets folder.
SimplePortal 1.0.0 RC1 © 2008-2018