Jump to content

Profanity filtering (muting)


wowsers

Recommended Posts

seanfletcher255
On 8/28/2018 at 12:26 AM, Luke said:

Hi, while I think this is a neat idea, I'm not sure when we'll ever be able to prioritize it ahead of other features. 

 

First, before you could even think about muting the audio, you need a database of voice data for every single video in your library. Then a player could read that data and mute accordingly. But does anything even exist to create that kind of data? I'm really not sure.

here is some php code that tries to read in an srt file then parse it for the word and create a mute codes for a n EDL file

<?php
include(__DIR__ . "/../functions.php");
//error_reporting(2047);
$srt    = $argv[2];
$words  = explode(",",$argv[1]);
$parts = fletch_parse_srt_file($srt);
$SaveTo = (empty($argv[2])) ? 'php://stdout' : ffat_get_filename($argv[2]) . '.edl';

foreach($parts as $sub)
{
 
    foreach($words as $word)
    {
    /*If $word is not in the subtitle then continue on*/
        if(strpos($sub['Text'],$word) !== false )
        {
    foreach($sub['Words'] as $wordArray)
    {
    if(preg_match('#'.preg_quote($word,'#i').'#',$wordArray['Word']) > 0)
        {
            $startTime = fletch_convert_time($wordArray['Pos_Start']); // this function just converts the timestamp to seconds
            $stopTime  = fletch_convert_time($wordArray['Pos_End']);// this function just converts the timestamp to seconds
            fletch_flix_write_edl($SaveTo,$startTime,$stopTime,"1"); // does the actual writing of the edl file
        }
    }
        }
    }
}
?>


<?php
function fletch_parse_srt_file($File)
{
    $lines = preg_split("#\r\n\s#Uis",file_get_contents($File));

    $i = 1;
    foreach($lines as $line)
    {
        if (!empty(trim($line))) {
            
            $count = count(explode("\n",$line));
            if($count >= 4)
            {
                @list($Crap, $ID, $TimeCode, $TextLine1, $TextLine2) = explode("\n", $line);
            } else {
                @list($ID, $TimeCode, $TextLine1) = explode("\n", $line);
            }
            @list($StartRaw, $EndRaw) = explode("-", str_replace(" --> ", "-", $TimeCode));
            @list($Start, $Micro) = explode(",", $StartRaw);
            @list($End, $Micro)   = explode(",", $EndRaw);
            $array[$i]['ID']            = trim($ID);
            $array[$i]['TimeCode']      = trim($TimeCode);
            $array[$i]['TimeStart']     = $Start;
            $array[$i]['TimeEnd']       = $End;
            $array[$i]['Text1']         = trim($TextLine1);
        if($count >= 4) {
                $array[$i]['Text2']         = trim($TextLine2);
            }
            $array[$i]['Text']          = strip_tags(trim($TextLine1) . ' ' . trim($TextLine2 ?? ''));
            $array[$i]['SubTitleSize']  = $count;
            $tmp                        = explode(" ", $array[$i]['Text']);
        //die(print_r($tmp,true));

        $j=0;
            foreach ($tmp as $Word) {
                $Word = str_replace(array(',',"'",'"','?','-','!','.'), "", $Word);
                if (!empty($Word)) {
                    $array[$i]['Words'][$j]['Length']    = strlen($Word);
                    $array[$i]['Words'][$j]['Pos_Start'] = fletch_format_time(fletch_convert_time($Start)+strpos($array[$i]['Text'], $Word), 'timecode');
                    $array[$i]['Words'][$j]['Pos_End']   = fletch_format_time(fletch_convert_time($Start)+strpos($array[$i]['Text'], $Word)+fletch_convert_time($array[$i]['Words'][$j]['Length']), 'timecode');
                    $array[$i]['Words'][$j]['Word']   = $Word;
                }
        $j++;
            }

            $i++;
        }
    }
return $array;
}

?>

kodi supports edls doing this same thing but emby has more features for me so thats why i am with emby not kodi but anyway

Link to comment
Share on other sites

roaku
11 hours ago, tmurphy2792 said:

@BillOatmanThanks for the feedback.

So I continued to play with them last night and came to the unfortunate realization that because I use roku devices for the vast majority of my watching, neither of these plugins will work for me.
I can be watching from a web browser and have it skip and mute beautifully, but the roku devices play the stream completely uninterrupted without skips or mutes.
To my understanding from finding some of your other posts, this is a limitation of the client app, correct?

MKVToolNix: Thanks for that suggestion, want to say I've played with this one in the past. I'll test to see if it works with the .TS files I'm receiving from my over the air antenna.

