Thread Rating:
  • 2 Vote(s) - 3 Average
[PRE-RELEASE] Mute Profanity
I've created a plugin that is designed to mute profanity in your movie library. It works by comparing the movie's subtitle file against your filter file. When a match is found, XBMC will mute the audio for the duration of the word.

Download it:
Source code:

How to use it:
Install the add-on by unzipping to XBMC's addons folder. Plugin can be found in video add-ons. Once started you will see your movie collection. When you select a movie, the add-on will try to find the subtitle file for that movie. If you don't have one, it will ask if you'd like to download one. After a very brief processing time, it will complete and you then play the movie normally. You will notice that the blocked words are muted!

Configuration Details:
Since the subtitle file and not the audio itself is analyzed, you will notice that the mute times are not always exact. The script is only guessing when the blocked word is spoken, and it can be wrong sometimes. This add-on includes a setting which specifies the amount of time in milliseconds before and after the time of the blocked word that XBMC should start and end the mute. By default, this is 250ms, but can be adjusted for more or less time, depending on preferences.

It's important to have an accurate subtitles file, with correct timings. If you notice that your subtitles show up too early or too late, the script will mute too early or too late as well. Even with max timing settings, the plugin will not mute before or after the subtitle is no longer displayed.

After you download and install the application, the list of blocked words is found in the script directory under "resources"->"filter.txt". Each word should be on it's own line. Change this file as you see fit, but remember spaces matter. For example you might want to filter "asswipe" but not "class". You'll notice my filter file contains spaces for this reason (and they are important).

How it works:
XBMC has built-in the ability to read a EDL file (Edit Decision List) and process it accordingly. The script will create this file, which contains the timestamps of when mutes should occur. Again, this calculation is found from processing the subtitles file of the movie being 'edited'. My script currently only handles SRT subtitle files. If no SRT file could be found, the add-on will attempt to download one based on the name of the file from If one could not be found, the script will fail. If you really, really need to mute a movie and it's not working, I suggest you download the SRT file separately, ensure that it works, then re-run my script to mute the profanity.

Possible Future Additions:
As this is a work in progress, I've started to come up with a list of features that one might find helpful with an add-on like this one:
* Edit the filter file in settings menu
* Multiple filter levels (little kids, young adults, etc)
* TV Shows option
* Much more...

What I need from you:
I've only tested this on one Windows machine, with only a few movies. I need more testers and suggestions. I have a list of features I'd like to implement in the future but would like to hear from the community as well. What features are most important to you?

One more note:
This add-on is not for everyone, I dare say not even for most. If you don't want to mute profanity, please don't use this add-on. This might come to a shock to a lot of people, but different people have different opinions, and they both can be valid. Just because you feel one way or another doesn't mean you're "right" and the other person is "wrong". If you want to use this that great, and if you don't that's great also.

hell yeah! that's fucking awesome.
Wow looks nice. For some reason I've shied away from "super automatic" subtitle download, but this does look convenient (of course, having a working library with sensible cinema would be even better). I assume you've used Sensible Cinema so you know that sometimes it's problematic to find subtitles that line up right...

Speaking of which, I wonder how hard it would be to have XBMC play an EDL file for a DVD--I haven't seen it yet.
Hey, I just realized I could invert this to skip the boring parts of porn and go straight to the good stuff!

Yes, finding correct subtitles are difficult to say the least. However, automatic subtitle download isn't my primary motivation for this plugin. I have looked at Sensible Cinema, and it looks great, however I don't use DVDs, I pretty much exclusively use XBMC for my movie watching. I didn't realize that Sensible Cinema even had a automatic subtitle to filter option til a few days ago. But that's what I wanted the most in an XBMC plugin. It seems like it would be real easy to make my code work with Sensible Cinema, as well as I could have probably used your code to create a XBMC edl file.

Now we need to convince ClearPlay to release their filters for the public to fully automate the system...
(2012-05-16, 19:50)Bstrdsmkr Wrote: Hey, I just realized I could invert this to skip the boring parts of porn and go straight to the good stuff!

Actually no, you can't. Inverting this wouldn't 'skip' anything, only mute out everything that's not a cuss word. Which would make your porn more boring.
lol, not directly, but where you mute, I would seek. I'd also have to find a list of "scenes" somewhere lol

Although now that I think about it, that could potentially be a useful feature in regular videos. Hmmm.....
(2012-05-04, 10:12)spiff Wrote: hell yeah! that's ******* awesome.


For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager

