Skip to content

Commit

Permalink
remove some leftover volume filter that should have been removed when…
Browse files Browse the repository at this point in the history
… I added the afade filters
  • Loading branch information
mmguero committed Aug 26, 2023
1 parent 711880c commit ccc8242
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = cleanvid
version = 1.5.1
version = 1.5.2
author = Seth Grover
author_email = mero.mero.guero@gmail.com
description = cleanvid is a little script to mute profanity in video files.
Expand Down
2 changes: 1 addition & 1 deletion src/cleanvid/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""cleanvid is a little script to mute profanity in video files."""

__version__ = "1.5.1"
__version__ = "1.5.2"
__author__ = "Seth Grover <mero.mero.guero@gmail.com>"
__all__ = []

Expand Down
15 changes: 3 additions & 12 deletions src/cleanvid/cleanvid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import chardet
import codecs
import errno
import itertools
import json
import os
import shutil
Expand Down Expand Up @@ -33,13 +34,6 @@
PLEX_AUTO_SKIP_DEFAULT_CONFIG = '{"markers":{},"offsets":{},"tags":{},"allowed":{"users":[],"clients":[],"keys":[]},"blocked":{"users":[],"clients":[],"keys":[]},"clients":{},"mode":{}}'


# thanks https://docs.python.org/3/library/itertools.html#recipes
def pairwise(iterable):
a, b = tee(iterable)
next(b, None)
return zip(a, b)


######## GetFormatAndStreamInfo ###############################################
def GetFormatAndStreamInfo(vidFileSpec):
result = None
Expand Down Expand Up @@ -341,7 +335,7 @@ def CreateCleanSubAndMuteList(self):
# OR if the previous text contained profanity and lies within the pad ...
# then include the subtitle in the new set
prevNaughtySub = None
for sub, subPeek in pairwise(subs):
for sub, subPeek in itertools.pairwise(subs):
newText = replacer.sub(lambda x: self.swearsMap[x.group()], sub.text)
newTextPeek = (
replacer.sub(lambda x: self.swearsMap[x.group()], subPeek.text) if (subPeek is not None) else None
Expand Down Expand Up @@ -428,7 +422,7 @@ def CreateCleanSubAndMuteList(self):
plexDict["markers"][self.plexAutoSkipId] = []
plexDict["mode"][self.plexAutoSkipId] = "volume"

for timePair, timePairPeek in pairwise(newTimestampPairs):
for timePair, timePairPeek in itertools.pairwise(newTimestampPairs):
lineStart = (
(timePair[0].hour * 60.0 * 60.0)
+ (timePair[0].minute * 60.0)
Expand Down Expand Up @@ -465,9 +459,6 @@ def CreateCleanSubAndMuteList(self):
+ format(lineEnd, '.3f')
+ ":d=10ms"
)
self.muteTimeList.append(
"volume=enable='between(t," + format(lineStart, '.3f') + "," + format(lineEnd, '.3f') + ")':volume=0"
)
if self.edl:
edlLines.append(f"{format(lineStart, '.1f')}\t{format(lineEnd, '.3f')}\t1")
if plexDict:
Expand Down

0 comments on commit ccc8242

Please sign in to comment.