songbirdcli 0.2.4__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/PKG-INFO +1 -1
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/pyproject.toml +3 -2
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli/cli.py +79 -42
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli/helpers.py +9 -4
- songbirdcli-0.2.5/songbirdcli/version.py +1 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli.egg-info/PKG-INFO +1 -1
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/tests/unit/test_cli.py +0 -1
- songbirdcli-0.2.4/songbirdcli/version.py +0 -1
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/.dockerignore +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/.github/workflows/docker.yml +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/.github/workflows/pages.yaml +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/.github/workflows/pypi-publish.yaml +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/.github/workflows/style.yml +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/.github/workflows/tests.yaml +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/.gitignore +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/Dockerfile +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/LICENSE +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/Makefile +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/README.md +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/docs/index.md +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/docs/songbirdcli/cli.md +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/docs/songbirdcli/helpers.md +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/docs/songbirdcli/settings.md +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/markdownlint.yaml +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/mkdocs.yml +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/setup.cfg +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli/requirements.txt +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli/requirements.txt.blank +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli/settings.py +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli.egg-info/SOURCES.txt +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli.egg-info/dependency_links.txt +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli.egg-info/requires.txt +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/songbirdcli.egg-info/top_level.txt +0 -0
- {songbirdcli-0.2.4 → songbirdcli-0.2.5}/tests/unit/test_helpers.py +0 -0
|
@@ -7,7 +7,7 @@ name = "songbirdcli"
|
|
|
7
7
|
authors = [
|
|
8
8
|
{name = "Christian Boin"},
|
|
9
9
|
]
|
|
10
|
-
version = "0.2.
|
|
10
|
+
version = "0.2.5"
|
|
11
11
|
description = "Songbird's cli."
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.11"
|
|
@@ -45,4 +45,5 @@ package = [
|
|
|
45
45
|
exclude = ["app", "junit"]
|
|
46
46
|
|
|
47
47
|
[tool.pytest.ini_options]
|
|
48
|
-
log_cli_level="INFO"
|
|
48
|
+
log_cli_level="INFO"
|
|
49
|
+
log_cli=1
|
|
@@ -392,51 +392,71 @@ def run_for_song(
|
|
|
392
392
|
return True
|
|
393
393
|
|
|
394
394
|
|
|
395
|
+
def get_songs_for_album(
|
|
396
|
+
current_mode: modes.Modes, quit_str: str = "q"
|
|
397
|
+
) -> Optional[Union[List[itunes_api.ItunesApiSongModel], modes.Modes]]:
|
|
398
|
+
"""allow user to search for an album, returning the selected song properties for that album to
|
|
399
|
+
use by default simplifying the download process
|
|
400
|
+
|
|
401
|
+
Args:
|
|
402
|
+
current_mode (modes.Modes): the mode enum signifying the current mode
|
|
403
|
+
quit_str (str, optional): _description_. Defaults to "q".
|
|
404
|
+
|
|
405
|
+
Returns:
|
|
406
|
+
Optional[Union[List[itunes_api.ItunesApiSongModel],modes.Modes]]: return None if error, quit_str if user quits, the mode if user selects mode, or the list of album properties
|
|
407
|
+
"""
|
|
408
|
+
album_name = helpers.get_input(
|
|
409
|
+
f"Enter an album name.", out_type=str, quit_str=quit_str
|
|
410
|
+
)
|
|
411
|
+
# quit condition
|
|
412
|
+
if album_name == quit_str:
|
|
413
|
+
return quit_str
|
|
414
|
+
if album_name is None:
|
|
415
|
+
return None
|
|
416
|
+
|
|
417
|
+
mode = resolve_mode(album_name, current_mode=current_mode)
|
|
418
|
+
# detect mode change and return to main menu
|
|
419
|
+
if mode is not None:
|
|
420
|
+
return mode
|
|
421
|
+
|
|
422
|
+
album_song_properties = helpers.launch_album_mode(album_name)
|
|
423
|
+
# quit iteration to main menu
|
|
424
|
+
if album_song_properties == quit_str:
|
|
425
|
+
return quit_str
|
|
426
|
+
if album_song_properties is None:
|
|
427
|
+
return None
|
|
428
|
+
|
|
429
|
+
return album_song_properties
|
|
430
|
+
|
|
431
|
+
|
|
395
432
|
def get_songs_from_user(
|
|
396
433
|
current_mode: modes.Modes, quit_str: str = "q"
|
|
397
434
|
) -> Optional[Union[str, List[str]]]:
|
|
398
|
-
|
|
399
|
-
if current_mode == modes.Modes.ALBUM:
|
|
400
|
-
album_name = helpers.get_input(
|
|
401
|
-
f"Enter an album name.", out_type=str, quit_str=quit_str
|
|
402
|
-
)
|
|
403
|
-
# quit condition
|
|
404
|
-
if album_name == quit_str:
|
|
405
|
-
return quit_str
|
|
406
|
-
if album_name is None:
|
|
407
|
-
return None
|
|
435
|
+
"""gather songs from user, validate that the mode wasnt changed
|
|
408
436
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
return mode
|
|
413
|
-
|
|
414
|
-
album_song_properties = helpers.launch_album_mode(album_name)
|
|
415
|
-
# quit iteration to main menu
|
|
416
|
-
if album_song_properties == quit_str:
|
|
417
|
-
return quit_str
|
|
418
|
-
if album_song_properties is None:
|
|
419
|
-
return None
|
|
420
|
-
return [song.trackName for song in album_song_properties]
|
|
437
|
+
Args:
|
|
438
|
+
current_mode (modes.Modes): the current mode of songbird
|
|
439
|
+
quit_str (str, optional): allows the user to quit out of this selection. Defaults to "q".
|
|
421
440
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
441
|
+
Returns:
|
|
442
|
+
Optional[Union[str, List[str]]]: None if error occurs, the mode if user changes modes, or a list of song names
|
|
443
|
+
"""
|
|
444
|
+
songs = helpers.get_input_list(
|
|
445
|
+
"Please input song(s), separated by ';'. E.g. song1; song2; song3.",
|
|
446
|
+
out_type=str,
|
|
447
|
+
sep="; ",
|
|
448
|
+
)
|
|
449
|
+
# quit iteration to main menu
|
|
450
|
+
if songs == quit_str:
|
|
451
|
+
return quit_str
|
|
452
|
+
if songs is None:
|
|
453
|
+
return None
|
|
434
454
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
455
|
+
mode = resolve_mode(songs[0], current_mode=current_mode)
|
|
456
|
+
# detect mode change and return to main menu
|
|
457
|
+
if mode is not None:
|
|
458
|
+
return mode
|
|
459
|
+
return songs
|
|
440
460
|
|
|
441
461
|
|
|
442
462
|
def run(config: settings.SongbirdCliConfig):
|
|
@@ -471,7 +491,16 @@ def run(config: settings.SongbirdCliConfig):
|
|
|
471
491
|
|
|
472
492
|
song_properties = None
|
|
473
493
|
album_song_properties = None
|
|
474
|
-
result =
|
|
494
|
+
result = None
|
|
495
|
+
if current_mode == modes.Modes.ALBUM:
|
|
496
|
+
result = get_songs_for_album(
|
|
497
|
+
current_mode=current_mode, quit_str=quit_str
|
|
498
|
+
)
|
|
499
|
+
elif current_mode == modes.Modes.SONG:
|
|
500
|
+
result = get_songs_from_user(
|
|
501
|
+
current_mode=current_mode, quit_str=quit_str
|
|
502
|
+
)
|
|
503
|
+
|
|
475
504
|
# user quits
|
|
476
505
|
if result == quit_str:
|
|
477
506
|
return_to_menu = helpers.get_input(
|
|
@@ -495,10 +524,18 @@ def run(config: settings.SongbirdCliConfig):
|
|
|
495
524
|
# error occurred
|
|
496
525
|
if result is None:
|
|
497
526
|
continue
|
|
498
|
-
|
|
499
|
-
|
|
527
|
+
|
|
528
|
+
# if no errors, and user is in album mode, pre-fill songs
|
|
529
|
+
# and properties with album values
|
|
530
|
+
if current_mode == modes.Modes.ALBUM:
|
|
531
|
+
songs = [song.trackName for song in result]
|
|
532
|
+
album_song_properties = result
|
|
533
|
+
elif current_mode == modes.Modes.SONG:
|
|
534
|
+
songs = result
|
|
535
|
+
|
|
500
536
|
logger.info(f"Searching for songs: {songs}")
|
|
501
537
|
for i, song in enumerate(songs):
|
|
538
|
+
# pre-select song properties from album mode if specified
|
|
502
539
|
if album_song_properties is not None:
|
|
503
540
|
song_properties = album_song_properties[i]
|
|
504
541
|
success = run_for_song(config, song, song_properties, quit_str)
|
|
@@ -10,12 +10,17 @@ import logging
|
|
|
10
10
|
logger = logging.getLogger(__name__)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def launch_album_mode(
|
|
14
|
-
"""
|
|
13
|
+
def launch_album_mode(
|
|
14
|
+
artist_album_string="", quit_str="q"
|
|
15
|
+
) -> Optional[Union[List[itunes_api.ItunesApiSongModel], str]]:
|
|
16
|
+
"""launch album mode: collect album and songs to download
|
|
17
|
+
|
|
15
18
|
Args:
|
|
16
|
-
artist_album_string (str): the
|
|
19
|
+
artist_album_string (str, optional): the string used when querying itunes api. Defaults to ''.
|
|
20
|
+
quit_str (str, optional): the str to signify user quitting the process. Defaults to "q".
|
|
17
21
|
|
|
18
|
-
Returns:
|
|
22
|
+
Returns:
|
|
23
|
+
Optional[Union[List[itunes_api.ItunesApiSongModel],str]]: the list of song properties gathered from the search, None if error occured, quit_str if user quit
|
|
19
24
|
|
|
20
25
|
"""
|
|
21
26
|
while True:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "0.2.5"
|
|
@@ -54,7 +54,6 @@ cli_inputs = [
|
|
|
54
54
|
"0", # user selects album 0
|
|
55
55
|
"-1", # user selects keep all songs
|
|
56
56
|
"-5", # user enters invalid input
|
|
57
|
-
"0", # user selects song property 0 for first song
|
|
58
57
|
"", # user hits enter to search youtube
|
|
59
58
|
"0", # user selects song 0
|
|
60
59
|
"l", # save locally
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = "0.2.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|