From 0d6df42d5fb540e6cbf3a303e1cc7bdfcd5dcc98 Mon Sep 17 00:00:00 2001 From: Rahul Ahuja Date: Fri, 6 Sep 2019 12:08:26 -0700 Subject: [PATCH] Use Abstract Base Class --- beets/autotag/__init__.py | 4 ++-- beetsplug/deezer.py | 4 +++- beetsplug/spotify.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index 132c4ce52..88621b34c 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -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}) diff --git a/beetsplug/deezer.py b/beetsplug/deezer.py index 886978536..a8b4651e6 100644 --- a/beetsplug/deezer.py +++ b/beetsplug/deezer.py @@ -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, diff --git a/beetsplug/spotify.py b/beetsplug/spotify.py index 35ae7e462..43bd8eb76 100644 --- a/beetsplug/spotify.py +++ b/beetsplug/spotify.py @@ -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