mirror of
https://github.com/beetbox/beets.git
synced 2026-01-13 03:34:31 +01:00
Use Abstract Base Class
This commit is contained in:
parent
a3fb8ebfff
commit
0d6df42d5f
3 changed files with 7 additions and 4 deletions
|
|
@ -19,7 +19,7 @@
|
|||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import re
|
||||
from abc import abstractmethod, abstractproperty
|
||||
from abc import ABC, abstractmethod, abstractproperty
|
||||
|
||||
from beets import logging
|
||||
from beets import config
|
||||
|
|
@ -222,7 +222,7 @@ def get_distance(config, data_source, info):
|
|||
return dist
|
||||
|
||||
|
||||
class APIAutotaggerPlugin(BeetsPlugin):
|
||||
class APIAutotaggerPlugin(ABC):
|
||||
def __init__(self):
|
||||
super(APIAutotaggerPlugin, self).__init__()
|
||||
self.config.add({'source_weight': 0.5})
|
||||
|
|
|
|||
|
|
@ -26,9 +26,10 @@ import requests
|
|||
from beets import ui
|
||||
from beets.autotag import APIAutotaggerPlugin
|
||||
from beets.autotag.hooks import AlbumInfo, TrackInfo
|
||||
from beets.plugins import BeetsPlugin
|
||||
|
||||
|
||||
class DeezerPlugin(APIAutotaggerPlugin):
|
||||
class DeezerPlugin(APIAutotaggerPlugin, BeetsPlugin):
|
||||
data_source = 'Deezer'
|
||||
|
||||
# Base URLs for the Deezer API
|
||||
|
|
@ -36,6 +37,7 @@ class DeezerPlugin(APIAutotaggerPlugin):
|
|||
search_url = 'https://api.deezer.com/search/'
|
||||
album_url = 'https://api.deezer.com/album/'
|
||||
track_url = 'https://api.deezer.com/track/'
|
||||
|
||||
id_regex = {
|
||||
'pattern': r'(^|deezer\.com/([a-z]*/)?{}/)([0-9]*)',
|
||||
'match_group': 3,
|
||||
|
|
|
|||
|
|
@ -32,9 +32,10 @@ import confuse
|
|||
from beets import ui
|
||||
from beets.autotag import APIAutotaggerPlugin
|
||||
from beets.autotag.hooks import AlbumInfo, TrackInfo
|
||||
from beets.plugins import BeetsPlugin
|
||||
|
||||
|
||||
class SpotifyPlugin(APIAutotaggerPlugin):
|
||||
class SpotifyPlugin(APIAutotaggerPlugin, BeetsPlugin):
|
||||
data_source = 'Spotify'
|
||||
|
||||
# Base URLs for the Spotify API
|
||||
|
|
|
|||
Loading…
Reference in a new issue