Removed hard-coded decade
This commit is contained in:
@@ -40,6 +40,7 @@ from .api_objects import (
|
||||
SearchResult,
|
||||
Song,
|
||||
)
|
||||
from ..util import this_decade
|
||||
|
||||
|
||||
class SongCacheStatus(Enum):
|
||||
@@ -114,7 +115,7 @@ class AlbumSearchQuery:
|
||||
GENRE = 8
|
||||
|
||||
type: Type
|
||||
year_range: Tuple[int, int] = (2010, 2020)
|
||||
year_range: Tuple[int, int] = this_decade()
|
||||
genre: Genre = _Genre("Rock")
|
||||
|
||||
_strhash: Optional[str] = None
|
||||
|
@@ -5,6 +5,7 @@ from typing import Any, Callable, Dict, Optional, Set, Tuple, Type
|
||||
|
||||
from ..adapters import AlbumSearchQuery
|
||||
from ..adapters.api_objects import Genre, Song
|
||||
from ..util import this_decade
|
||||
|
||||
|
||||
class RepeatType(Enum):
|
||||
@@ -89,7 +90,7 @@ class UIState:
|
||||
current_album_search_query: AlbumSearchQuery = AlbumSearchQuery(
|
||||
AlbumSearchQuery.Type.RANDOM,
|
||||
genre=_DefaultGenre(),
|
||||
year_range=(2010, 2020),
|
||||
year_range=this_decade(),
|
||||
)
|
||||
|
||||
active_playlist_id: Optional[str] = None
|
||||
|
@@ -1,5 +1,6 @@
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
from typing import Tuple, Union
|
||||
|
||||
|
||||
def resolve_path(*joinpath_args: Union[str, Path]) -> Path:
|
||||
@@ -12,3 +13,10 @@ def resolve_path(*joinpath_args: Union[str, Path]) -> Path:
|
||||
f"{Path(*joinpath_args)} could not be found in any of the following "
|
||||
"directories: {', '.join(roots)}"
|
||||
)
|
||||
|
||||
|
||||
def this_decade() -> Tuple[int, int]:
|
||||
"""Returns a tuple representing the start and end year of the current decade."""
|
||||
now = datetime.now()
|
||||
decade_start = now.year // 10 * 10
|
||||
return (decade_start, decade_start + 10)
|
||||
|
Reference in New Issue
Block a user