Repository navigation
Remove raise of StopIteration in ttvdb4 generator - #1472
Merged
Merged
Conversation
Tom Peterson's suggested change to replace the "raise StopIteration" lines with "return" inside the generator routine has been implemented in ttvdbv4_api.py. This is the PEP 479-compliant way to end a generator. In myth4ttvdbv4.py, the buildSingle() routine has been updated to accommodate a possible StopIteration exception when the generator is called. If that exception happens, we will exit with a "No matching episode found" error message. Similarly, buildCollection() has been updated to exit with a "No matching collection found" error message when the provided reference identifier does not correspond to a known TV series. The tvmaze metadata grabber had similar vague failures. For a non-existent episode: tvmaze.py -l en -a US -D 32938 2 35 ERROR: <class 'AttributeError'> : 'NoneType' object has no attribute 'name' For a non-existent series: tvmaze.py -l en -a US -C 99999 ERROR: <class 'AttributeError'> : 'NoneType' object has no attribute 'name' The tvmaze.py script has been updated to switch these to: tvmaze.py -l en -a US -D 32938 2 35 ERROR: <class 'SystemExit'> : No matching episode found tvmaze.py -l en -a US -C 99999 ERROR: <class 'SystemExit'> : No matching collection found This provides consistent behavior between ttvdb4.py and tvmaze.py grabbers for these types of failures. Resolves MythTV#1433
Contributor
Author
|
@rcrdnalor Could you please review #1465 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tom Peterson's suggested change to replace the "raise StopIteration" lines with "return" inside the generator routine has been implemented in ttvdbv4_api.py. This is the PEP 479-compliant way to end a generator.
In myth4ttvdbv4.py, the buildSingle() routine has been updated to accommodate a possible StopIteration exception when the generator is called. If that exception happens, we will exit with a "No matching episode found" error message. Similarly, buildCollection() has been updated to exit with a "No matching collection found" error message when the provided reference identifier does not correspond to a known TV series.
The tvmaze metadata grabber had similar vague failures.
For a non-existent episode:
For a non-existent series:
The tvmaze.py script has been updated to switch these to:
This provides consistent behavior between ttvdb4.py and tvmaze.py grabbers for these types of failures.
Resolves #1433
Checklist