Repository navigation
[FIX] Parse MediaInfo XML that has only one track - #1296
Open
WadekarPrashant wants to merge 1 commit into
Open
WadekarPrashant wants to merge 1 commit into
WadekarPrashant wants to merge 1 commit into
Conversation
xmltodict returns a lone <track> as a mapping, so iterating it yielded the track's keys instead of the track. Wrap a mapping in a list before the loop.
WadekarPrashant
requested review from
canihavesomecoffee and
thealphadollar
as code owners
December 1, 2026 10:23
|
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.



Closes #1295
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Cause:
xmltodictdecodes a single<track>element as a mapping and several as a list.MediaInfoFetcher._process_trackslooped overfile_info['track']directly, so with one track (for example a truncated MP4 where MediaInfo recovers only the General track) it iterated the mapping's keys._process_trackreceived strings such as'@type'and'Format', skipped each one as a non-dict, andgeneral_trackstayed{}.Change:
_process_trackswraps the value in a one-element list when it is a mapping, then loops as before. The multi-track path is unchanged.Tests:
test__process_tracks_single_track: a lone General track given as a mapping populatesgeneral_track. Fails on master with{} != {'Format': 'MPEG-4', 'FileSize': '1.0 MB'}; passes with this change.test__process_tracks_multiple_tracks: a General + Video list is still parsed track by track. This guards the list case: it fails if the normalisation wraps a list by mistake.The existing
InvalidMediaInfoErrortests for missingmediaand missingtrackstill pass.