mmguero / cleanvid

cleanvid is a little script to mute profanity in video files
BSD 3-Clause "New" or "Revised" License
56 stars 6 forks source link

Feature request: integrate with Plex #9

Closed jadams777 closed 1 year ago

jadams777 commented 2 years ago

Your tool looks amazing. Can you please integrate it with Plex? I would love to mute profanity while watching videos with Plex.

https://www.plex.tv/ https://github.com/pkkid/python-plexapi https://python-plexapi.readthedocs.io/en/latest/

https://www.reddit.com/r/PleX/comments/orbdby/plex_github_project_to_censor_profanity/ "I cant say that it would be possible for remote clients, or when playing shared content, but if someone is playing content on a plex client that is on the same network as the server then this is technically possible without plugins, assuming you have subtitle files that are in sync with the media. It is pretty much the same thing as how the automatic intro skippers work, only instead of skipping forward the intro length you do client.mute and client.setSubtitleStream actions, followed by the reverse after however long you want those off. Projects like the python plex api can be used to help control plex clients and poll what is playing. I cant recommend anything for scanning a subtitle file for keywords and getting the timestamp of where it happens, but odds are with how common subtitles are that there's a project or 5 already out there just for that purpose. I'd be using this type setup for a "movie dialog game" instead of to "censor profanity," and have something like the corner light flash red for a few seconds 5 or 10 seconds before a muted scene so I'd know to be ready for the next "improv section," but to each their own. No reason you cant host your creation on github."

mmguero commented 2 years ago

Thanks for the suggestion! I don't have the cycles at the moment to dig into this but I'll keep it on the "todo" list for sure.

mmguero commented 2 years ago

While I don't think directly integrating with plex is in the scope of what I want to tackle with this project, I did just learn about PlexAutoSkip which already has the framework in place to do this sort of thing. I asked about the possibility of extending that project to allow using the plex API to set the volume to 0 and then restore it (see mdhiggins/PlexAutoSkip#18) and the developer's responded with a commit that does seem to allow this. As such, I can add an option to cleanvid to generate a custom JSON file that can be placed in the config directory of PlexAutoSkip and mute/unmute at the appropriate time codes (this option would imply --subs-only as well, as it wouldn't touch the video file).

However, note that as the developer of that project says, not all Plex clients support the set volume API. So YMMV even once this is done.

mmguero commented 1 year ago

The plex-auto-skip-json stuff as described in the previous comment is probably all I'll be able to get to. Thanks, for the suggestion.