started to migrate to new config
This commit is contained in:
@@ -4,7 +4,10 @@ from typing import Optional, Dict, Tuple, List
|
||||
|
||||
from .metadata import Metadata
|
||||
from .option import Options
|
||||
from ..utils.shared import ID_RANGE, OBJECT_LOGGER as LOGGER
|
||||
from ..utils.config import main_settings, logging_settings
|
||||
|
||||
|
||||
LOGGER = logging_settings["object_logger"]
|
||||
|
||||
|
||||
class DatabaseObject:
|
||||
@@ -25,7 +28,7 @@ class DatabaseObject:
|
||||
64 bit integer, but this is defined in shared.py in ID_BITS
|
||||
the range is defined in the Tuple ID_RANGE
|
||||
"""
|
||||
_id = random.randint(*ID_RANGE)
|
||||
_id = random.randint(*main_settings['id_bits'])
|
||||
self.automatic_id = True
|
||||
LOGGER.debug(f"Id for {type(self).__name__} isn't set. Setting to {_id}")
|
||||
|
||||
|
@@ -19,7 +19,7 @@ from .source import Source, SourceCollection
|
||||
from .target import Target
|
||||
from ..utils.string_processing import unify
|
||||
|
||||
from ..utils import settings
|
||||
from ..utils.config import main_settings
|
||||
|
||||
"""
|
||||
All Objects dependent
|
||||
@@ -513,7 +513,7 @@ class Artist(MainObject):
|
||||
AlbumType.STUDIO_ALBUM: 0,
|
||||
AlbumType.EP: 0,
|
||||
AlbumType.SINGLE: 1
|
||||
}) if settings["sort_album_by_type"] else defaultdict(lambda: 0)
|
||||
}) if main_settings["sort_album_by_type"] else defaultdict(lambda: 0)
|
||||
|
||||
sections = defaultdict(list)
|
||||
|
||||
@@ -526,7 +526,7 @@ class Artist(MainObject):
|
||||
# album is just a value used in loops
|
||||
nonlocal album
|
||||
|
||||
if settings["sort_by_date"]:
|
||||
if main_settings["sort_by_date"]:
|
||||
_section.sort(key=lambda _album: _album.date, reverse=True)
|
||||
|
||||
new_last_albumsort = last_albumsort
|
||||
|
@@ -4,7 +4,8 @@ from typing import List, Dict, Set, Tuple, Optional
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from ..utils.enums.source import SourcePages, SourceTypes
|
||||
from ..utils.shared import ALL_YOUTUBE_URLS
|
||||
from ..utils.config import youtube_settings
|
||||
|
||||
from .metadata import Mapping, Metadata
|
||||
from .parents import DatabaseObject
|
||||
from .collection import Collection
|
||||
@@ -54,7 +55,7 @@ class Source(DatabaseObject):
|
||||
if "musify" in parsed.netloc:
|
||||
return cls(SourcePages.MUSIFY, url, referer_page=referer_page)
|
||||
|
||||
if parsed.netloc in [_url.netloc for _url in ALL_YOUTUBE_URLS]:
|
||||
if parsed.netloc in [_url.netloc for _url in youtube_settings['youtube_url']]:
|
||||
return cls(SourcePages.YOUTUBE, url, referer_page=referer_page)
|
||||
|
||||
if url.startswith("https://www.deezer"):
|
||||
|
Reference in New Issue
Block a user