Skip to content

[ignore_video_file_under_size] v0.0.4: fix NoneType crash + dead extension fallback - #512

Open
funkekaiser wants to merge 1 commit into
Unmanic:officialfrom
funkekaiser:pr-ignore_video_file_under_size
Open

[ignore_video_file_under_size] v0.0.4: fix NoneType crash + dead extension fallback#512
funkekaiser wants to merge 1 commit into
Unmanic:officialfrom
funkekaiser:pr-ignore_video_file_under_size

Conversation

@funkekaiser

Copy link
Copy Markdown

Problem

Two bugs in on_library_management_file_test:

  1. TypeError: argument of type 'NoneType' is not iterablemimetypes.guess_type() returns None for unknown extensions (e.g. transient .unmanic.part files during post-processing), and can also return None for valid media files when racing another plugin's mimetypes.init() call on Unmanic's concurrent file-tester threads (see Fix thread race: only call mimetypes.init() once Josh5/unmanic.plugin.helpers.ffmpeg#7 — the vendored helper lib re-inits the global mimetypes database on every Probe()). The crash aborts this plugin's file test for that file on every scan.

  2. Dead fallback branchos.path.splitext() returns extensions with a leading dot (".mp4"), so membership in the dot-less list ["mkv", "mp4", ...] never matches, and the known-video-extension check is unreachable.

Fix

  • Treat a None mimetype like any other non-video mimetype instead of crashing.
  • Normalise the extension (.lstrip(".").lower()) so the fallback works as intended.

Version bumped to 0.0.4 with changelog entries.

🤖 Generated with Claude Code

Fix TypeError crash when mimetypes.guess_type() returns None. guess_type()
returns None for unknown extensions, and can also return None for valid
media files when racing another plugin's mimetypes.init() call on Unmanic's
concurrent file-tester threads. The crash aborted the whole file-test
runner for that file on every scan.

Also fix the known-video-extension fallback: os.path.splitext() returns
extensions with a leading dot ('.mp4'), so membership in the dot-less list
could never match, making the branch dead code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@funkekaiser

Copy link
Copy Markdown
Author

Testing note (per CONTRIBUTING quality control): verified against Unmanic 0.4.0+e838573 (latest release + master, josh5/unmanic:latest) on a live ~17TB library: 4 concurrent file testers + 3 QSV workers. No new python files are introduced by this PR, only modifications to existing ones, so no new file headers were added. Happy to adjust anything to fit the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant