Coder Social home page Coder Social logo

abba23 / beets-popularity Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 3.0 12 KB

Beets plugin to fetch and store popularity values as flexible item attributes

License: MIT License

Python 100.00%
beets plugin python popularity music music-library cli commandline beets-popularity beets-plugin

beets-popularity's Introduction

beets-popularity

Beets plugin to store the popularity values from Deezer as flexible item attributes in the database

Installation

Using pip:

$ pip install beets-popularity

Manually:

$ git clone https://github.com/abba23/beets-popularity.git
$ cd beets-popularity
$ python setup.py install

You can then enable the plugin by adding it to your config.yaml:

plugins: popularity

Usage

$ beet popularity happy
popularity: Bon Jovi - The Circle - Happy Now: 20
popularity: The Doors - Strange Days - Unhappy Girl: 40
popularity: Kygo - Cloud Nine - Happy Birthday: 59

Options

Option Description
-a --album match albums instead of tracks
-n --nowrite print the popularity values without storing them

Import

All imported songs will automatically have a popularity attribute and value assigned to them if the plugin is enabled.

Query

As the popularity of a song is a value between 0 and 100, you could filter your library like this in order to list all tracks that have a popularity of at least 20:

$ beet list -f '$artist - $title ($popularity)' popularity:20..
Bon Jovi - Happy Now (20)
The Doors - Unhappy Girl (40)
Kygo - Happy Birthday (59)

This is especially useful in combination with the Smart Playlist Plugin. Adding this to your configuration would allow you to have continuously updated playlists of the most popular songs in your library:

smartplaylist:
    playlist_dir: ~/Music/Playlists
    playlists:
        - name: popular.m3u
          query: 'popularity:70..'

        - name: popular_rock.m3u
          query: 'popularity:60.. genre:Rock'

beets-popularity's People

Contributors

abba23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

beets-popularity's Issues

unable to execute "beet popularity"

I recently tried to install beets-popularity with the command:
pip3 install beets-popularity
which gave me some "bdist_wheel" errrors, but ran through and and at the end it said:

Successfully installed beets-popularity [...]

I then uninstalled the package and some dependencies with pip-autoremoveautoremove beets-popularity which uninstalled the following:

munkres 1.0.12
jellyfish 0.5.6
PyYAML 3.12
musicbrainzngs 0.6

I then uninstalled all the other dependencies except beets itself

Then I installed the python wheel package with pip3 install wheel which was obviously missing (see bdist_wheel error above)
After that the installation of beets-popularity went through well but I could not execute
beet popularity because it says

error: unknown command 'popularity'

Installing it via the python3 setup.py install command goes through without error too...

What am I doing wrong?

Note: I am a noob about python and pip...

can't find popularity when item is a singleton

When an item is imported as a singleton beets-popularity won't be able to retrieve the popularity because it searches the api also with the album tag. And since the album tag of singletons is null or takes the value from what was it before (for me it's the value "Singles") it won't find anything on Deezer.

Could you please remove the album variable when searching for popularity for a singleton?

Or even better:
you could add a switch (maybe configurable in the beets config.yaml) that decides whether to

  1. always use albums in the request
  2. generally don't use the album tag in the request
  3. only use the album tag in request for non-singletons (tracks with albums)

cannot get this plugin to work

I installed this on a Mint18 box and it will not work. I also tried on a ubuntu server and got the same errors.
beets version 1.4.5
Python version 3.5.2
plugins: acousticbrainz, chroma, convert, discogs, embedart, fetchart, follow, ftintitle, inline, lastgenre, popularity, replaygain, rewrite, scrub

ERROR:
Traceback (most recent call last):
File "/usr/local/bin/beet", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/beets/ui/init.py", line 1256, in main
_raw_main(args)
File "/usr/local/lib/python3.5/dist-packages/beets/ui/init.py", line 1243, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/usr/local/lib/python3.5/dist-packages/beetsplug/popularity.py", line 43, in _command
self._set_popularity(item, opts.nowrite)
File "/usr/local/lib/python3.5/dist-packages/beetsplug/popularity.py", line 62, in _set_popularity
response_json = json.loads(response.content)
File "/usr/lib/python3.5/json/init.py", line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not 'bytes'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.