Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed TypeError when downloading tracks #1177

Merged
merged 1 commit into from
Feb 6, 2021
Merged

Fixed TypeError when downloading tracks #1177

merged 1 commit into from
Feb 6, 2021

Conversation

xnetcat
Copy link
Member

@xnetcat xnetcat commented Feb 6, 2021

YMusic sometimes returns results without duration, this commit makes sure that it does not break spotdl

track: https://open.spotify.com/track/3pjUyVbFmM96tYhSaKJwTt?si=EL8F3YB4SZqfJGU267O4-g

Error:
image

@Silverarmor Silverarmor changed the base branch from master to dev February 6, 2021 05:03
@Silverarmor Silverarmor added Bug Fix PRs that fix bugs High Priority Indicates an issue that requires immediate attention and should be addressed as soon as possible labels Feb 6, 2021
@@ -95,7 +95,7 @@ def __map_result_to_song_data(result: dict) -> dict:
'name': result['title'],
'type': result['resultType'],
'artist': artists,
'length': __parse_duration(result['duration']),
'length': __parse_duration(result.get('duration', None)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The None is a default return value from get() function. You don't have to specify it.

Suggested change
'length': __parse_duration(result.get('duration', None)),
'length': __parse_duration(result.get('duration')),

Copy link
Member

@Silverarmor Silverarmor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Silverarmor
Copy link
Member

Hi @xnetcat! Great to see you contributing around spotDL!
Would you be interested in joining the spotDL development team?

Thanks for this contribution! :)

@Silverarmor Silverarmor merged commit 7cc1680 into spotDL:dev Feb 6, 2021
@Silverarmor Silverarmor mentioned this pull request Feb 6, 2021
@xnetcat xnetcat deleted the type-error-fix branch February 7, 2021 21:41
Silverarmor added a commit that referenced this pull request Feb 8, 2021
* Run regressions on CI (#1158)
Authored by @aklajnert 

* Use argparse instead of raw `sys.argv` (#1157)
Authored by @aklajnert 

* FIxed error caused by songs with ':' in name (#1162)
Authored by @MikhailZex 

* Fixed TypeError when downloading tracks (#1177)
Authored by @xnetcat

* Bump version to 3.3.2

* Lint with flake8, fix code to pass it (#1178)
Authored by @aklajnert 

* Fixed flake8 (#1181)
Authored by @aklajnert

* Skip song if track is empty. (#1164)
Authored by @bee395 

Co-authored-by: Andrzej Klajnert <github@aklajnert.pl>
Co-authored-by: Michael George <MikhailZex@gmail.com>
Co-authored-by: Jakub <42355410+xnetcat@users.noreply.github.com>
Co-authored-by: bee395 <bee395@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix PRs that fix bugs High Priority Indicates an issue that requires immediate attention and should be addressed as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants