From 7ee02440c8325f0ba819d397c764b2e9f5e446df Mon Sep 17 00:00:00 2001 From: Hellow Date: Fri, 24 Mar 2023 18:12:28 +0100 Subject: [PATCH] removed redundant modules --- src/music_kraken/lyrics/__init__.py | 0 src/music_kraken/metadata/__init__.py | 0 src/music_kraken/target/__init__.py | 5 --- src/music_kraken/target/set_target.py | 61 --------------------------- 4 files changed, 66 deletions(-) delete mode 100644 src/music_kraken/lyrics/__init__.py delete mode 100644 src/music_kraken/metadata/__init__.py delete mode 100644 src/music_kraken/target/__init__.py delete mode 100644 src/music_kraken/target/set_target.py diff --git a/src/music_kraken/lyrics/__init__.py b/src/music_kraken/lyrics/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/music_kraken/metadata/__init__.py b/src/music_kraken/metadata/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/music_kraken/target/__init__.py b/src/music_kraken/target/__init__.py deleted file mode 100644 index dd69eda..0000000 --- a/src/music_kraken/target/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from . import ( - set_target -) - -set_target = set_target diff --git a/src/music_kraken/target/set_target.py b/src/music_kraken/target/set_target.py deleted file mode 100644 index e61187c..0000000 --- a/src/music_kraken/target/set_target.py +++ /dev/null @@ -1,61 +0,0 @@ -import os.path -import logging - -from ..utils.shared import * -from ..database.temp_database import temp_database - -logger = PATH_LOGGER - -UNHIDE_CHAR = '_' - -def unhide(part: str): - if len(part) == 0: - return "" - if part[0] == ".": - return part.replace(".", UNHIDE_CHAR, 1) - - return part - - -class UrlPath: - def __init__(self, genre: str): - - self.genre = genre - - for song in temp_database.get_tracks_without_filepath(): - # print(song) - file, path = self.get_path_from_song(song) - logger.info(f"setting target to {file}") - temp_database.set_filepath(song.id, file, path, genre) - - def get_path_from_song(self, song): - """ - genre/artist/song.mp3 - - :param song: - :return: path: - """ - return os.path.join(self.get_genre(), self.get_artist(song), self.get_album(song), - f"{self.get_song(song)}.mp3"), os.path.join(self.get_genre(), self.get_artist(song), - self.get_album(song)) - - @staticmethod - def escape_part(part: str): - return unhide(part.replace("/", " ")) - - def get_genre(self): - return self.escape_part(self.genre) - - def get_album(self, song): - return self.escape_part(song.release) - - def get_artist(self, song): - artists = song.get_artist_names() - return self.escape_part(artists[0]) - - def get_song(self, song): - return self.escape_part(song.title) - - -if __name__ == "__main__": - UrlPath("dsbm")