handle youtube-dl metadata parsing errors + Json parsing errors now contain the parsed text #31
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.
When youtube-dl is outdated it will fail to download some videos. Serenity handles this by silently ignoring the issue, leading to confusion.
This PR changes the youtube-dl metadata parsing to return an
Error::Json
when it fails to parse and also stores the parsed text inError::Json
.With this PR when the serenity voice example is run with the old version of youtube-dl the following is output on some videos:
Err starting source: Json { error: Error("expected value", line: 1, column: 1), parsed_text: "ERROR: "token" parameter not in video info for unknown reason; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.\n" }
This indicates to the user how to fix the problem. i.e. update youtube-dl
Previously the example reported that it was playing the song even when the video failed to load due to outdated youtube-dl resulting in no audio output.