(2012-05-17, 01:27)giftie Wrote:
(2012-05-04, 10:12)spiff Wrote: ****l yeah! that's ******* awesome.


Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
How does this work with .iso files? Most of my library 500+ are .iso files. I prefer those to the .avi mostly because it doesn't lose quality from the original and I don't have to worry about subtitles and things not being included. I am using an Apple TV 2 with the XBMC EDEN 11. I have downloaded a .srt file for Kill Bill (great movie) but when I try to run the script it says that it can't find the file. I wonder if it can't find it because the movie is a .iso.

Any thoughts?

UPDATE: It appears to do the same thing with .avi files. The addon doesn't seem to find the subtitle file (even though there is a .srt in the same folder correctly named) and then it tries to download one and fails. Anyone else having this same issue?

I also just created my own simple .edl file to try this out. I can't figure out how to enable XBMC to recognize the .edl file. How do you turn that on?
I have xbmc (11.0) on a MAC (10.6.8).
I manually copied the plugin to the addons folder, closed XBMC and restarted it.
When I try to run the script, it says there is an error with the script.

Is there something i'm missing?
If there is a log file I can send let me know.

Thank you
"I manually copied the plugin to the addons folder"

Install the zipped script from the addon manager - it may have dependencies that need installing etc.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

So I installed this a few days ago but I have been unable to get it working and I believe it is because I have my xbmc setup for multiple head units and because of this I use smb paths for all my files. Even if I download an srt file manually the addon will not find it and will fail trying to download the srt. Here is the data from the xbmc.log file:

23:32:12 T:2608 NOTICE: -->Python Interpreter Initialized<--
23:32:12 T:2608 NOTICE: movieid: 364
23:32:12 T:2608 NOTICE: movie details call response: {"id":1,"jsonrpc":"2.0","result":{"moviedetails":{"file":"smb://HTPC/Movies/Knight and Day/Knight and Day (2010).mkv","label":"Knight and Day","movieid":364,"title":"Knight and Day"}}}
23:32:12 T:2608 NOTICE: details: {'title': 'Knight and Day', 'movieid': 364, 'file': 'smb://HTPC/Movies/Knight and Day/Knight and Day (2010).mkv', 'label': 'Knight and Day'}
23:32:14 T:2608 NOTICE: head: smb://HTPC/Movies/Knight and Day/Knight and Day (2010)
23:32:14 T:2608 NOTICE: No srt file!
23:32:16 T:2608 NOTICE: Downloading
23:32:16 T:2608 NOTICE: Contacting (smb://HTPC/Movies/Knight and Day/Knight and Day (2010).mkv)
23:32:16 T:2608 NOTICE: Traceback (most recent call last):
File "C:\Users\StephenM\AppData\Roaming\XBMC\addons\\", line 126, in <module>
File "C:\Users\StephenM\AppData\Roaming\XBMC\addons\\resources\lib\", line 22, in FindSubtitles
data = GetSubtitles(videoname);
File "C:\Users\StephenM\AppData\Roaming\XBMC\addons\\resources\lib\", line 42, in GetSubtitles
moviebytesize = os.path.getsize(moviepath)
File "C:\Program Files (x86)\XBMC\system\python\Lib\", line 49, in getsize
return os.stat(filename).st_size
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'smb://HTPC/Movies/Knight and Day/Knight and Day (2010).mkv'

I might try to dig into the code when I get some time to help but python is not my strong suit so I might not be of much help. Let me know if you want me to try something.

Thanks for this good start!

Sorry for not replying earlier. Since I don't have your logs, I can only guess what's going on with your setup, but here it goes:

1. I never tested any ISO files, but as long as there is an external subtitle srt file I can't think of any reason why it wouldn't work. I will test this when I can. (Need to confirm XBMC will handle edl files for ISO media)
2. The name of the srt file is very strict. It must be in the same folder with the same name as the movie, except a different extension (.srt)
3. XBMC will automatically use the .edl file you created as long as it follows the same strict naming convention above (same name as movie, but extension is .edl)

Thanks to mathmansteve, I realized that I don't support smb paths, if that's what you've got setup, it might not work either. I'll work on a fix for that soon.

Thanks everyone for the posts and I'll try to respond sooner!
As always, log files are always invaluable with fixing bugs. Anyone using this plugin that's running into unexpected errors, please include the relevant lines in xbmc.log, or use pastebin, etc.
I think this is a great idea. I'm eager to try it out. Have you made any progress on this? I'd be happy to help test it out if you need testers
No additional progress; it's been a busy summer. However, feel free to test now and let me know what bugs you find. Unless you're using smb shares, you should be able to try it out now.

The other bug reported was a user not being able to find the subtitle file. Does anyone know exactly how XBMC determines which subtitle file to use for any given movie? Or better yet, is there a way to call into that function from the python side? I'd hate to duplicate an already existing function in XBMC, but I don't think it's part of the python API yet.

[PRE-RELEASE] Mute Profanity32