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:
foo_customdb
Python 2.7
pip
beets
Instructions:
- Download foo_customdb from here (https://hydrogenaud.io/index.php/topic,109065.0.html) or from the attached file below.
- Install like normal.
- NOTE: If you had installed marc2003's software, you can skip this next step.
- Within fb2k, open the Custom DB Preferences page. Within "Fields", click Add, and then write within both Display and Name: "LASTFM_PLAYCOUNT_DB". Select "Custom" for Key and write within, "$crc32($lower(%artist%%title%))".
- Make note of the path to the database on the Database page. Mine is, "C:\Users\Noah\AppData\Roaming\foobar2000\customdb_sqlite.db"
- Go to the Python downloads page (https://www.python.org/downloads/) and follow the instructions on install the latest version of Python 2.7 (2.7.11 currently)
- NOTE: On the "Customize Python 2.7" dialog, make sure you select "Add python.exe to Path"
- Verify pip in installed: open a cmd or powershell window and type, "pip -V"
- If it returns an error such as, "The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program.", you have messed up. Go here (https://pip.pypa.io/en/stable/installing/) and follow the instructions on that page to install it.
- Otherwise, it should spit out, "pip 7.1.2 from c:\python27\lib\site-packages (python 2.7)" which means it's correctly installed.
- With pip installed, type into a command prompt (cmd.exe or powershell), "pip install --upgrade beets". This will install and upgrade all necessary components needed to run beets and then install beets.
- Once beets is installed, type into a command prompt, "beet config -e". This will open a text editor. Write (filling in the gaps with your own information):
plugins: lastexport
lastfm:
user: [your last.fm username here]
sqlite3_custom_db: [the noted location of your foo_customdb database as above]
- Save and exit that file.
- Now that beets is configured, download/save this file (https://raw.githubusercontent.com/NoahTheDuke/lastexport/master/lastexport.py) as "lastexport.py" in your beetsplug folder, which should be somewhere near "C:\Python27\Lib\site-packages\beets". That folder should contain a slew of wonderful plugins, and this one will fit right in.
- Finally, after all that prep is done, type into a command prompt, "beet lastexport". It should quickly download and update all of your playcounts. This is what you'll be typing every time you want to update your playcounts.
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.)
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'
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.
thank you very much ! it works
Thanks! I had been waiting for something like this to come around.
This is working great! I wonder if it can be customised to get more data from last.fm, like last played time?
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?
You can edit the config file manually.
http://beets.readthedocs.io/en/v1.4.1/reference/config.html
You can edit the config file manually.
http://beets.readthedocs.io/en/v1.4.1/reference/config.html
That worked, thanks!
(Bumping old post.)
I just wanted to say thanks. Just tried the tool--worked great!
Getting this error with latest Python (3.5)
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?
Getting this error with latest Python (3.5)
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
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.
Thank you a lot for this! It works as it states. The one thing I'm missing is a bit more precession, when matching, specifically in that album's aren't considered, so the same song on multiple albums, by the same artist, will all share the same playcount info.
Thank you a lot for this! It works as it states. The one thing I'm missing is a bit more precession, when matching, specifically in that album's aren't considered, so the same song on multiple albums, by the same artist, will all share the same playcount info.
You might want to look at foo_enhanced_playcount (https://hydrogenaud.io/index.php/topic,115227.0.html). Might do what you need, and does consider albums.