songbirdcli 0.2.1__tar.gz → 0.2.2__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.1 → songbirdcli-0.2.2}/Makefile +6 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/PKG-INFO +3 -3
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/mkdocs.yml +14 -5
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/pyproject.toml +1 -1
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli/cli.py +14 -11
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli/helpers.py +4 -2
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli/requirements.txt +2 -2
- songbirdcli-0.2.2/songbirdcli/version.py +1 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli.egg-info/PKG-INFO +3 -3
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli.egg-info/requires.txt +2 -2
- songbirdcli-0.2.2/tests/unit/test_cli.py +106 -0
- songbirdcli-0.2.1/songbirdcli/version.py +0 -1
- songbirdcli-0.2.1/tests/unit/test_cli.py +0 -63
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/.dockerignore +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/.github/workflows/docker.yml +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/.github/workflows/pages.yaml +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/.github/workflows/pypi-publish.yaml +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/.github/workflows/style.yml +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/.github/workflows/tests.yaml +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/.gitignore +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/Dockerfile +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/LICENSE +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/README.md +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/docs/index.md +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/docs/songbirdcli/cli.md +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/docs/songbirdcli/helpers.md +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/docs/songbirdcli/settings.md +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/markdownlint.yaml +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/setup.cfg +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli/requirements.txt.blank +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli/settings.py +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli.egg-info/SOURCES.txt +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli.egg-info/dependency_links.txt +0 -0
- {songbirdcli-0.2.1 → songbirdcli-0.2.2}/songbirdcli.egg-info/top_level.txt +0 -0
|
@@ -126,8 +126,14 @@ lint:
|
|
|
126
126
|
black $(APP_NAME)/.
|
|
127
127
|
black tests
|
|
128
128
|
|
|
129
|
+
.PHONY: test-cov
|
|
130
|
+
test-stdout:
|
|
131
|
+
python -m pytest --cov=songbirdcli tests/unit -v
|
|
132
|
+
|
|
133
|
+
.PHONY: test
|
|
129
134
|
test:
|
|
130
135
|
python -m pytest --doctest-modules --junitxml=junit/test-results.xml --cov=songbirdcli --cov-report=xml --cov-report=html tests/unit -v
|
|
131
136
|
|
|
137
|
+
.PHONY: test-env
|
|
132
138
|
test-env:
|
|
133
139
|
$(ENV_VARS) python -m pytest --doctest-modules --junitxml=junit/test-results.xml --cov=songbirdcli --cov-report=xml --cov-report=html tests/unit -v
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: songbirdcli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Songbird's cli.
|
|
5
5
|
Author: Christian Boin
|
|
6
6
|
Project-URL: Documentation, https://cboin1996.github.io/songbird/
|
|
@@ -48,10 +48,10 @@ Requires-Dist: pyparsing==3.1.2
|
|
|
48
48
|
Requires-Dist: pyquery==2.0.0
|
|
49
49
|
Requires-Dist: python-dotenv==1.0.1
|
|
50
50
|
Requires-Dist: requests==2.31.0
|
|
51
|
-
Requires-Dist: requests-htmlc==0.0.
|
|
51
|
+
Requires-Dist: requests-htmlc==0.0.7
|
|
52
52
|
Requires-Dist: requests-oauthlib==2.0.0
|
|
53
53
|
Requires-Dist: rsa==4.9
|
|
54
|
-
Requires-Dist: songbirdcore==0.0.
|
|
54
|
+
Requires-Dist: songbirdcore==0.0.9
|
|
55
55
|
Requires-Dist: soupsieve==2.5
|
|
56
56
|
Requires-Dist: toml==0.10.2
|
|
57
57
|
Requires-Dist: typing_extensions==4.11.0
|
|
@@ -11,11 +11,19 @@ edit_uri: ""
|
|
|
11
11
|
theme:
|
|
12
12
|
name: material
|
|
13
13
|
features:
|
|
14
|
-
-
|
|
15
|
-
-
|
|
14
|
+
- content.tabs.link
|
|
15
|
+
- content.code.annotate
|
|
16
|
+
- content.code.copy
|
|
17
|
+
- announce.dismiss
|
|
16
18
|
- navigation.tabs
|
|
17
|
-
- navigation.
|
|
19
|
+
- navigation.instant
|
|
20
|
+
- navigation.instant.prefetch
|
|
21
|
+
- navigation.instant.preview
|
|
22
|
+
- navigation.instant.progress
|
|
23
|
+
- navigation.path
|
|
18
24
|
- navigation.top
|
|
25
|
+
- navigation.tracking
|
|
26
|
+
- search.suggest
|
|
19
27
|
- toc.follow
|
|
20
28
|
palette:
|
|
21
29
|
# Palette toggle for dark mode
|
|
@@ -39,9 +47,9 @@ validation:
|
|
|
39
47
|
|
|
40
48
|
nav:
|
|
41
49
|
- Get Started:
|
|
42
|
-
- Welcome to
|
|
50
|
+
- Welcome to songbirdcli: index.md
|
|
43
51
|
- API Documentation:
|
|
44
|
-
-
|
|
52
|
+
- songbirdcli:
|
|
45
53
|
- cli: songbirdcli/cli.md
|
|
46
54
|
- helpers: songbirdcli/helpers.md
|
|
47
55
|
- settings: songbirdcli/settings.md
|
|
@@ -51,6 +59,7 @@ extra:
|
|
|
51
59
|
provider: mike
|
|
52
60
|
|
|
53
61
|
plugins:
|
|
62
|
+
- search
|
|
54
63
|
- mkdocstrings:
|
|
55
64
|
enabled: !ENV [ENABLE_MKDOCSTRINGS, true]
|
|
56
65
|
default_handler: python
|
|
@@ -233,7 +233,8 @@ def run_for_song(
|
|
|
233
233
|
# run the youtube downloader
|
|
234
234
|
if config.youtube_dl_enabled:
|
|
235
235
|
payload = config.youtube_searchform_payload
|
|
236
|
-
if song_properties
|
|
236
|
+
# if song_properties is False, user selected no properties
|
|
237
|
+
if song_properties != False:
|
|
237
238
|
payload[config.youtube_search_tag] = (
|
|
238
239
|
f"{song_properties.artistName} {song_properties.trackName}"
|
|
239
240
|
)
|
|
@@ -254,16 +255,18 @@ def run_for_song(
|
|
|
254
255
|
|
|
255
256
|
if downloaded_file_path is None:
|
|
256
257
|
return
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
tag_successful =
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
258
|
+
|
|
259
|
+
if song_properties != False:
|
|
260
|
+
# tag file if user specified song properties
|
|
261
|
+
tag_successful = False
|
|
262
|
+
if file_format == "mp3":
|
|
263
|
+
tag_successful = itunes.mp3ID3Tagger(downloaded_file_path, song_properties)
|
|
264
|
+
elif file_format == "m4a":
|
|
265
|
+
tag_successful = itunes.m4a_tagger(downloaded_file_path, song_properties)
|
|
266
|
+
else:
|
|
267
|
+
logger.warning(
|
|
268
|
+
"You've specified a file format that is has no tagger supported yet. Saving file without tags."
|
|
269
|
+
)
|
|
267
270
|
|
|
268
271
|
# provide user with choices for where to save their file to.
|
|
269
272
|
save_prompt_base = "Would you like to save your file to"
|
|
@@ -59,7 +59,7 @@ def parse_itunes_search_api(
|
|
|
59
59
|
lookup (bool, optional): whether to enable 'lookup' mode in itunes api. Defaults to False.
|
|
60
60
|
|
|
61
61
|
Returns:
|
|
62
|
-
Optional[Union[itunes_api.ItunesApiSongModel]]: returns the selected song properties,
|
|
62
|
+
Optional[Union[itunes_api.ItunesApiSongModel]]: returns the selected song properties, a bool=False if use continues without selection, or None if the user quits or an error occurred.
|
|
63
63
|
"""
|
|
64
64
|
parsed_results_list = itunes.query_api(search_variable, limit, mode, lookup=lookup)
|
|
65
65
|
|
|
@@ -80,7 +80,7 @@ def parse_itunes_search_api(
|
|
|
80
80
|
return
|
|
81
81
|
if len(user_selection) == 0:
|
|
82
82
|
logger.info("Continuing without properties.")
|
|
83
|
-
return
|
|
83
|
+
return False
|
|
84
84
|
|
|
85
85
|
print(f"Selected item: ")
|
|
86
86
|
for k, v in user_selection[0].model_dump().items():
|
|
@@ -183,6 +183,8 @@ def get_input_list(prompt: str, sep: str, out_type=int, quit_str="q") -> List[in
|
|
|
183
183
|
|
|
184
184
|
str_list = inp.split(sep)
|
|
185
185
|
typed_list = []
|
|
186
|
+
# by default pass type check
|
|
187
|
+
type_check_passed = True
|
|
186
188
|
for item in str_list:
|
|
187
189
|
type_check_passed = True
|
|
188
190
|
try:
|
|
@@ -39,10 +39,10 @@ pyparsing==3.1.2
|
|
|
39
39
|
pyquery==2.0.0
|
|
40
40
|
python-dotenv==1.0.1
|
|
41
41
|
requests==2.31.0
|
|
42
|
-
requests-htmlc==0.0.
|
|
42
|
+
requests-htmlc==0.0.7
|
|
43
43
|
requests-oauthlib==2.0.0
|
|
44
44
|
rsa==4.9
|
|
45
|
-
songbirdcore==0.0.
|
|
45
|
+
songbirdcore==0.0.9
|
|
46
46
|
soupsieve==2.5
|
|
47
47
|
toml==0.10.2
|
|
48
48
|
typing_extensions==4.11.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "0.2.2"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: songbirdcli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Songbird's cli.
|
|
5
5
|
Author: Christian Boin
|
|
6
6
|
Project-URL: Documentation, https://cboin1996.github.io/songbird/
|
|
@@ -48,10 +48,10 @@ Requires-Dist: pyparsing==3.1.2
|
|
|
48
48
|
Requires-Dist: pyquery==2.0.0
|
|
49
49
|
Requires-Dist: python-dotenv==1.0.1
|
|
50
50
|
Requires-Dist: requests==2.31.0
|
|
51
|
-
Requires-Dist: requests-htmlc==0.0.
|
|
51
|
+
Requires-Dist: requests-htmlc==0.0.7
|
|
52
52
|
Requires-Dist: requests-oauthlib==2.0.0
|
|
53
53
|
Requires-Dist: rsa==4.9
|
|
54
|
-
Requires-Dist: songbirdcore==0.0.
|
|
54
|
+
Requires-Dist: songbirdcore==0.0.9
|
|
55
55
|
Requires-Dist: soupsieve==2.5
|
|
56
56
|
Requires-Dist: toml==0.10.2
|
|
57
57
|
Requires-Dist: typing_extensions==4.11.0
|
|
@@ -39,10 +39,10 @@ pyparsing==3.1.2
|
|
|
39
39
|
pyquery==2.0.0
|
|
40
40
|
python-dotenv==1.0.1
|
|
41
41
|
requests==2.31.0
|
|
42
|
-
requests-htmlc==0.0.
|
|
42
|
+
requests-htmlc==0.0.7
|
|
43
43
|
requests-oauthlib==2.0.0
|
|
44
44
|
rsa==4.9
|
|
45
|
-
songbirdcore==0.0.
|
|
45
|
+
songbirdcore==0.0.9
|
|
46
46
|
soupsieve==2.5
|
|
47
47
|
toml==0.10.2
|
|
48
48
|
typing_extensions==4.11.0
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
from songbirdcli import cli
|
|
2
|
+
from songbirdcli import settings
|
|
3
|
+
from songbirdcli import version
|
|
4
|
+
from io import StringIO
|
|
5
|
+
import os, sys, shutil
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
cli_inputs = [
|
|
9
|
+
[
|
|
10
|
+
"jolene", # user enters jolene
|
|
11
|
+
"0", # user selects first song
|
|
12
|
+
"", # user opts to search youtube
|
|
13
|
+
"0", # user selects first song
|
|
14
|
+
"i", # save to local itunes folder
|
|
15
|
+
"q", # user quits
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"jolene", # user enters jolene
|
|
19
|
+
"0", # user selects first song
|
|
20
|
+
"https://www.youtube.com/watch?v=Ixrje2rXLMA", # user opts to direct download
|
|
21
|
+
"l", # save locally
|
|
22
|
+
"q", # user quits
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
"billy joel", # user enters billy joel
|
|
26
|
+
"-1", # user selects continue without properties
|
|
27
|
+
"", # user opts to search youtube
|
|
28
|
+
"0", # user selects first song
|
|
29
|
+
"l", # user selects save locally
|
|
30
|
+
"q", # user quits
|
|
31
|
+
],
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@pytest.fixture
|
|
36
|
+
def create_test_folder():
|
|
37
|
+
tests_data_folder = os.path.join(sys.path[0], "tests-output")
|
|
38
|
+
if not os.path.exists(tests_data_folder):
|
|
39
|
+
os.mkdir(tests_data_folder)
|
|
40
|
+
yield tests_data_folder
|
|
41
|
+
# test cleanup
|
|
42
|
+
shutil.rmtree(tests_data_folder)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@pytest.fixture
|
|
46
|
+
def load_m4a_config(create_test_folder, monkeypatch, request):
|
|
47
|
+
# below are parametrized vectorized inputs that
|
|
48
|
+
# a user would enter if downloading a song
|
|
49
|
+
inputs = iter(request.param)
|
|
50
|
+
monkeypatch.setattr("builtins.input", lambda _: next(inputs))
|
|
51
|
+
# create tests-output folder
|
|
52
|
+
tests_data_folder = create_test_folder
|
|
53
|
+
config = settings.SongbirdCliConfig(
|
|
54
|
+
version=version.version,
|
|
55
|
+
root_path=tests_data_folder,
|
|
56
|
+
gdrive_enabled=False,
|
|
57
|
+
itunes_enabled=True,
|
|
58
|
+
file_format="m4a",
|
|
59
|
+
# we set these paths explicitly so that test
|
|
60
|
+
# directories are used
|
|
61
|
+
# in real world scenario, these values
|
|
62
|
+
# could be set to the actual itunes folders
|
|
63
|
+
# as long as run_local is true.
|
|
64
|
+
itunes_lib_path=os.path.join(tests_data_folder, "mock-itunes-lib"),
|
|
65
|
+
itunes_folder_path=os.path.join(tests_data_folder, "mock-itunes-auto-folder"),
|
|
66
|
+
run_local=True,
|
|
67
|
+
)
|
|
68
|
+
return config
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@pytest.fixture
|
|
72
|
+
def load_mp3_config(create_test_folder, monkeypatch, request):
|
|
73
|
+
# below are parametrized vectorized inputs that
|
|
74
|
+
# a user would enter if downloading a song
|
|
75
|
+
inputs = iter(request.param)
|
|
76
|
+
monkeypatch.setattr("builtins.input", lambda _: next(inputs))
|
|
77
|
+
# create tests-output folder
|
|
78
|
+
tests_data_folder = create_test_folder
|
|
79
|
+
config = settings.SongbirdCliConfig(
|
|
80
|
+
version=version.version,
|
|
81
|
+
root_path=tests_data_folder,
|
|
82
|
+
gdrive_enabled=False,
|
|
83
|
+
itunes_enabled=True,
|
|
84
|
+
file_format="mp3",
|
|
85
|
+
# we set these paths explicitly so that test
|
|
86
|
+
# directories are used
|
|
87
|
+
# in real world scenario, these values
|
|
88
|
+
# could be set to the actual itunes folders
|
|
89
|
+
# as long as run_local is true.
|
|
90
|
+
itunes_lib_path=os.path.join(tests_data_folder, "mock-itunes-lib"),
|
|
91
|
+
itunes_folder_path=os.path.join(tests_data_folder, "mock-itunes-auto-folder"),
|
|
92
|
+
run_local=True,
|
|
93
|
+
)
|
|
94
|
+
return config
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@pytest.mark.parametrize("load_mp3_config", cli_inputs, indirect=True)
|
|
98
|
+
def test_cli_mp3(load_mp3_config):
|
|
99
|
+
# invoke the main function of the cli
|
|
100
|
+
cli.run(config=load_mp3_config)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@pytest.mark.parametrize("load_m4a_config", cli_inputs, indirect=True)
|
|
104
|
+
def test_cli_m4a(load_m4a_config):
|
|
105
|
+
# invoke the main function of the cli
|
|
106
|
+
cli.run(config=load_m4a_config)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = "0.2.1"
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
from songbirdcli import cli
|
|
2
|
-
from songbirdcli import settings
|
|
3
|
-
from songbirdcli import version
|
|
4
|
-
from io import StringIO
|
|
5
|
-
import os, sys, shutil
|
|
6
|
-
import pytest
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@pytest.fixture()
|
|
10
|
-
def load_config(monkeypatch, request):
|
|
11
|
-
# below are parametrized vectorized inputs that
|
|
12
|
-
# a user would enter if downloading a song
|
|
13
|
-
inputs = iter(request.param)
|
|
14
|
-
monkeypatch.setattr("builtins.input", lambda _: next(inputs))
|
|
15
|
-
# create tests-output folder
|
|
16
|
-
tests_data_folder = os.path.join(sys.path[0], "tests-output")
|
|
17
|
-
if not os.path.exists(tests_data_folder):
|
|
18
|
-
os.mkdir(tests_data_folder)
|
|
19
|
-
config = settings.SongbirdCliConfig(
|
|
20
|
-
version=version.version,
|
|
21
|
-
root_path=tests_data_folder,
|
|
22
|
-
gdrive_enabled=False,
|
|
23
|
-
itunes_enabled=True,
|
|
24
|
-
# we set these paths explicitly so that test
|
|
25
|
-
# directories are used
|
|
26
|
-
# in real world scenario, these values
|
|
27
|
-
# could be set to the actual itunes folders
|
|
28
|
-
# as long as run_local is true.
|
|
29
|
-
itunes_lib_path=os.path.join(tests_data_folder, "mock-itunes-lib"),
|
|
30
|
-
itunes_folder_path=os.path.join(tests_data_folder, "mock-itunes-auto-folder"),
|
|
31
|
-
run_local=True,
|
|
32
|
-
)
|
|
33
|
-
# yield setup to test
|
|
34
|
-
yield config
|
|
35
|
-
|
|
36
|
-
# test cleanup
|
|
37
|
-
shutil.rmtree(tests_data_folder)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@pytest.mark.parametrize(
|
|
41
|
-
"load_config",
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
"jolene", # user enters jolene
|
|
45
|
-
"0", # user selects first song
|
|
46
|
-
"", # user opts to search youtube
|
|
47
|
-
"0", # user selects first song
|
|
48
|
-
"i", # save to local itunes folder
|
|
49
|
-
"q", # user quits
|
|
50
|
-
],
|
|
51
|
-
[
|
|
52
|
-
"jolene", # user enters jolene
|
|
53
|
-
"0", # user selects first song
|
|
54
|
-
"https://www.youtube.com/watch?v=Ixrje2rXLMA", # user opts to direct download
|
|
55
|
-
"l", # save locally
|
|
56
|
-
"q", # user quits
|
|
57
|
-
],
|
|
58
|
-
],
|
|
59
|
-
indirect=True,
|
|
60
|
-
)
|
|
61
|
-
def test_cli_default(load_config):
|
|
62
|
-
# invoke the make function of the cli
|
|
63
|
-
cli.run(config=load_config)
|
|
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
|