Skip to content

Commit

Permalink
Move discogs_connect to mixin class
Browse files Browse the repository at this point in the history
  • Loading branch information
JOJ0 committed Nov 3, 2024
1 parent 6d94f61 commit 26cd1bc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions discodos/model_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,8 @@

log = logging.getLogger('discodos')


class Collection (Database): # pylint: disable=too-many-public-methods
"""Discogs record collection class."""
def __init__(self, db_conn, db_file=False):
super().__init__(db_conn, db_file)
self.d = False
self.me = False
self.ONLINE = False # set True by discogs_connect method

class DiscogsConnectMixin:
"""Discogs connection method."""
def discogs_connect(self, _userToken, _appIdentifier):
"""Discogs connect try,except wrapper sets attributes d, me and ONLINE.
"""
Expand All @@ -37,6 +30,15 @@ def discogs_connect(self, _userToken, _appIdentifier):
self.ONLINE = False
return self.ONLINE


class Collection (Database, DiscogsConnectMixin): # pylint: disable=too-many-public-methods
"""Discogs record collection class."""
def __init__(self, db_conn, db_file=False):
super().__init__(db_conn, db_file)
self.d = False
self.me = False
self.ONLINE = False # set True by discogs_connect method

def get_all_db_releases(self, orderby='d_artist, discogs_title'):
# return db.all_releases(self.db_conn)
return self._select_simple(
Expand Down

0 comments on commit 26cd1bc

Please sign in to comment.