feat: added trace
This commit is contained in:
parent
0e2de49831
commit
4e52c0478a
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -17,6 +17,7 @@
|
|||||||
"python.formatting.provider": "none",
|
"python.formatting.provider": "none",
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"Bandcamp",
|
"Bandcamp",
|
||||||
"levenshtein"
|
"levenshtein",
|
||||||
|
"OKBLUE"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -6,9 +6,8 @@ logging.getLogger().setLevel(logging.DEBUG)
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
commands = [
|
commands = [
|
||||||
"s: #a PTK",
|
"s: #a Toxoplasma",
|
||||||
"26",
|
"d: 16",
|
||||||
"d: 1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +67,8 @@ class OuterProxy:
|
|||||||
DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = tuple()
|
DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = tuple()
|
||||||
UPWARDS_COLLECTION_STRING_ATTRIBUTES = tuple()
|
UPWARDS_COLLECTION_STRING_ATTRIBUTES = tuple()
|
||||||
|
|
||||||
|
TITEL = "id"
|
||||||
|
|
||||||
def __init__(self, _id: int = None, dynamic: bool = False, **kwargs):
|
def __init__(self, _id: int = None, dynamic: bool = False, **kwargs):
|
||||||
_automatic_id: bool = False
|
_automatic_id: bool = False
|
||||||
|
|
||||||
@ -218,3 +220,7 @@ class OuterProxy:
|
|||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"{type(self).__name__}({', '.join(key + ': ' + str(val) for key, val in self.indexing_values)})"
|
return f"{type(self).__name__}({', '.join(key + ': ' + str(val) for key, val in self.indexing_values)})"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def title_string(self) -> str:
|
||||||
|
return str(self.__getattribute__(self.TITEL))
|
||||||
|
@ -79,6 +79,7 @@ class Song(Base):
|
|||||||
Base.__init__(**locals())
|
Base.__init__(**locals())
|
||||||
|
|
||||||
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("album_collection", "main_artist_collection", "feature_artist_collection")
|
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("album_collection", "main_artist_collection", "feature_artist_collection")
|
||||||
|
TITEL = "title"
|
||||||
|
|
||||||
def __init_collections__(self) -> None:
|
def __init_collections__(self) -> None:
|
||||||
self.album_collection.contain_given_in_attribute = {
|
self.album_collection.contain_given_in_attribute = {
|
||||||
@ -214,9 +215,10 @@ class Album(Base):
|
|||||||
"artist_collection": Collection,
|
"artist_collection": Collection,
|
||||||
"song_collection": Collection,
|
"song_collection": Collection,
|
||||||
"label_collection": Collection,
|
"label_collection": Collection,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TITEL = "title"
|
||||||
|
|
||||||
# This is automatically generated
|
# This is automatically generated
|
||||||
def __init__(self, title: str = None, unified_title: str = None, album_status: AlbumStatus = None,
|
def __init__(self, title: str = None, unified_title: str = None, album_status: AlbumStatus = None,
|
||||||
album_type: AlbumType = None, language: Language = None, date: ID3Timestamp = None,
|
album_type: AlbumType = None, language: Language = None, date: ID3Timestamp = None,
|
||||||
@ -430,6 +432,8 @@ class Artist(Base):
|
|||||||
"label_collection": Collection,
|
"label_collection": Collection,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TITEL = "name"
|
||||||
|
|
||||||
# This is automatically generated
|
# This is automatically generated
|
||||||
def __init__(self, name: str = "", unified_name: str = None, country: Country = None,
|
def __init__(self, name: str = "", unified_name: str = None, country: Country = None,
|
||||||
formed_in: ID3Timestamp = None, notes: FormattedText = None, lyrical_themes: List[str] = None,
|
formed_in: ID3Timestamp = None, notes: FormattedText = None, lyrical_themes: List[str] = None,
|
||||||
@ -643,6 +647,8 @@ class Label(Base):
|
|||||||
"unified_name": lambda: None,
|
"unified_name": lambda: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TITEL = "name"
|
||||||
|
|
||||||
def __init__(self, name: str = None, unified_name: str = None, notes: FormattedText = None,
|
def __init__(self, name: str = None, unified_name: str = None, notes: FormattedText = None,
|
||||||
source_list: List[Source] = None, contact_list: List[Contact] = None,
|
source_list: List[Source] = None, contact_list: List[Contact] = None,
|
||||||
album_list: List[Album] = None, current_artist_list: List[Artist] = None, **kwargs) -> None:
|
album_list: List[Album] = None, current_artist_list: List[Artist] = None, **kwargs) -> None:
|
||||||
|
@ -28,6 +28,7 @@ from ..utils.config import main_settings
|
|||||||
from ..utils.support_classes.query import Query
|
from ..utils.support_classes.query import Query
|
||||||
from ..utils.support_classes.download_result import DownloadResult
|
from ..utils.support_classes.download_result import DownloadResult
|
||||||
from ..utils.string_processing import fit_to_file_system
|
from ..utils.string_processing import fit_to_file_system
|
||||||
|
from ..utils import trace
|
||||||
|
|
||||||
INDEPENDENT_DB_OBJECTS = Union[Label, Album, Artist, Song]
|
INDEPENDENT_DB_OBJECTS = Union[Label, Album, Artist, Song]
|
||||||
INDEPENDENT_DB_TYPES = Union[Type[Song], Type[Album], Type[Artist], Type[Label]]
|
INDEPENDENT_DB_TYPES = Union[Type[Song], Type[Album], Type[Artist], Type[Label]]
|
||||||
@ -235,6 +236,8 @@ class Page:
|
|||||||
:return detailed_music_object: IT MODIFIES THE INPUT OBJ
|
:return detailed_music_object: IT MODIFIES THE INPUT OBJ
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
trace(f"fetching {type(music_object).__name__} ({music_object.title_string})")
|
||||||
|
|
||||||
# creating a new object, of the same type
|
# creating a new object, of the same type
|
||||||
new_music_object: Optional[DatabaseObject] = None
|
new_music_object: Optional[DatabaseObject] = None
|
||||||
|
|
||||||
@ -332,6 +335,7 @@ class Page:
|
|||||||
|
|
||||||
def _download(self, music_object: DatabaseObject, naming_dict: NamingDict, download_all: bool = False,
|
def _download(self, music_object: DatabaseObject, naming_dict: NamingDict, download_all: bool = False,
|
||||||
skip_details: bool = False, process_metadata_anyway: bool = False) -> DownloadResult:
|
skip_details: bool = False, process_metadata_anyway: bool = False) -> DownloadResult:
|
||||||
|
trace(f"downloading {type(music_object).__name__} ({music_object.title_string})")
|
||||||
skip_next_details = skip_details
|
skip_next_details = skip_details
|
||||||
|
|
||||||
# Skips all releases, that are defined in shared.ALBUM_TYPE_BLACKLIST, if download_all is False
|
# Skips all releases, that are defined in shared.ALBUM_TYPE_BLACKLIST, if download_all is False
|
||||||
|
@ -8,8 +8,6 @@ from .config import config, read_config, write_config
|
|||||||
from .enums.colors import BColors
|
from .enums.colors import BColors
|
||||||
from .path_manager import LOCATIONS
|
from .path_manager import LOCATIONS
|
||||||
|
|
||||||
DEBUG = False
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
IO functions
|
IO functions
|
||||||
"""
|
"""
|
||||||
@ -48,6 +46,12 @@ def dump_to_file(file_name: str, payload: str, is_json: bool = False, exit_after
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
def trace(msg: str):
|
||||||
|
if DEBUG_LOGGING:
|
||||||
|
logging.debug(msg)
|
||||||
|
|
||||||
|
output("trace: " + msg, BColors.OKBLUE)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
misc functions
|
misc functions
|
||||||
|
Loading…
Reference in New Issue
Block a user