I don't use the profanity plugin, but I do use comskipper and have no issues with it working on Roku.

  • Thanks 1
Link to comment
Share on other sites

11 hours ago, roaku said:

I don't use the profanity plugin, but I do use comskipper and have no issues with it working on Roku.

Right it should work fine on Roku as long as it is the local LAN.  Roku does not allow remote control off network though.

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

BillOatman
On 1/1/2024 at 10:26 AM, tmurphy2792 said:

@BillOatmanThanks for the feedback.

So I continued to play with them last night and came to the unfortunate realization that because I use roku devices for the vast majority of my watching, neither of these plugins will work for me.
I can be watching from a web browser and have it skip and mute beautifully, but the roku devices play the stream completely uninterrupted without skips or mutes.
To my understanding from finding some of your other posts, this is a limitation of the client app, correct?

MKVToolNix: Thanks for that suggestion, want to say I've played with this one in the past. I'll test to see if it works with the .TS files I'm receiving from my over the air antenna.

Based on the posts above, your Roku should work as long as it is on the same network as the server. PottyMouth and Comskipper both use the same commands to skip forward, so the Roku should be fine for both plugins.  After verifying your Roku Emby client is at the latest version, if you cannot get it to work:

  • Turn debug logging on in the server.
  • Play a video past where it should have skipped a undesired word.
  • Send me the log file, about what time you played the video, and the EDL file, and the srt files for the video generated by PMFileGenerator.
  • Turn off debug logging.

 

Edited by BillOatman
Link to comment
Share on other sites

rbjtech
59 minutes ago, BillOatman said:

Based on the posts above, your Roku should work as long as it is on the same network as the server. PottyMouth and Comskipper both use the same commands to skip forward, so the Roku should be fine for both plugins.  After verifying your Roku Emby client is at the latest version, if you cannot get it to work:

  • Turn debug logging on in the server.
  • Play a video past where it should have skipped a undesired word.
  • Send me the log file, about what time you played the video, and the EDL file, and the srt files for the video generated by PMFileGenerator.
  • Turn off debug logging.

 

Do you use the same API call as Introskip did @BillOatman? - As i seem to recall you developing this the same time as @chef+ @Cheesegeezer(and I) did for the original Introskip plugin ?

If yes, does that also mean Introskip does not work remotely on the Roku ?  If no, how is the Core achieving what the Plugin did not - re skip to position x remotely on the Roku ?

Link to comment
Share on other sites

3 hours ago, rbjtech said:

does that also mean Introskip does not work remotely on the Roku ?

If it is trying to send remote commands, then yes.  Roku does not allow any remote control that is not originating on the local network.  Security thing for them.

3 hours ago, rbjtech said:

how is the Core achieving what the Plugin did not

Each app has the logic built in so no remote control is necessary.

  • Thanks 1
Link to comment
Share on other sites

BillOatman
6 hours ago, ebr said:

Each app has the logic built in so no remote control is necessary.

@rbjtechYes the original plugin did it the same way as comskipper and pottymouth.  But like ebr says, when it got moved into core they were not limited to the same things plugins are which explains why introskip works so smooth now.

  • Thanks 1
Link to comment
Share on other sites

The Roku does allow the video node to mute and unmute the audio during video playback. I am sure most devices allow the same. Perhaps in the future the pottymouth could be made to activate the mute/unmute of each app at the appropriate time in the same vein as each app handles intro skipping. That is possible and much better than just skipping past and causing seek delays. Would just need custom markers for the potty mouth entries so the app can tell them from chapters and intro/outro markers. Doing it this way would work on any Roku using either remote or local connections.

Edited by speechles
Link to comment
Share on other sites

rbjtech
6 hours ago, speechles said:

The Roku does allow the video node to mute and unmute the audio during video playback. I am sure most devices allow the same. Perhaps in the future the pottymouth could be made to activate the mute/unmute of each app at the appropriate time in the same vein as each app handles intro skipping. That is possible and much better than just skipping past and causing seek delays. Would just need custom markers for the potty mouth entries so the app can tell them from chapters and intro/outro markers. Doing it this way would work on any Roku using either remote or local connections.

Agreed and this is something originally discussed with the core team when the Core introskip decided to use 'hidden' chapter markers.   There is nothing to stop there being different types of markers - not only for Intro Start, Intro Stop, Credit Start, Credit Stop - but also some more advanced markers such as Mute Start, Mute Stop and even Recap Start, Recap Stop etc for those that want to skip recaps - if manually edited (Previously on ..) etc.

