cleaned up console output
This commit is contained in:
parent
da28616011
commit
5f735c25de
@ -9,4 +9,6 @@ pycountry~=22.3.5
|
||||
python-dateutil~=2.8.2
|
||||
pandoc~=2.3
|
||||
SQLAlchemy
|
||||
setuptools~=60.2.0
|
||||
setuptools~=60.2.0
|
||||
tqdm~=4.65.0
|
||||
peewee~=3.15.4
|
@ -1,6 +1,6 @@
|
||||
import music_kraken
|
||||
from music_kraken import pages
|
||||
from music_kraken.objects import Song, Target, Source, SourcePages
|
||||
from music_kraken.objects import Song, Target, Source, SourcePages, Album
|
||||
|
||||
|
||||
def search_pages():
|
||||
@ -43,6 +43,11 @@ def download_audio():
|
||||
|
||||
pages.Musify.download_song(song)
|
||||
|
||||
def real_download():
|
||||
search = pages.Search()
|
||||
search.search_url("https://musify.club/release/children-of-the-night-2018-1079829")
|
||||
search.download_chosen()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
music_kraken.cli()
|
||||
real_download()
|
||||
|
@ -1,11 +1,11 @@
|
||||
import mutagen
|
||||
from mutagen.id3 import ID3, Frame
|
||||
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
import logging
|
||||
|
||||
from ..utils.shared import (
|
||||
TAGGING_LOGGER as logger
|
||||
TAGGING_LOGGER as LOGGER
|
||||
)
|
||||
from ..objects import Song, Target, Metadata
|
||||
|
||||
@ -18,7 +18,7 @@ class AudioMetadata:
|
||||
|
||||
if file_location is not None:
|
||||
self.file_location = file_location
|
||||
|
||||
|
||||
def add_metadata(self, metadata: Metadata):
|
||||
for value in metadata:
|
||||
"""
|
||||
@ -29,10 +29,9 @@ class AudioMetadata:
|
||||
def add_song_metadata(self, song: Song):
|
||||
self.add_metadata(song.metadata)
|
||||
|
||||
def save(self, file_location: Path = None):
|
||||
LOGGER.debug(f"saving following frames: {self.frames.pprint()}")
|
||||
|
||||
def save(self, file_location: str = None):
|
||||
print("saving")
|
||||
print(self.frames.pprint())
|
||||
if file_location is not None:
|
||||
self.file_location = file_location
|
||||
|
||||
@ -40,25 +39,27 @@ class AudioMetadata:
|
||||
raise Exception("no file target provided to save the data to")
|
||||
self.frames.save(self.file_location, v2_version=4)
|
||||
|
||||
def set_file_location(self, file_location):
|
||||
def set_file_location(self, file_location: Path):
|
||||
# try loading the data from the given file. if it doesn't succeed the frame remains empty
|
||||
try:
|
||||
self.frames.load(file_location, v2_version=4)
|
||||
logger.info(f"loaded following from \"{file_location}\"\n{self.frames.pprint()}")
|
||||
LOGGER.debug(f"loaded following from \"{file_location}\"\n{self.frames.pprint()}")
|
||||
except mutagen.MutagenError:
|
||||
logger.warning(f"couldn't find any metadata at: \"{self.file_location}\"")
|
||||
LOGGER.warning(f"couldn't find any metadata at: \"{self.file_location}\"")
|
||||
self._file_location = file_location
|
||||
|
||||
file_location = property(fget=lambda self: self._file_location, fset=set_file_location)
|
||||
|
||||
|
||||
def write_metadata_to_target(metadata: Metadata, target: Target):
|
||||
if not target.exists:
|
||||
return
|
||||
|
||||
|
||||
id3_object = AudioMetadata(file_location=target.file_path)
|
||||
id3_object.add_metadata(metadata)
|
||||
id3_object.save()
|
||||
|
||||
|
||||
def write_metadata(song: Song, ignore_file_not_found: bool = True):
|
||||
target: Target
|
||||
for target in song.target:
|
||||
|
Loading…
Reference in New Issue
Block a user