Skip to content

Refactor module to use object-oriented (OO) style #8

@gphg

Description

@gphg

Currently, the code is written using standalone functions, for example:

def compress_video(input_file, output_file=None, size=DEFAULT_TARGET_SIZE_MIB,
                    audio_bitrate=DEFAULT_AUDIO_BITRATE_KBPS, mute=False, speed=1.0,
                    start=None, end=None, fps=None, scale=None, cpu_priority=None,
                    prepend_filters=None, append_filters=None, rotate=None, keep_metadata=False,
                    hard_sub=False, target_web=False, info_detail=False, proto=False,
                    print_mode=False):
    """
    Compresses a video file to a target size using FFmpeg.
    """
    # ... the rest of logics ...

I am not experienced in Python, but the current approach works well for my use, as I wanted the module to be used mainly as a collection of functions. This way, I can import and use them easily in my own scripts.

However, would it be better to refactor the code to use Python classes and object-oriented (OO) style? I am open to suggestions or examples for making the code more modular, maintainable, or Pythonic while still supporting my use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions