Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing multiple track at once doesn't produce the expected result #75

Open
azsde opened this issue Oct 13, 2022 · 2 comments
Open

Removing multiple track at once doesn't produce the expected result #75

azsde opened this issue Oct 13, 2022 · 2 comments

Comments

@azsde
Copy link

azsde commented Oct 13, 2022

Hello,

I have an MKV with a total of 8 tracks, I'm trying to remove 2 of them:

mkv = MKVFile('/path/to/file.mkv')
mkv.remove_track(5)
mkv.remove_track(7)
mkv.mux('/path/to/output.mkv')

The produced file has the track 5 successfully removed (it seems?) but the track 7 is still there and the track 8 has been removed but I wanted to keep it ...

Removing a single track seems to work however.

Is the removal of multiple tracks at once supposed to be working ?

@azsde
Copy link
Author

azsde commented Oct 13, 2022

After a quick debugging session, I found out why it is not behaving properly.

The removal of the tracks is done by calling:

del self.tracks[track_num]

This causes the indexes to be updated, thus when calling again mkv.remove_track, the index is not valid anymore.

IMO, the code should be updated not only to be resilient to this use case, but also to avoid removing tracks using their indexes but rather their ID.

azsde added a commit to azsde/pymkv that referenced this issue Oct 26, 2022
@azsde
Copy link
Author

azsde commented Oct 26, 2022

I made PR that fixes the issue, I'll let you decide if you want to merge it or not.

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

No branches or pull requests

1 participant