summaryrefslogtreecommitdiff
path: root/interface
diff options
context:
space:
mode:
Diffstat (limited to 'interface')
-rw-r--r--interface/interface.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/interface/interface.py b/interface/interface.py
index 0586f16..d500344 100644
--- a/interface/interface.py
+++ b/interface/interface.py
@@ -1,6 +1,7 @@
import curses
import os
import datetime as dt
+import itertools
import threading
import traceback as tb
@@ -101,8 +102,40 @@ class Interface:
if not self.output.ok:
self.pager.display_many(("WARNING: Output is not OK!",), True)
+ self.verify_audio()
+
self.input.main(self._resize)
+ def verify_audio(self):
+ def gather_audio(func):
+ if func.type == AUDIO:
+ return (func,)
+ elif func.type in (CHASER, JOIN):
+ return tuple(itertools.chain(*(gather_audio(i) for i in func.steps)))
+ elif func.type == CHASERSTEP and func.function is not None:
+ return gather_audio(func.function)
+
+ return ()
+
+ f = None
+ bad = []
+ with self.w_lock:
+ funcs = set()
+ if f is None:
+ for func in self.w.functions.values():
+ funcs.update(gather_audio(func))
+ else:
+ funcs = gather_audio(f)
+
+ for f in sorted(funcs, key=lambda i: i.id):
+ if not os.path.isfile(f.filename):
+ bad.append("- %3d \"%s\"" % (f.id, f.filename))
+
+ if bad:
+ self.pager.display_many(["MISSING AUDIO FILES:"] + bad)
+ else:
+ self.pager.display_many(("No missing audio files!",))
+
def handle_show(self, f):
with self.w_lock:
if f is None or f.type == SCENE:
@@ -798,6 +831,7 @@ class Interface:
("pager page", self.page),
("pager clear", self.page_clear),
+ ("verify audio", self.verify_audio),
("quit", self.base_quit),
), {
None: "This is the base edit mode for editing functions.",
@@ -863,6 +897,7 @@ class Interface:
("pager page", self.page),
("pager clear", self.page_clear),
+ ("verify audio", self.verify_audio),
("quit", self.handle_exit),
), {
None: "This mode is for editing chasers. All functions (excepting select) which take a number as an argument may be called without to act on the currently selected step.",
@@ -923,6 +958,7 @@ class Interface:
("pager page", self.page),
("pager clear", self.page_clear),
+ ("verify audio", self.verify_audio),
("quit", self.audio_exit),
), {
None: "This mode is for editing audio primitives for single audio files.",
@@ -980,6 +1016,7 @@ class Interface:
("pager page", self.page),
("pager clear", self.page_clear),
+ ("verify audio", self.verify_audio),
("quit", self.handle_exit),
))