Commit graph

83 commits

Author SHA1 Message Date
Thomas Scholtes
b8687999e2 Query string for computed fields. Fixes #693 2014-04-16 14:18:07 +02:00
Thomas Scholtes
4e2828668c Refactor mbsync 2014-04-16 14:02:51 +02:00
Adrian Sampson
fb37be44db restore some comments from #684
I wanted to leave a few of these as comments -- they serve more as separators
than as internal documentation.
2014-04-13 17:43:43 -07:00
Fabrice Laporte
3ead936fe5 flake8 cleaning beetsplug/*
Remaining warnings are related to visual indentation.
2014-04-13 23:24:57 +02:00
Adrian Sampson
2ec140edbc fix import path to BooleanQuery (#680) 2014-04-12 13:48:37 -07:00
Kyle Konrad
d044e1773a Replace SingletonQuery with BooleanQuery on computed singleton field.
Updated use in command parsing and mbsync plugin.
2014-04-11 22:20:04 -07:00
Adrian Sampson
271a1627a5 mbsync: call album.save()
This must have been broken as long as album.save() was a necessary call (i.e.,
since the introduction of the dbcore base classes).
2014-04-11 19:50:13 -07:00
Adrian Sampson
4c9daa12cc Merge pull request #676 from geigerzaehler/item-try-write
Add item.try_write() to log errors
2014-04-10 11:33:06 -07:00
Thomas Scholtes
5d753b4f38 Remove ALBUM_* constants. Closes #650 2014-04-10 17:44:39 +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
Adrian Sampson
1253cb695d move show_model_changes to ui package
This makes it more naturally reusable for plugins.
2014-02-22 15:06:16 -08:00
Adrian Sampson
58dd5f47f5 use _show_model_changes in mbsync 2014-02-22 14:37:04 -08:00
Adrian Sampson
22d5e564c6 move move method to model objects 2013-09-16 22:12:26 -07:00
Adrian Sampson
4ee4169349 simplify get_query using class attributes 2013-09-09 20:20:22 -07:00
Adrian Sampson
d80576fec1 get rid of dictionary comprehensions
for Python 2.6 compatibility
2013-08-29 17:07:04 -07:00
Adrian Sampson
343a85d482 mbsync: use separate structure for old_data
Assigning an attribute on Items doesn't really work here since we try to store
that value to the DB as a flexattr.
2013-08-23 14:01:31 -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
6677cea036 fix uses of item.dirty and item.record 2013-08-21 10:57:52 -07:00
Adrian Sampson
4624f65ce3 fix interface to ID matching
As outlined in #299, we broke many places in the code that were expecting
_album_for_id and _track_for_id to return a single item rather than a list. I
took this opportunity to divide up the interface: there's now one function for
MBIDs (returning a single object or None) and one for generic IDs (returning a
list).
2013-06-01 17:22:39 -07:00
Tai Lee
ee0c00708b Quick fix for a couple other places that were expecting hooks._album_for_id()` to return a single result.
It's possible that these plugins might require a little more thought
into how they should work (or not work) with potentially multiple albums
matching an idea, and potentially those those albums being an incorrect
match (e.g. if two data source plugins share a simple numerical ID
format).
2013-05-31 00:05:24 +10:00
Lucas Duailibe
51ed0939d6 fixing things 2013-03-25 15:20:38 -03:00
Lucas Duailibe
c682ac84b0 one more error message (#125) 2013-03-25 11:45:11 -03:00
Lucas Duailibe
7b2ff4ae9b fix mbsync bug
This fixes a bug that only applied changes to the first item of an album
2013-03-17 02:50:32 -03:00
Adrian Sampson
1a7ec6dc79 mbsync: fix redundant album art movement
Since we explicitly move album art later in the process, implicitly moving it
with items can cause a double-move (and thus a "file not found" error).
2013-03-03 17:46:16 -08:00
Adrian Sampson
18688008a4 mbsync: avoid spurious stores/moves
As _print_and_apply_changes itself does for items, we now shortcut
modifications (metadata and filesystem) for albums when no changes are
required for a given album. This avoids effectively doing a "beet move" on an
album even when nothing has changed.
2013-03-03 17:19:05 -08:00
Adrian Sampson
5f68d03793 mbsync: don't write tags if import.write is off
This will avoid surprising users with import.write turned off.
2013-03-03 17:13:54 -08:00
Adrian Sampson
72263a1cf7 mbsync: use ID lookups instead of full match logic
This change uses _album_for_id and _track_for_id instead of the full
autotag.match.* functions. This should be faster (requiring fewer calls to the
MusicBrainz API) while also being more predictable. It also won't, for
example, use acoustic fingerprinting even if the chroma plugin is installed.

Finally, this change catches the error case in which MBIDs are erroneous. This
can happen, for example, if the user has some track MBIDs left over from
before the NGS transition.
2013-03-03 17:08:07 -08:00
Adrian Sampson
a8d999a101 mbsync: split album/item functions; shorter txns
The main change here is to use shorter transactions -- one per matching entity
-- rather than one large one. This avoids very long transactions when the
network happens to move slowly.
2013-03-03 16:52:14 -08:00
Adrian Sampson
54e070d06b mbsync: use SingletonQuery for item updates 2013-03-03 16:29:31 -08:00
Jakob Schnitzer
d647ea0f0d mbsync: a little refactoring 2013-03-03 23:39:14 +01:00
Jakob Schnitzer
3a9c9d53da mbsync: add support for singletons
I can't really guarantee this works right now since I have no singletons
in my collection to test it
2013-03-03 23:39:13 +01:00
Jakob Schnitzer
cd7305d487 mbsync: write metadata to files... 2013-03-03 23:39:13 +01:00
Jakob Schnitzer
2fd3ad5362 initial version of the mbsync plugin
this plugin provides a faster way to query new metadata from
musicbrainz. (instead of having to 're-import' the files)
Currently it lacks all forms of documentation and will only work for
album queries. not really tested so far so be careful
2013-03-03 23:39:13 +01:00