addet sorting options to config,

yet to implement any sorting
This commit is contained in:
Hellow 2023-04-16 15:48:39 +02:00
parent ca25590baa
commit 80a8947dda
3 changed files with 34 additions and 2 deletions

View File

@ -491,7 +491,10 @@ class Artist(MainObject):
:return:
"""
# self.main_album_collection.sort(key=lambda _album: _album.date)
if len(self.main_album_collection) <= 0:
return
self.main_album_collection.sort(key=lambda _album: _album.date)
for i, album in enumerate(self.main_album_collection):
if album.albumsort is None:

View File

@ -1,6 +1,14 @@
import logging
from .base_classes import SingleAttribute, FloatAttribute, StringAttribute, IntAttribute, Section, Description, EmptyLine
from .base_classes import (
SingleAttribute,
FloatAttribute,
StringAttribute,
Section,
Description,
EmptyLine,
BoolAttribute
)
# Only the formats with id3 metadata can be used
# https://www.audioranger.com/audio-formats.php
@ -53,6 +61,22 @@ ID3.2: {', '.join(_sorted_id3_2_formats)}
ID3.1: {', '.join(_sorted_id3_1_formats)}
""".strip())
self.SORT_BY_DATE = BoolAttribute(
name="sort_by_date",
description="If this is set to true, it will set the albumsort attribute such that,\n"
"the albums are sorted by date.",
value="true"
)
self.SORT_BY_ALBUM_TYPE = BoolAttribute(
name="sort_album_by_type",
description="If this is set to true, it will set the albumsort attribute such that,\n"
"the albums are put into categories before being sorted.\n"
"This means for example, the Studio Albums and EP's are always in front of Singles, "
"and Compilations are in the back.",
value="true"
)
self.DOWNLOAD_PATH = StringAttribute(
name="download_path",
value="{genre}/{artist}/{album_type}/{album}",
@ -105,6 +129,8 @@ ID3.1: {', '.join(_sorted_id3_1_formats)}
self.BITRATE,
self.AUDIO_FORMAT,
EmptyLine(),
self.SORT_BY_DATE,
self.SORT_BY_ALBUM_TYPE,
Description("""
There are multiple fields, you can use for the path and file name:
- genre

View File

@ -94,3 +94,6 @@ CHUNK_SIZE = CONNECTION_SECTION.CHUNK_SIZE.object_from_value
# If the percentage goes over this threshold DownloadResult returns the download errors
# in the __str__ method
SHOW_DOWNLOAD_ERRORS_THRESHOLD = CONNECTION_SECTION.SHOW_DOWNLOAD_ERRORS_THRESHOLD.object_from_value
SORT_BY_DATE = AUDIO_SECTION.SORT_BY_DATE.object_from_value
SORT_BY_ALBUM_TYPE = AUDIO_SECTION.SORT_BY_ALBUM_TYPE.object_from_value