Compare commits
No commits in common. "19b54d57cbfc2f0ae7a64b167eaf3734f076907b" and "438108a8f98598c972c81b93813b329126aa8f52" have entirely different histories.
19b54d57cb
...
438108a8f9
4 changed files with 12 additions and 62 deletions
|
@ -8,7 +8,6 @@ import time
|
|||
from threading import Thread
|
||||
from datetime import datetime
|
||||
|
||||
import ox
|
||||
import mpv
|
||||
|
||||
|
||||
|
@ -54,22 +53,11 @@ class Sync(Thread):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.is_main = kwargs.get('mode', 'main') == 'main'
|
||||
self.start_at_hour = kwargs.get("hour", False)
|
||||
self.sock = self.init_socket()
|
||||
self.main = Main()
|
||||
if self.is_main:
|
||||
self.socket_enable_broadcast()
|
||||
|
||||
if kwargs.get("sax"):
|
||||
self.sax = mpv.MPV(
|
||||
log_handler=mpv_log, input_default_bindings=True,
|
||||
input_vo_keyboard=True,
|
||||
)
|
||||
self.sax.loop_file = True
|
||||
self.sax.play("/srv/t_for_time/render/Saxophone-5.1.mp4")
|
||||
else:
|
||||
self.sax = None
|
||||
|
||||
if mpv.MPV_VERSION >= (2, 2):
|
||||
self.mpv = mpv.MPV(
|
||||
log_handler=mpv_log, input_default_bindings=True,
|
||||
|
@ -91,8 +79,6 @@ class Sync(Thread):
|
|||
self.mpv.loop_file = False
|
||||
self.mpv.loop_playlist = True
|
||||
self.mpv.register_key_binding('q', self.q_binding)
|
||||
self.mpv.register_key_binding('s', self.s_binding)
|
||||
self.mpv.register_key_binding('p', self.p_binding)
|
||||
self.playlist = kwargs['playlist']
|
||||
self.playlist_mtime = os.stat(self.playlist).st_mtime
|
||||
self.mpv.loadlist(self.playlist)
|
||||
|
@ -104,30 +90,6 @@ class Sync(Thread):
|
|||
time.sleep(0.1)
|
||||
self.mpv.pause = True
|
||||
self.sync_to_main()
|
||||
elif self.start_at_hour:
|
||||
self.mpv.pause = True
|
||||
fmt = '%Y-%m-%d %H'
|
||||
now = datetime.now()
|
||||
offset = (now - datetime.strptime(now.strftime(fmt), fmt)).total_seconds()
|
||||
if self.sax:
|
||||
self.sax.seek(offset, 'absolute', 'exact')
|
||||
self.sax.pause = True
|
||||
position = 0
|
||||
for idx, item in enumerate(self.mpv.playlist):
|
||||
duration = ox.avinfo(item['filename'])['duration']
|
||||
if position + duration > offset:
|
||||
pos = offset - position
|
||||
self.mpv.playlist_play_index(idx)
|
||||
self.mpv.pause = False
|
||||
self.mpv.wait_until_playing()
|
||||
self.mpv.seek(pos, 'absolute', 'exact')
|
||||
time.sleep(0.1)
|
||||
break
|
||||
else:
|
||||
position += duration
|
||||
if self.sax:
|
||||
self.sax.pause = False
|
||||
|
||||
self.ready = True
|
||||
Thread.__init__(self)
|
||||
self.start()
|
||||
|
@ -154,16 +116,6 @@ class Sync(Thread):
|
|||
self.stop()
|
||||
self.mpv.stop()
|
||||
|
||||
def s_binding(self, *args):
|
||||
self.mpv.pause = True
|
||||
if self.sax:
|
||||
self.sax.pause = True
|
||||
|
||||
def p_binding(self, *args):
|
||||
self.mpv.pause = False
|
||||
if self.sax:
|
||||
self.sax.pause = False
|
||||
|
||||
def stop(self, *args):
|
||||
self.active = False
|
||||
if self.sock:
|
||||
|
@ -350,8 +302,6 @@ def main():
|
|||
parser.add_argument('--prefix', help='video location', default=prefix)
|
||||
parser.add_argument('--window', action='store_true', help='run in window', default=False)
|
||||
parser.add_argument('--debug', action='store_true', help='debug', default=False)
|
||||
parser.add_argument('--hour', action='store_true', help='hour', default=False)
|
||||
parser.add_argument('--sax', action='store_true', help='hour', default=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
DEBUG = args.debug
|
||||
|
@ -361,7 +311,7 @@ def main():
|
|||
base = os.path.dirname(os.path.abspath(__file__))
|
||||
#os.chdir(base)
|
||||
|
||||
player = Sync(mode=args.mode, playlist=args.playlist, fullscreen=not args.window, hour=args.hour, sax=args.sax)
|
||||
player = Sync(mode=args.mode, playlist=args.playlist, fullscreen=not args.window)
|
||||
while player.active:
|
||||
try:
|
||||
player.mpv.wait_for_playback()
|
||||
|
|
16
render.py
16
render.py
|
@ -132,17 +132,17 @@ def compose(clips, target=150, base=1024, voice_over=None):
|
|||
subs = []
|
||||
for vo in voice_overs:
|
||||
voc = vo.copy()
|
||||
a, b = '-11', '-3'
|
||||
a, b = '3', '-6'
|
||||
if 'Whispered' in voc['src']:
|
||||
a, b = '-8', '0'
|
||||
a, b = '6', '-3'
|
||||
elif 'Read' in voc['src']:
|
||||
a, b = '-7.75', '0.25'
|
||||
a, b = '6.25', '-2.75'
|
||||
elif 'Free' in voc['src']:
|
||||
a, b = '-8.8', '-0.8'
|
||||
a, b = '5.2', '-3.8'
|
||||
elif 'Ashley' in voc['src']:
|
||||
a, b = '-9.5', '-1.50'
|
||||
a, b = '3.75', '-5.25'
|
||||
elif 'Melody' in voc['src']:
|
||||
a, b = '-5.75', '-0.75'
|
||||
a, b = '4.25', '-4.75'
|
||||
voc['filter'] = {'volume': a}
|
||||
scene['audio-center']['A1'].append(voc)
|
||||
vo_low = vo.copy()
|
||||
|
@ -282,10 +282,10 @@ def compose(clips, target=150, base=1024, voice_over=None):
|
|||
scene['audio-back']['A1'].append({
|
||||
'duration': clip['duration'],
|
||||
'src': clip['original'],
|
||||
'filter': {'volume': '-8.2'},
|
||||
'filter': {'volume': '+0.2'},
|
||||
})
|
||||
# TBD: Foley
|
||||
cf_volume = '-2.5'
|
||||
cf_volume = '-5.5'
|
||||
scene['audio-front']['A2'].append({
|
||||
'duration': clip['duration'],
|
||||
'src': foley,
|
||||
|
|
6
sax.py
6
sax.py
|
@ -31,7 +31,7 @@ reverb = {
|
|||
"src": reverb_wav,
|
||||
"duration": 3600.0,
|
||||
"filter": {
|
||||
"volume": "3.5"
|
||||
"volume": "0.5"
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -39,14 +39,14 @@ long = {
|
|||
"src": long_wav,
|
||||
"duration": 3600.0,
|
||||
"filter": {
|
||||
"volume": "-1"
|
||||
"volume": "-4"
|
||||
},
|
||||
}
|
||||
noise = {
|
||||
"src": nois_wav,
|
||||
"duration": 3600.0,
|
||||
"filter": {
|
||||
"volume": "7.75"
|
||||
"volume": "4.75"
|
||||
},
|
||||
}
|
||||
|
||||
|
|
BIN
title.png
BIN
title.png
Binary file not shown.
Before Width: | Height: | Size: 8.1 KiB |
Loading…
Reference in a new issue