Jump to content

Plugin - "Potty Mouth" - Mute recordings audio for selected word list.


BillOatman

Recommended Posts

BillOatman

This plugin has been used by a couple people but should be considered beta.

You can get more information on the plugin and it's companion utility, the source for each, and the executables at this Github page.
 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

  • 7 months later...
  • 2 months later...
gene0915

Hi Bill, love your addon but ran into a problem (maybe parsing error?)

I was testing with Stranger Things S04E01. 

Looking at the EDL file, it correctly muted Joyce when she said 'prick' at 652 seconds in but a few minutes later, the following text is spoken and not muted:

00:13:40,653 --> 00:13:43,322 "-The hell are you doing? It's ten after. -Oh, shit. Shit!"

Is this a parsing error of some sort and wasn't caught because too many swear words were used in rapid succession?

Here's the current EDL file:

652.69	653.53	1
1263.05	1266.56	1
2045.42	2047.30	1
2159.16	2159.99	1
2256.38	2258.17	1
2297.96	2301.84	1
2941.19	2943.61	1
3053.72	3055.97	1
3078.70	3079.70	1
3349.43	3350.89	1
3697.99	3702.07	1
3702.16	3704.87	1

Here's the chunk of the SRT file in question:

104
00:13:36,649 --> 00:13:38,192
<i>Love, El.</i>

105
00:13:40,653 --> 00:13:43,322
-The hell are you doing? It's ten after.
-Oh, shit. Shit!

106
00:13:43,405 --> 00:13:45,449
Thirty seconds
or I'm leaving without you, okay?

 

Thanks!

 

Link to comment
Share on other sites

BillOatman
1 hour ago, gene0915 said:

Hi Bill, love your addon but ran into a problem (maybe parsing error?)

I was testing with Stranger Things S04E01. 

Looking at the EDL file, it correctly muted Joyce when she said 'prick' at 652 seconds in but a few minutes later, the following text is spoken and not muted:

00:13:40,653 --> 00:13:43,322 "-The hell are you doing? It's ten after. -Oh, shit. Shit!"

Is this a parsing error of some sort and wasn't caught because too many swear words were used in rapid succession?

Here's the current EDL file:

652.69	653.53	1
1263.05	1266.56	1
2045.42	2047.30	1
2159.16	2159.99	1
2256.38	2258.17	1
2297.96	2301.84	1
2941.19	2943.61	1
3053.72	3055.97	1
3078.70	3079.70	1
3349.43	3350.89	1
3697.99	3702.07	1
3702.16	3704.87	1

Here's the chunk of the SRT file in question:

104
00:13:36,649 --> 00:13:38,192
<i>Love, El.</i>

105
00:13:40,653 --> 00:13:43,322
-The hell are you doing? It's ten after.
-Oh, shit. Shit!

106
00:13:43,405 --> 00:13:45,449
Thirty seconds
or I'm leaving without you, okay?

 

Thanks!

 

Ha believe it or not its easier than that.  On line 690 of the muted list you will see

shit|poop

Make it 

shit
poop

and good to go :)

Link to comment
Share on other sites

gene0915
On 5/9/2023 at 6:26 PM, BillOatman said:

Ha believe it or not its easier than that.  On line 690 of the muted list you will see

shit|poop

Make it 

shit
poop

and good to go :)

That did the trick, thanks!