Unfortunately, there is still a lot missing from the Core Introskip installation vs the Plugin - such as editing, yes there are some Plugins that fill the gaps - but as the core framework 'could' easily add this more advanced functionality - it's a shame it has never been implemented.   Personally, I still use the Plugin with the hidden markers being written by the Plugin - thus using the Core 'skip' functionality, but the more advanced detection/editing capabilities of the Plugin.

6 hours ago, BillOatman said:

@rbjtechYes the original plugin did it the same way as comskipper and pottymouth.  But like ebr says, when it got moved into core they were not limited to the same things plugins are which explains why introskip works so smooth now.

Sure - this makes sense -  the Introskip Plugin writes the hidden markers as well (if that option is ticked) and thus I use the Core client to do the skipping.  Next episode skip has not yet been implemented however - so if you want it to skip to next episode on Credit Start, then you still need to use the Plugin.    I guess if the muting markers were ever implemented (in the core) then your Plugins could simply write them and let the client do all the work - and this remote Roku (or any client) issue would be resolved ?

Edited by rbjtech
  • Agree 1
Link to comment
Share on other sites

  • 3 weeks later...
tmurphy2792
On 1/2/2024 at 10:57 AM, BillOatman said:

Based on the posts above, your Roku should work as long as it is on the same network as the server. PottyMouth and Comskipper both use the same commands to skip forward, so the Roku should be fine for both plugins.  After verifying your Roku Emby client is at the latest version, if you cannot get it to work:

  • Turn debug logging on in the server.
  • Play a video past where it should have skipped a undesired word.
  • Send me the log file, about what time you played the video, and the EDL file, and the srt files for the video generated by PMFileGenerator.
  • Turn off debug logging.

 

Sorry for the delayed response Bill. Got back into the work swing after the new year and apparently missed these notifications.

So I had been initially testing by inserting arbitrary timestamps into the edl file generated by comskip. I've since taken the time to set up a batch file to trigger comskipper, CCExtractor, and PMFileGenerator. In attempting to do that though, I'm finding PMFileGenerator doesn't seem to want to work on my host machine (win10 mini PC) it runs for a spell till I run out of RAM then it stops with a message about running out of memory in the command window. Not sure what's up with that, but I hadn't put much effort into trying it on other machines since the plugin doesn't seem to want to work for me.

That being said, here are the files you requested. For testing I was using a live tv recording of Sons of Katie Elder and the .edl file was initially created by comskip. I then added the single mute line for testing PottyMouth extension. (I do not currently have comskipper installed as my initial idea was PottyMouth would be fill both needs).
To make it as easy as possible to read the debug file, I started playing the file as close to exactly 2024-01-20 16:58 as humanly possible.

 

Thanks again for the help

comskip manual.bat embyserver.txt The Sons of Katie Elder (1965).edl

Link to comment
Share on other sites

BillOatman
5 hours ago, tmurphy2792 said:

Sorry for the delayed response Bill. Got back into the work swing after the new year and apparently missed these notifications.

So I had been initially testing by inserting arbitrary timestamps into the edl file generated by comskip. I've since taken the time to set up a batch file to trigger comskipper, CCExtractor, and PMFileGenerator. In attempting to do that though, I'm finding PMFileGenerator doesn't seem to want to work on my host machine (win10 mini PC) it runs for a spell till I run out of RAM then it stops with a message about running out of memory in the command window. Not sure what's up with that, but I hadn't put much effort into trying it on other machines since the plugin doesn't seem to want to work for me.

That being said, here are the files you requested. For testing I was using a live tv recording of Sons of Katie Elder and the .edl file was initially created by comskip. I then added the single mute line for testing PottyMouth extension. (I do not currently have comskipper installed as my initial idea was PottyMouth would be fill both needs).
To make it as easy as possible to read the debug file, I started playing the file as close to exactly 2024-01-20 16:58 as humanly possible.

 

Thanks again for the help

comskip manual.bat 575 B · 0 downloads embyserver.txt 8.72 MB · 0 downloads The Sons of Katie Elder (1965).edl 333 B · 0 downloads

This was in the log file.

Quote

Info Potty Mouth: Playback Session 34bdb3d7bfe7e38245e288e28777af9b Path H:\LIVE TV\MOVIES\The Sons of Katie Elder (1965)\The Sons of Katie Elder (1965).ts. Mute is not supported.  Not possible to mute out the desired audio.

So your device is not able to mute the audio via the plugin command.

Curious about the out of memory error. Please send me a subtitle file that gives you the out of memory mehavior.

 

Link to comment
Share on other sites

Hi.  Please troubleshoot plugin problems in a separate thread.  Thanks.

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...