Compare commits

..

No commits in common. "1e62d371cdd7712158ec3a1b731d05bf9793e6ec" and "d374ca324d55e4ee411c45562af28da43fb30f47" have entirely different histories.

5 changed files with 15 additions and 20 deletions

View File

@ -7,7 +7,7 @@ logging.getLogger().setLevel(logging.DEBUG)
if __name__ == "__main__":
commands = [
"s: #a Ghost Bath",
"d: 0",
"4",
]

View File

@ -14,7 +14,7 @@ from ..pages import Page, EncyclopaediaMetallum, Musify, YouTube, YoutubeMusic,
ALL_PAGES: Set[Type[Page]] = {
# EncyclopaediaMetallum,
EncyclopaediaMetallum,
Musify,
YoutubeMusic,
Bandcamp

View File

@ -22,7 +22,6 @@ from ..objects import (
)
from ..connection import Connection
from ..utils.support_classes.download_result import DownloadResult
from ..utils.string_processing import clean_song_title
from ..utils.config import main_settings, logging_settings
from ..utils.shared import DEBUG
@ -115,7 +114,7 @@ class Bandcamp(Page):
if object_type is BandcampTypes.SONG:
return Song(
title=clean_song_title(name, artist_name=data["band_name"]),
title=name.strip(),
source_list=source_list,
main_artist_list=[
Artist(
@ -255,7 +254,7 @@ class Bandcamp(Page):
def _parse_track_element(self, track: dict) -> Optional[Song]:
return Song(
title=clean_song_title(track["item"]["name"]),
title=track["item"]["name"].strip(),
source_list=[Source(self.SOURCE_TYPE, track["item"]["mainEntityOfPage"])],
tracksort=int(track["position"])
)
@ -338,7 +337,7 @@ class Bandcamp(Page):
mp3_url = value
song = Song(
title=clean_song_title(data["name"], artist_name=artist_data["name"]),
title=data["name"].strip(),
source_list=[Source(self.SOURCE_TYPE, data.get("mainEntityOfPage", data["@id"]), audio_url=mp3_url)],
album_list=[Album(
title=album_data["name"].strip(),

View File

@ -17,7 +17,7 @@ DEBUG_LOGGING = DEBUG and True
DEBUG_TRACE = DEBUG and True
DEBUG_OBJECT_TRACE = DEBUG and False
DEBUG_YOUTUBE_INITIALIZING = DEBUG and False
DEBUG_PAGES = DEBUG and True
DEBUG_PAGES = DEBUG and False
DEBUG_DUMP = DEBUG and True
if DEBUG:

View File

@ -1,7 +1,6 @@
from typing import Tuple, Union, Optional
from typing import Tuple, Union
from pathlib import Path
import string
from functools import lru_cache
from transliterate.exceptions import LanguageDetectionError
from transliterate import translit
@ -12,7 +11,7 @@ COMMON_TITLE_APPENDIX_LIST: Tuple[str, ...] = (
"(official video)",
)
@lru_cache
def unify(string: str) -> str:
"""
returns a unified str, to make comparisons easy.
@ -53,7 +52,7 @@ def fit_to_file_system(string: Union[str, Path]) -> Union[str, Path]:
return fit_string(string)
def clean_song_title(raw_song_title: str, artist_name: Optional[str] = None) -> str:
def clean_song_title(raw_song_title: str, artist_name: str) -> str:
"""
This function cleans common naming "conventions" for non clean song titles, like the title of youtube videos
@ -65,16 +64,13 @@ def clean_song_title(raw_song_title: str, artist_name: Optional[str] = None) ->
- `song (prod. some producer)`
"""
raw_song_title = raw_song_title.strip()
artist_name = artist_name.strip()
# Clean official Video appendix
for dirty_appendix in COMMON_TITLE_APPENDIX_LIST:
if raw_song_title.lower().endswith(dirty_appendix):
raw_song_title = raw_song_title[:-len(dirty_appendix)].strip()
# everything that requires the artist name
if artist_name is not None:
artist_name = artist_name.strip()
# Remove artist from the start of the title
if raw_song_title.lower().startswith(artist_name.lower()):
raw_song_title = raw_song_title[len(artist_name):].strip()