Commit graph

264 commits

Author SHA1 Message Date
Thomas Scholtes
e96753f96a Plugins use import_task.album 2014-04-25 13:52:03 +02:00
Adrian Sampson
e5a9db1cac fix up some indentation warnings in plugins 2014-04-13 17:55:49 -07:00
Fabrice Laporte
3ead936fe5 flake8 cleaning beetsplug/*
Remaining warnings are related to visual indentation.
2014-04-13 23:24:57 +02:00
Thomas Scholtes
c3ea1ded30 Add item.try_write() to log errors
Many commands and plugins use `item.write()` to update tags. Since the success
of the call is not critical to the functionality of most consumers we want to
catch any exceptions, log an error and continue with our task. The new method
encapsulates this logic.

This fixes #675.
2014-04-10 15:26:05 +02:00
Bruno Tournay
81b74151ca Genre separator from config must be unicode string 2014-03-19 22:16:02 +01:00
Bruno Tournay
618708916b Separator in genre lists can now be configured 2014-03-18 22:03:11 +01:00
Adrian Sampson
3dd9e4622f lastgenre: tolerate el.weight is None 2014-02-11 09:49:15 -08:00
Adrian Sampson
1ad1f7634c py26 compatible format strings (fix #490) 2014-01-09 11:22:49 -08:00
Adrian Sampson
5fb7c424ad use canonical parent, not base tag (#478) 2013-12-18 12:01:55 -08:00
Adrian Sampson
3338ef2ff2 lastgenre: multiple + canonical genres (fix #478) 2013-12-17 17:29:37 -08:00
Adrian Sampson
2d2836825f #416: workaround comment, py26-ify 2013-10-17 12:10:17 -07:00
Peter Schnebel
b1570beba9 Merged the ``multiple` and `max_genres` option into one `count`` option.
Updated debug output to waste less lines.
2013-10-17 09:52:35 +02:00
Peter Schnebel
b2a23a58e2 fixed indentation 2013-10-17 09:30:26 +02:00
Peter Schnebel
0ff15c5c4d The way of the impatient is filled with useless commits :( 2013-10-16 11:35:26 +02:00
Peter Schnebel
fa10515799 Bugfix for Album.get_top_tracks workaround. 2013-10-16 11:31:18 +02:00
Peter Schnebel
d339e2f815 Workaround for pylast issue https://code.google.com/p/pylast/issues/detail?id=85 as suggested by @sampsyo 2013-10-16 08:45:13 +02:00
Peter Schnebel
c5896684f3 The following only applies when ``multiple`` is activated:
Return one valid genre even if its weight is lower then ```min_weight```.
Default for ```min_weight``` is now *10*.
Added new config option ```max_genres``` to limit the amount of genres returned.  Default is *3*.
2013-10-15 13:20:45 +02:00
Peter Schnebel
eafceaa0ed Added min_weight option to lastgenre, to provide for filtering out unpopulare genres. 2013-10-14 12:36:39 +02:00
Adrian Sampson
2aebec0928 #397: shorter option name, docs, changlog
I changed the option name from "multiple_genres" to "multiple".
2013-10-06 10:34:32 -07:00
Adrian Sampson
f35d7fec9c multiple genres (#397): simplify implementation
- don't use vestigial global object for config
- list comprehensions ftw
2013-10-06 10:29:47 -07:00
Ross Ashley
7a7d009671 Removed pdb stuff and cleeaned up description. 2013-10-03 15:15:18 -04:00
Ross Ashley
8525983791 For the comma delimited lastgenre addition, the old way is default.
There is a new option called multiple_genres which defaults to False
but when set to True, the comma delimited list of genres is returned
by lastgenre.

So, if you want a comma delimited list, it is

lastgenre:
    multiple_genres: True
2013-10-03 11:39:33 -04:00
Ross Ashley
7c0d828a2e Replaced unnecessary code with one line. 2013-09-27 10:08:09 -04:00
Ross Ashley
514fa6cf0c Removed some unused and commented out code. 2013-09-26 15:18:58 -04:00
Ross Ashley
4291932298 Added ability to store comma delimited lists of genres using lastfm
and the local genre.txt file in the usual way.

Using this, a song might now have a genre of 'House, IDM, Dance',
instead of just 'House'.
2013-09-26 10:39:32 -04:00
Adrian Sampson
bb21ec692e lastgenre: add album.save() 2013-09-25 08:45:18 -07:00
Adrian Sampson
c7fe017752 remove Library.{move,store} methods
These methods are now provided by LibModel, which makes dealing with items and
albums symmetric.
2013-08-21 15:34:45 -07:00
Adrian Sampson
aaafba4d28 changelog for #254 2013-04-21 20:41:01 -07:00
Fabrice Laporte
0fb877a059 lastgenre: invert 'force' option default value. 2013-04-21 23:34:20 +02:00
Fabrice Laporte
6fdfabe4b7 Revert "lastgenre: force real lookup during import only if no custom whitelist set."
This reverts commit 4be30fca2e.
2013-04-21 10:35:08 +02:00
Fabrice Laporte
4be30fca2e lastgenre: force real lookup during import only if no custom whitelist set. 2013-04-20 14:29:14 +02:00
Adrian Sampson
16e0648c81 lastgenre: fix crash with canonicalization 2013-04-10 10:34:06 -07:00
Adrian Sampson
f7f2454134 docs & style for #92
We already have a nice plurality() function in beets.util to calculate the most
popular value of something, so I reused that.
2013-02-06 10:55:48 -08:00
Peter Schnebel
7193f4e863 Do not write track-level genres if source is not 'track'. 2013-02-06 08:41:20 +01:00
Peter Schnebel
9f1e9031b6 Try to guess 'Various Artists' genre based on track genres if source is 'track'. 2013-02-06 08:15:29 +01:00
Peter Schnebel
d667fca02e Do not write track-level genres if source is not 'track'.
For 'Various Artist' compilations without a usefull 'album' genre, pick the most used track / track-artist genre.
2013-02-06 08:04:58 +01:00
Adrian Sampson
976bc20900 collapse separate album and item paths (#92)
Should reduce copypasta overhead significantly.
2013-02-05 12:16:53 -08:00
Adrian Sampson
3860a5ac27 lastgenre: "auto" config option 2013-02-05 12:02:51 -08:00
Adrian Sampson
e50e28dc38 canonicalize original genre (#92) 2013-02-05 11:58:24 -08:00
Adrian Sampson
d1e752fdeb simplify configuration handling (#92) 2013-02-05 11:51:32 -08:00
Adrian Sampson
f38bed787e remove verbose option (#92)
The lastgenre command should always log what it's doing so the user can see
the progress being made. If you really don't want any output, just pipe to
/dev/null.
2013-02-05 11:40:04 -08:00
Adrian Sampson
1fe36057b0 Python style and legibility cleanup for #92 2013-02-05 11:34:17 -08:00
root
f83e9fb8bb qbugfix 2013-02-05 08:13:36 +01:00
Peter Schnebel
30dff5afff cleaned up, removed debug 2013-02-04 21:47:35 +01:00
Peter Schnebel
4df9521007 experimental track / album / artist based genre stuff per item 2013-02-04 20:24:22 +01:00
Adrian Sampson
0be319767f fixes and refactoring for lastgenre.source (#88)
This provides a default for source, preventing a crash when not present in the
user's config.

It also refactors the source decision to a helper function, _lastfm_obj, to
avoid copypasta.
2013-02-02 12:52:43 -08:00
Peter Fern
ef5dfa3fcf Allow selection of source for genre information (ie - artist vs album)
If config is set to:

   lastgenre:
     source: artist

The genre will be fetched for the artist, rather than the album.  This
allows for filesystem org like:

   genre/artist/album

Currently defaults to previous behaviour for anything other than
`artist`
2013-02-02 14:31:45 +11:00
Adrian Sampson
7a410f636b happy new year
For future reference, this command did the trick:
ack -l 'Copyright 201' | xargs perl -pi -E 's/Copyright 201./Copyright 2013/'
2013-01-11 10:43:41 -08:00
Adrian Sampson
6d68a4855e per-plugin configuration defaults in __init__()
This uses the new BeetsPlugin.config convenience view heavily. Things are
slowly getting less verbose.
2012-12-18 22:35:44 -08:00
Adrian Sampson
3ef9e006f4 finish confit-ifying all the plugins 2012-12-13 17:14:19 -08:00
Jakob Schnitzer
ba140a3f97 Added command to the lastgenre plugin 2012-10-04 10:56:31 +02:00
Fabrice Laporte
49a6b993d3 lastgenre: add existing genre to the list of suggested tags to canonicalize 2012-09-15 12:00:33 +02:00
Adrian Sampson
c5424dce05 lastgenre and lyrics: use new pluggable import stages
This solves a problem where files were copied before the genre field was
updated, resulting in problems when $genre was used in a path (GC-357).
2012-06-08 15:17:49 -07:00
Adrian Sampson
760fff3ace use new "except ... as ...:" syntax
This replaces the older "except ..., ...:" syntax.
2012-05-13 21:18:50 -07:00
Adrian Sampson
f6b37d2c8c remove with_statement __future__ imports
This is the first of several commits that will modernize the beets codebase for
Python 2.6 conventions. (Compatibility with Python 2.5 is hereby abandoned.)
2012-05-13 20:39:07 -07:00
Adrian Sampson
b68e87b92c The Great Trailing Whitespace Purge of 2012
What can I say? I used to use TextMate!
2012-05-13 20:22:17 -07:00
kraymer
c4783e25f8 'Issue 358:Options for when lastgenre fails to find a tag'. Added 'fallback_str' plugin parameter to specify a fallback string when no genre found. Declare the parameter without specifying a value (= empty string) to blank the genre field when no genre found. 2012-05-08 23:41:07 +02:00
Adrian Sampson
a28f930c52 transaction objects to control DB access
In an attempt to finally address the longstanding SQLite locking issues, I'm
introducing a way to explicitly, lexically scope transactions. The Transaction
class is a context manager that always fully fetches after SELECTs and
automatically commits on exit. No direct access to the library is allowed, so
all changes will eventually be committed and all queries will be completed. This
will also provide a debugging mechanism to show where concurrent transactions
are beginning and ending.

To support composition (transaction reentrancy), an internal, per-Library stack
of transactions is maintained. Commits only happen when the outermost
transaction exits. This means that, while it's possible to introduce atomicity
bugs by invoking Library methods outside of a transaction, you can conveniently
call them *without* a currently-active transaction to get a single atomic
action.

Note that this "transaction stack" concepts assumes a single Library object per
thread. Because we need to duplicate Library objects for concurrent access due
to sqlite3 limitation already, this is fine for now. Later, the interface should
provide one transaction stack per thread for shared Library objects.
2012-05-06 23:24:05 -07:00
Adrian Sampson
2d3c9d9f9a suppress more pylast errors (#349) 2012-02-26 17:57:40 -08:00
Adrian Sampson
93678307ef lastgenre now writes tags to files (#279)
This was accomplished by adding a new "config" parameter to the *_imported
events so that the handlers can check whether writing is enabled.
2011-12-20 17:49:11 -08:00
Adrian Sampson
c03fb658c7 clean up genre canonicalization (#264)
- Canonicalization is disabled by default. (This prevents pyyaml from being a
  dependency if you don't use canonicalization.)
- Config value to set the tree file.
- Python style.
- Added YAML file to MANIFEST.in.
- Documentation.
2011-12-01 12:14:11 -08:00
kraymer
9fd10c0186 add genres canonicalization: when a last.fm tag is found but rejected (because not in user whitelist), try to found a
parent tag that is accepted

--HG--
extra : transplant_source : %C6%F2%F9%EDY%C4%1B%FD%BDV/%E5%041I%CB4%00%0A%07
2011-10-11 00:16:57 +02:00
Adrian Sampson
1e88b9ea8d fix storing of genres after item import 2011-10-11 10:20:43 -07:00
Adrian Sampson
b62b462b1e file-based genre whitelist & cleanup
--HG--
rename : beetsplug/lastgenre.py => beetsplug/lastgenre/__init__.py
2011-10-07 12:51:38 -07:00
Renamed from beetsplug/lastgenre.py (Browse further)