Giter Site home page Giter Site logo

gitbib / pymkv2 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 1.17 MB

A Python wrapper for mkvmerge. It provides support for muxing, splitting, linking, chapters, tags, and attachments through the use of mkvmerge.

Home Page: https://gitbib.github.io/pymkv2/

License: MIT License

Python 98.91% Makefile 1.09%
mkvmerge mkvtoolnix muxer

pymkv2's People

Contributors

gitbib avatar goldbergdata avatar joshuaavalon avatar rubo3 avatar sebitr avatar sheldonkwoodward avatar smahot avatar

Stargazers

 avatar  avatar

Watchers

 avatar

pymkv2's Issues

mux function could support a way to output its progress

Is your enhancement request related to a problem? Please describe.
When muxing something with mkvmerge it outputs the current progress in percent.
The current implementation of mux does not seem to support that information, which would be great to have, especially when running async or when muxing large files.

Describe the solution you'd like
Having an event function in the main object, which returns the progress, which is called when new progress information arrives.

Example:

mkv = MKVFile('/path/to/file.mkv')
mkv.remove_track(0)
mkv.mux('/path/to/output.mkv', gui.set_current_progress)

or

mkv = MKVFile('/path/to/file.mkv')
mkv.remove_track(0)
mkv.connect_event_new_progress(gui.set_current_progress)
mkv.mux('/path/to/output.mkv')

Implementation steps

  • Look at the output of mkvmerge and find a way to grab that information
  • Interpret that data
  • Add an event function which is called on new progress and returns that data
  • Add a variable to hold the connected function and a setter function to connect an external function to that event function

Additional context
I implemented something similar a few years ago, which still works, but the code is more a proof of concept, than a good implementation. It can be found here.
That function is used in combination with a gui progress bar.

Let me know, if you want help implementing this and the enhancement request from yesterday.

mkvmerge_path str parameter can be limiting

Is your enhancement request related to a problem? Please describe.
Using the mkvmerge_path parameter (for example in verify_mkvmerge) can be limiting, if mkvmerge is not directly accessible and needs parameters to run.

One example would be flatpak run org.bunkus.mkvtoolnix-gui mkvmerge.

The subprocess function (in pymkv/Verifications.py line 20) would not accept this:
sp.check_output(['flatpak run org.bunkus.mkvtoolnix-gui mkvmerge', '-V']).decode()

It would be necessary to append to the list, to have something like that:
sp.check_output(['flatpak', 'run', 'org.bunkus.mkvtoolnix-gui', 'mkvmerge', '-V']).decode()

Describe the solution you'd like
It would be great to have a parameter with a list of strings for the mkvmerge path.
It could also be some sort of function to split the str into a list, which then gets appended to the subprocess function parameter.

Implementation steps

  • Find all functions with a mkvmerge_path parameter.
  • Replace/add a new parameter which would allow to use a list (or something similar).

Additional context

2.0.5: default mkvmerge_path regression

Describe the bug
MKVFile without specifying mkvmerge_path seems broken in 2.0.5.

To Reproduce
mkv = MKVFile(title=f'my_title')

Expected behavior
No error.

Screenshots

Traceback (most recent call last):
  File "C:\my_script.py", line 131, in <module>
    mkv = MKVFile(title=f'my_title')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\AppData\Roaming\Python\Python312\site-packages\pymkv\MKVFile.py", line 111, in __init__
    if not verify_supported(file_path, mkvmerge_path=self.mkvmerge_path):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\AppData\Roaming\Python\Python312\site-packages\pymkv\Verifications.py", line 187, in verify_supported
    file_path = verify_file_path_and_mkvmerge(file_path, mkvmerge_path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\AppData\Roaming\Python\Python312\site-packages\pymkv\Verifications.py", line 135, in verify_file_path_and_mkvmerge
    return checking_file_path(file_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\AppData\Roaming\Python\Python312\site-packages\pymkv\Verifications.py", line 33, in checking_file_path
    raise TypeError(msg)
TypeError: "None" is not of type str

Software (please complete the following information):

  • OS: Windows 11 23H2
  • MKVToolNix version v85.0

Additional context
Does not occur in 2.0.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.