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: :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): for i, album in enumerate(self.main_album_collection):
if album.albumsort is None: if album.albumsort is None:

View File

@ -1,6 +1,14 @@
import logging 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 # Only the formats with id3 metadata can be used
# https://www.audioranger.com/audio-formats.php # 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)} ID3.1: {', '.join(_sorted_id3_1_formats)}
""".strip()) """.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( self.DOWNLOAD_PATH = StringAttribute(
name="download_path", name="download_path",
value="{genre}/{artist}/{album_type}/{album}", value="{genre}/{artist}/{album_type}/{album}",
@ -105,6 +129,8 @@ ID3.1: {', '.join(_sorted_id3_1_formats)}
self.BITRATE, self.BITRATE,
self.AUDIO_FORMAT, self.AUDIO_FORMAT,
EmptyLine(), EmptyLine(),
self.SORT_BY_DATE,
self.SORT_BY_ALBUM_TYPE,
Description(""" Description("""
There are multiple fields, you can use for the path and file name: There are multiple fields, you can use for the path and file name:
- genre - 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 # If the percentage goes over this threshold DownloadResult returns the download errors
# in the __str__ method # in the __str__ method
SHOW_DOWNLOAD_ERRORS_THRESHOLD = CONNECTION_SECTION.SHOW_DOWNLOAD_ERRORS_THRESHOLD.object_from_value 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