update Beets

This commit is contained in:
AdeHub
2024-08-24 16:44:41 +12:00
parent a63098a919
commit 046d4d82b4
116 changed files with 17353 additions and 9964 deletions
+22 -22
View File
@@ -15,15 +15,12 @@
"""Warns you about things you hate (or even blocks import)."""
from beets.plugins import BeetsPlugin
from beets.importer import action
from beets.library import parse_query_string
from beets.library import Item
from beets.library import Album
from beets.library import Album, Item, parse_query_string
from beets.plugins import BeetsPlugin
__author__ = 'baobab@heresiarch.info'
__version__ = '2.0'
__author__ = "baobab@heresiarch.info"
__version__ = "2.0"
def summary(task):
@@ -31,20 +28,23 @@ def summary(task):
object.
"""
if task.is_album:
return f'{task.cur_artist} - {task.cur_album}'
return f"{task.cur_artist} - {task.cur_album}"
else:
return f'{task.item.artist} - {task.item.title}'
return f"{task.item.artist} - {task.item.title}"
class IHatePlugin(BeetsPlugin):
def __init__(self):
super().__init__()
self.register_listener('import_task_choice',
self.import_task_choice_event)
self.config.add({
'warn': [],
'skip': [],
})
self.register_listener(
"import_task_choice", self.import_task_choice_event
)
self.config.add(
{
"warn": [],
"skip": [],
}
)
@classmethod
def do_i_hate_this(cls, task, action_patterns):
@@ -62,19 +62,19 @@ class IHatePlugin(BeetsPlugin):
return False
def import_task_choice_event(self, session, task):
skip_queries = self.config['skip'].as_str_seq()
warn_queries = self.config['warn'].as_str_seq()
skip_queries = self.config["skip"].as_str_seq()
warn_queries = self.config["warn"].as_str_seq()
if task.choice_flag == action.APPLY:
if skip_queries or warn_queries:
self._log.debug('processing your hate')
self._log.debug("processing your hate")
if self.do_i_hate_this(task, skip_queries):
task.choice_flag = action.SKIP
self._log.info('skipped: {0}', summary(task))
self._log.info("skipped: {0}", summary(task))
return
if self.do_i_hate_this(task, warn_queries):
self._log.info('you may hate this: {0}', summary(task))
self._log.info("you may hate this: {0}", summary(task))
else:
self._log.debug('nothing to do')
self._log.debug("nothing to do")
else:
self._log.debug('user made a decision, nothing to do')
self._log.debug("user made a decision, nothing to do")