From 00c1cdc391f2e9cc184544d248ad6165fe82bbf0 Mon Sep 17 00:00:00 2001 From: Logykk <35679186+logykk@users.noreply.github.com> Date: Wed, 17 Nov 2021 20:12:16 +1300 Subject: [PATCH 1/2] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 31 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 17 +++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..9ccec0fb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG]" +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Enter `python zspotify -...` +2. Enter '....' +3. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**System Info:** + - OS: [e.g. Windows 11, Ubuntu 20.04] + - Release: [e.g. exe, docker, source] + - Version (If using a binary release) + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..d233fde0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[FEATURE]" +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Additional context** +Add any other context or screenshots about the feature request here. From b9d42c4d7df34796c3783e74ba7fc51b5835e699 Mon Sep 17 00:00:00 2001 From: logykk Date: Wed, 17 Nov 2021 21:29:15 +1300 Subject: [PATCH 2/2] Fixed issue when downloading multiple playlists --- zspotify/app.py | 7 ++++++- zspotify/playlist.py | 17 +++++++++-------- zspotify/track.py | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/zspotify/app.py b/zspotify/app.py index 8e961b42..2d315094 100644 --- a/zspotify/app.py +++ b/zspotify/app.py @@ -259,8 +259,13 @@ def search(search_term): print('NO RESULTS FOUND - EXITING...') else: selection = '' + print('\n> SELECT A DOWNLOAD OPTION BY ID') + print('> SELECT A RANGE BY ADDING A DASH BETWEEN BOTH ID\'s') + print('> OR PARTICULAR OPTIONS BY ADDING A COMMA BETWEEN ID\'s') + print('> For example, typing 5 to get option 5 or 10-20 to get\nevery option from 10-20 (inclusive)\n') + print('> Or type 10,12,15,18 to get those options in particular') while len(selection) == 0: - selection = str(input('SELECT ITEM(S) BY S.NO: ')) + selection = str(input('ID(s): ')) inputs = split_input(selection) for pos in inputs: position = int(pos) diff --git a/zspotify/playlist.py b/zspotify/playlist.py index d323723e..4a2b8916 100644 --- a/zspotify/playlist.py +++ b/zspotify/playlist.py @@ -2,7 +2,7 @@ from tqdm import tqdm from const import ITEMS, ID, TRACK, NAME from track import download_track -from utils import fix_filename +from utils import fix_filename, split_input from zspotify import ZSpotify MY_PLAYLISTS_URL = 'https://api.spotify.com/v1/me/playlists' @@ -69,17 +69,18 @@ def download_from_user_playlist(): print(str(count) + ': ' + playlist[NAME].strip()) count += 1 + selection = '' print('\n> SELECT A PLAYLIST BY ID') print('> SELECT A RANGE BY ADDING A DASH BETWEEN BOTH ID\'s') + print('> OR PARTICULAR OPTIONS BY ADDING A COMMA BETWEEN ID\'s') print('> For example, typing 10 to get one playlist or 10-20 to get\nevery playlist from 10-20 (inclusive)\n') + print('> Or type 10,12,15,18 to get those playlists in particular') + while len(selection) == 0: + selection = str(input('ID(s): ')) + playlist_choices = map(int, split_input(selection)) - playlist_choices = map(int, input('ID(s): ').split('-')) - - start = next(playlist_choices) - 1 - end = next(playlist_choices, start + 1) - - for playlist_number in range(start, end): - playlist = playlists[playlist_number] + for playlist_number in playlist_choices: + playlist = playlists[playlist_number - 1] print(f'Downloading {playlist[NAME].strip()}') download_playlist(playlist) diff --git a/zspotify/track.py b/zspotify/track.py index 6b2bec1d..a80ad92e 100644 --- a/zspotify/track.py +++ b/zspotify/track.py @@ -176,7 +176,7 @@ def convert_audio_format(filename) -> None: os.replace(filename, temp_filename) download_format = ZSpotify.get_config(DOWNLOAD_FORMAT).lower() - file_codec = CODEC_MAP.get(download_format, "copy") + file_codec = CODEC_MAP.get(download_format, 'copy') if file_codec != 'copy': bitrate = ZSpotify.get_config(BITRATE) if not bitrate: