-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrated audio and video filters to enums (#34)
- Loading branch information
Showing
6 changed files
with
137 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import enum | ||
|
||
|
||
# The Audio Filter Enumerated List | ||
# Convert filter values to their strings | ||
class AudioFilter(enum.Enum): | ||
def __new__(cls, name, toText): | ||
obj = object.__new__(cls) | ||
obj.toText = toText | ||
return obj | ||
|
||
FADE_IN = ('Fade In', lambda value: f'afade=d={value}:curve=exp') | ||
FADE_OUT = ('Fade Out', lambda start, value: f'afade=t=out:st={start}:d={value}') | ||
MUTE = ('Mute', lambda start, end: f"volume=enable='between(t,{start},{end})':volume=0") | ||
CUSTOM = ('Custom', lambda text: text) | ||
|
||
# Get the object to prompt to the user | ||
@classmethod | ||
def get_obj(self): | ||
return { | ||
'Exit': False, | ||
self.CUSTOM._value_[0]: '', | ||
self.FADE_IN._value_[0]: 0, | ||
self.FADE_OUT._value_[0]: { | ||
'Start Time': 0, | ||
'Exp': 0 | ||
}, | ||
self.MUTE._value_[0]: { | ||
'Start Time': 0, | ||
'End Time': 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import enum | ||
|
||
|
||
# The Video Filter Enumerated List | ||
# Set video filters | ||
class VideoFilter(enum.Enum): | ||
def __new__(cls, value, name): | ||
obj = object.__new__(cls) | ||
return obj | ||
|
||
NO_FILTERS = ('No Filters', None) | ||
R720P = ('scale=-1:720', '720p') | ||
FILTERED_720P = ('scale=-1:720,hqdn3d=0:0:3:3,gradfun,unsharp', 'filtered-720p') | ||
FILTERED = ('hqdn3d=0:0:3:3,gradfun,unsharp', 'filtered') | ||
LIGHTDENOISE = ('hqdn3d=0:0:3:3', 'lightdenoise') | ||
HEAVYDENOISE = ('hqdn3d=1.5:1.5:6:6', 'heavydenoise') | ||
UNSHARP = ('unsharp', 'unsharp') | ||
CUSTOM = ('custom', 'Custom') | ||
|
||
# Get the object to prompt to the user | ||
@classmethod | ||
def get_obj(self): | ||
return { | ||
self.NO_FILTERS._value_[0]: self.NO_FILTERS._value_[1], | ||
self.R720P._value_[0]: self.R720P._value_[1], | ||
self.FILTERED_720P._value_[0]: self.FILTERED_720P._value_[1], | ||
self.FILTERED._value_[0]: self.FILTERED._value_[1], | ||
self.LIGHTDENOISE._value_[0]: self.LIGHTDENOISE._value_[1], | ||
self.HEAVYDENOISE._value_[0]: self.HEAVYDENOISE._value_[1], | ||
self.UNSHARP._value_[0]: self.UNSHARP._value_[1], | ||
self.CUSTOM._value_[0]: self.CUSTOM._value_[1] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters