Repository navigation
Fix three robustness issues: config encoding, TV category mapping, optional TVDB lookup - #178
Closed
spadieri85 wants to merge 3 commits into
Closed
spadieri85 wants to merge 3 commits into
spadieri85 wants to merge 3 commits into
Conversation
open() without an encoding falls back to the system locale, so on Windows (cp1252) loading the configuration fails with UnicodeDecodeError. The shipped default triggers it: MY_TEXT_H contains U+2501, which cp1252 cannot decode. Writing already uses encoding="utf-8" in create_ban_list_file(); this makes the read paths consistent. Fixes #175 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
_add_torrent_and_tag() mapped the 'tv' category to CATEGORY_MOVIE, so every series was filed under the movie category and CATEGORY_TV was never used on this path. _get_category() in the same module already maps it correctly. Fixes #176 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
tvdb_search() built a TVDB client unconditionally, including for movies and when TVDB_APIKEY is still the generated default "no_key". The resulting 401 aborted the run after hashing had already completed, discarding several minutes of work on large packs. Skip the lookup when no key is configured and degrade to None on error; the caller already handles a falsy result, and uploads succeed with the TMDB id alone. Fixes #177 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Three small, independent fixes, one commit each so they can be cherry-picked or dropped separately.
Closes #175
Closes #176
Closes #177
1. Read the config file with explicit UTF-8 encoding (
common/settings.py)open()without an encoding falls back to the system locale, so on Windows (cp1252) loadingUnit3Dbot.jsonfails withUnicodeDecodeError. It is reached with the shipped default, becauseMY_TEXT_Hcontains━(U+2501). Writing already usesencoding="utf-8"increate_ban_list_file(), so this only makes the two read paths consistent.2. Use
CATEGORY_TVin the tv branch of_add_torrent_and_tag()(common/torrent_clients.py)The
tvbranch assignedCATEGORY_MOVIE. To be precise about the severity: this block is normally unreachable, because the only caller (send_to_client()) passes a category already resolved by_get_category(), so the== 'tv'comparison does not match and no TV upload is misfiled in a default setup. It becomes a real bug only for users who setCATEGORY_TVto the literal stringtvin their config.The commit takes the conservative option — fix the constant, keep the block — but the block could equally well be deleted, since the value arrives already resolved. Happy to switch to that if you prefer.
3. Make the TVDB lookup optional instead of fatal (
common/external_services/theMovieDB/core/api.py)tvdb_search()built aTVDBclient unconditionally — for movies too, and whenTVDB_APIKEYis still the generated default"no_key". The resulting 401 aborted the whole run, and it did so after hashing had completed, discarding several minutes of work on large packs.The lookup is now skipped when no key is configured, and any error degrades to
None. The caller already handles a falsy result (if tvdb_result:), and uploads complete with the TMDB id alone — a series upload to a UNIT3D tracker is accepted withouttvdb_id.Testing
python -m py_compileon all three touched files.