]> diplodocus.org Git - flac-archive/commitdiff
hack out my ancient shitty util library
authorepg <epg@pretzelnet.org>
Fri, 30 Oct 2015 17:00:32 +0000 (10:00 -0700)
committerepg <epg@pretzelnet.org>
Fri, 30 Oct 2015 17:00:32 +0000 (10:00 -0700)
Drops parallelism support, but I never used it anyway, and am not even sure
it worked!

fa-flacd

index 5e93e1f16965b7cb3f9bb1452b1e44324f925122..8166b945b2845101bc9cd4e0ad8b0a9e0f1f2159 100755 (executable)
--- a/fa-flacd
+++ b/fa-flacd
@@ -85,13 +85,20 @@ from errno import EEXIST, ENOENT
 from glob import glob
 from optparse import OptionParser
 
 from glob import glob
 from optparse import OptionParser
 
-import org.diplodocus.jobs
-from org.diplodocus.structures import ListDictDict
-from org.diplodocus.util import die, flatten, nothing
-from org.diplodocus.util import catch_EnvironmentError as c
-
 from flac_archive.tags import Tags
 
 from flac_archive.tags import Tags
 
+def c(f, *args):
+    try:
+        return f(*args)
+    except EnvironmentError, error:
+        error.msg = '%s.%s(%s): ' % (f.__module__, f.__name__,
+                                     ', '.join(map(str, args)))
+        raise
+
+def die(e, *args):
+    sys.stderr.write(''.join(args))
+    sys.exit(e)
+
 def spew(*args):
     if verbose:
         for i in args:
 def spew(*args):
     if verbose:
         for i in args:
@@ -283,11 +290,8 @@ def flacloop(maxjobs):
                     return 1
             return lamb
 
                     return 1
             return lamb
 
-    def notify_start(pid, jobs):
-        # make this print '2 jobs; start 378 for Artist/01 Title.flac'
-        spew('%d jobs; start %d for %s\n' % (len(jobs), pid, dir[0]))
-
-    def notify_finish(pid, status, jobs):
+    while True:
+        status = getjob(lambda *a,**k: None)()
         spew('%d jobs; %d finished (' % (len(jobs), pid))
         if os.WIFEXITED(status):
             spew('exited with status ', str(os.WEXITSTATUS(status)))
         spew('%d jobs; %d finished (' % (len(jobs), pid))
         if os.WIFEXITED(status):
             spew('exited with status ', str(os.WEXITSTATUS(status)))
@@ -297,12 +301,6 @@ def flacloop(maxjobs):
             spew('stopped with signal ', str(os.WSTOPSIG(status)))
         spew(')\n')
 
             spew('stopped with signal ', str(os.WSTOPSIG(status)))
         spew(')\n')
 
-    # Never returns (see getjob comment).
-    org.diplodocus.jobs.run(maxjobs=maxjobs, debug=debug,
-                            get_job=getjob,
-                            notify_start=notify_start,
-                            notify_finish=notify_finish)
-
 def main(argv):
     # Control the exit code for any uncaught exceptions.
     try:
 def main(argv):
     # Control the exit code for any uncaught exceptions.
     try: