KBlixt / subcleaner

removes ads from subtitle files cleanly.
288 stars 13 forks source link

Feature: Package as a library #61

Open stumpylog opened 3 months ago

stumpylog commented 3 months ago

I would like to integrate this cleaning into one of my own projects. To do so, it would be beneficial to package and release this tool onto PyPi and provide a standardized API for other tools to clean/check subtitles. The command line entry point can still be maintained using entry points, though the invocation may need to change for users, meaning this could be considered a breaking change.

KBlixt commented 3 months ago

Interesting, what kind of project are you planing if you don't mind me asking?

in order to do this I'd essentially break up the current project in two parts. the core and CLI with that core. the core essentially does everything the project is supposed to do and having config being part of the package and the args being used as the arguments for the main entrypoint. and the cli part would essentially just translate the subcleaner.conf into the package settings and use the cli arguments as the arguments going into the main entrypoint.

doing this would require a bit of time. not a lot of time. but at least an evening of development and verifying it works. I might consider doing this later in the year during the winter part. but for now if you want this done you'd have to take the initative. but this way the current way of using the program wouldn't change.

the subcleaner module have a subpackage called settings containing args and config. these are the ones you need to change by turning things into functions rather than a procedural read from the arg and config. you'd probably be wise to add a entrypoint somewhere appropriate where you can define the arguments that you send into the functions in args/config.

let me know if you give it a try. but until winter I won't take on this request.