finished audio config

This commit is contained in:
Hellow
2023-04-14 13:03:48 +02:00
parent d8c0cc288f
commit b07ea4aff0
3 changed files with 82 additions and 34 deletions

View File

@@ -47,8 +47,8 @@ class AudioSection(Section):
self.AUDIO_FORMAT = AudioFormatAttribute(name="audio_format", value="mp3", description=f"""
Music Kraken will stream the audio into this format.
You can use Audio formats which support ID3.2 and ID3.1,\n
but you will have cleaner Metadata using ID3.2.\n
You can use Audio formats which support ID3.2 and ID3.1,
but you will have cleaner Metadata using ID3.2.
ID3.2: {', '.join(_sorted_id3_2_formats)}
ID3.1: {', '.join(_sorted_id3_1_formats)}
""".strip())
@@ -65,9 +65,62 @@ ID3.1: {', '.join(_sorted_id3_1_formats)}
description="The filename of the audio file."
)
self.DEFAULT_GENRE = StringAttribute(
name="default_genre",
value="Various Genre",
description="The default value for the genre field."
)
self.DEFAULT_LABEL = StringAttribute(
name="default_label",
value="Various Labels",
description="The Label refers to a lable that signs artists."
)
self.DEFAULT_ARTIST = StringAttribute(
name="default_artist",
value="Various Artists",
description="You know Various Artist."
)
self.DEFAULT_ALBUM = StringAttribute(
name="default_album",
value="Various Album",
description="This value will hopefully not be used."
)
self.DEFAULT_SONG = StringAttribute(
name="default_song",
value="Various Song",
description="If it has to fall back to this value, something did go really wrong."
)
self.DEFAULT_ALBUM_TYPE = StringAttribute(
name="default_album_type",
value="Other",
description="Weirdly enough I barely see this used in file systems."
)
self.attribute_list = [
EmptyLine(),
self.BITRATE,
self.AUDIO_FORMAT
self.AUDIO_FORMAT,
Description("""
There are multiple fields, you can use for the path and file name:
- genre
- label
- artist
- album
- song
- album_type
""".strip()),
self.DOWNLOAD_PATH,
self.DOWNLOAD_FILE,
self.DEFAULT_ALBUM_TYPE,
self.DEFAULT_ARTIST,
self.DEFAULT_GENRE,
self.DEFAULT_LABEL,
self.DEFAULT_SONG
]

View File

@@ -1,7 +1,7 @@
from dataclasses import dataclass
from typing import Optional, List, Union
COMMENT_PREFIX = "// "
COMMENT_PREFIX = "# "
@dataclass
@@ -31,7 +31,7 @@ class SingleAttribute(Attribute):
class StringAttribute(SingleAttribute):
@property
def object_from_value(self) -> str:
return self.value
return self.value.strip()
class IntAttribute(SingleAttribute):
@@ -42,6 +42,7 @@ class IntAttribute(SingleAttribute):
return int(self.value)
class FloatAttribute(SingleAttribute):
@property
def object_from_value(self) -> float:
@@ -72,6 +73,9 @@ class EmptyLine(Description):
def __init__(self):
self.description = "\n"
def __str__(self):
return self.description
class Section:
"""