If you're been asked this before, my apologizes but..... is it technically possible to make your amazing plug-in do its' magic in real time? (Like reading the subs from an MKV as it's being played and dynamically create the EDL file on the fly?)

Link to comment
Share on other sites

BillOatman
16 hours ago, gene0915 said:

That did the trick, thanks!

If you're been asked this before, my apologizes but..... is it technically possible to make your amazing plug-in do its' magic in real time? (Like reading the subs from an MKV as it's being played and dynamically create the EDL file on the fly?)

Yes but it would need to be in core Emby.  Plugins don't have fine enough control over video and audio. 

Link to comment
Share on other sites

  • 6 months later...
CarneAsada

Question, anyway to pipe in the VirtualTV plugin through this to mute exsisting media? The VirtualTV plugin pulls from the library; maybe even make it write-back to the media and santize a library? Just a thought anyways. Thanks for creating this! Love the idea.

Link to comment
Share on other sites

BillOatman
On 12/6/2023 at 6:39 PM, CarneAsada said:

Question, anyway to pipe in the VirtualTV plugin through this to mute exsisting media? The VirtualTV plugin pulls from the library; maybe even make it write-back to the media and santize a library? Just a thought anyways. Thanks for creating this! Love the idea.

If you create the EDL files with the companion app and the SessionManager playback events get fired when the  VirtualTV plugin plays the video it should work fine.  Otherwise it will not.

I believe there are stand alone applications available that do what this plugin does, but saves the files with the audio muted. But I have not used any of them.

Link to comment
Share on other sites

  • 1 month later...
BillOatman

Can't modify first post, so the new release is here.

When you switch to Emby 4.8 you will want to use this version.

Link to comment
Share on other sites

sydlexius

Hi @BillOatman,

I have a couple of enhancement requests for you.  The first is whether this plugin can be configured to have per-user settings?  I'm not too picky about having auto-muting, but I have users on my profile that'll stop watching a show if they don't like the language.

The second is if you can provide some guidance on how to automate the use of PMFileGenerator?  Do you recommend using ScripterX or some other means to call it?  I ended up (having ChatGPT) write a Python3 script that takes a base path and mutefile path as arguments, then recursively search for SRTs to feed PMFileGenerator...it's very rudimentary (not much in the way of error handling, and it'll clobber existing .muted/mutedFull.srt files).  For your amusement:

#!/usr/bin/env python3
import os
import subprocess
import argparse
import shlex

def find_srt_files(directory):
    """
    Recursively search for .srt files in the given directory.
    
    :param directory: The base path to search for .srt files.
    :return: A generator yielding paths to .srt files.
    """
    for root, dirs, files in os.walk(directory):
        for file in files:
            if file.endswith('.srt'):
                yield os.path.join(root, file)

def run_pmfilegenerator(srt_path, mute_file):
    """
    Run the PMFileGenerator command with the given .srt file and mute file.
    
    :param srt_path: The path to the .srt file.
    :param mute_file: The path to the mute file.
    """
    # Determine the directory of the current script to find PMFileGenerator
    script_dir = os.path.dirname(os.path.realpath(__file__))
    pmfilegenerator_path = os.path.join(script_dir, "PMFileGenerator")

    # Quote paths to handle spaces and special characters
    quoted_srt_path = shlex.quote(srt_path)
    quoted_mute_file = shlex.quote(mute_file)
    quoted_pmfilegenerator_path = shlex.quote(pmfilegenerator_path)

    command = f"{quoted_pmfilegenerator_path} {quoted_srt_path} {quoted_mute_file}"
    subprocess.run(command, shell=True)

def main():
    parser = argparse.ArgumentParser(description="Search for .srt files and process them with PMFileGenerator.")
    parser.add_argument("base_path", help="The base path to search for .srt files.")
    parser.add_argument("mute_file", help="The path to the mute file.")
    
    args = parser.parse_args()
    
    for srt_file in find_srt_files(args.base_path):
        run_pmfilegenerator(srt_file, args.mute_file)
        print(f"Processed: {srt_file}")

if __name__ == "__main__":
    main()

# usage srtfind.py /path/to/srtfiles /path/to/mutelist

 

Link to comment
Share on other sites

sydlexius

Hmm, having run this twice, I have a bug to report with PMFileGenerator in that it'll process .muted.srt and .mutedFull.srt, generating fun variants like .muted.muted.srt, .muted.mutedFull.srt, etc...heaven help you if you run it a 3rd time (something, something...exponential growth...).  You might want to filter/sanity check for filenames with those patterns.

Link to comment
Share on other sites

BillOatman
On 2/7/2024 at 11:23 PM, sydlexius said:

Hmm, having run this twice, I have a bug to report with PMFileGenerator in that it'll process .muted.srt and .mutedFull.srt, generating fun variants like .muted.muted.srt, .muted.mutedFull.srt, etc...heaven help you if you run it a 3rd time (something, something...exponential growth...).  You might want to filter/sanity check for filenames with those patterns.

PMFileGenerator takes a singular SRT file and does its work. I suspect the behavior you describe is coming from your script and it should be handled there.

Making PM operate on a per user basis is possible. I have no idea when I might have time to do it though.  It is open source so someone else is free to do that as well.

Link to comment
Share on other sites

crookedmosquito

Has anyone had any issues playing on Apple TV?  I was able to play content on my iphone and it mutes the words out but on the Apple TV it didn't work.  Trying to see if there is a known issue.

Link to comment
Share on other sites

BillOatman
19 hours ago, crookedmosquito said:

Has anyone had any issues playing on Apple TV?  I was able to play content on my iphone and it mutes the words out but on the Apple TV it didn't work.  Trying to see if there is a known issue.

If you turn on debug logging on your server and play something on your ATV past a word in your mute list, the log should tell you if there was a problem.

Edited by BillOatman
Link to comment
Share on other sites

  • 1 month later...
BillOatman

New release.  

Quote

Changed behavior so even after a rewind, undesired words will be muted.
Updated to latest Emby library.

Source and binary updated here.

Link to comment
Share on other sites

gene0915
On 3/24/2024 at 5:03 PM, BillOatman said:

New release.  

Source and binary updated here.

Thank you for your continued work on this app!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...