chiark / gitweb /
mkm3u: Further improve the debugging for filename parsing.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 17 Mar 2022 18:15:37 +0000 (18:15 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 17 Mar 2022 18:15:49 +0000 (18:15 +0000)
mkm3u

diff --git a/mkm3u b/mkm3u
index 0078f4db252b69e3a6ac8d49b4080503b0bf35f2..44e17d68ed6699a24fe11e1b83a505fafc5ffb8d 100755 (executable)
--- a/mkm3u
+++ b/mkm3u
@@ -187,7 +187,7 @@ class VideoDir (object):
       if not fn.endswith(".iso"): continue
       m = me._R_ISO_PRE.match(fn)
       if not m:
-        #print(";; `%s' ignored" % path, file = SYS.stderr)
+        #print(";; `%s' ignored (regex mismatch)" % path, file = SYS.stderr)
         continue
 
       i = filter(m.group("si"), int)
@@ -211,12 +211,13 @@ class VideoDir (object):
       epname = m.group("epname")
       if epname is not None: eplist = [epname]
       else: eplist = m.group("eplist").split(", ")
+      #print(";; `%s'" % path, file = SYS.stderr)
       for eprange in eplist:
         mm = me._R_ISO_EP.match(eprange)
-        if mm is None: bad = True; continue
-        if not any:
-          #print(";; `%s'" % path, file = SYS.stderr)
-          any = True
+        if mm is None:
+          #print(";;\t`%s'?" % eprange, file = SYS.stderr)
+          bad = True; continue
+        if not any: any = True
         i = filter(mm.group("si"), int)
         if i is not None:
           try: ts = seasons[i]
@@ -228,8 +229,11 @@ class VideoDir (object):
         for k in range(start, end + 1):
           ts.set_episode_disc(k, disc)
           #print(";;\tepisode %d.%d" % (ts.i, k), file = SYS.stderr)
-      if not any: pass #print(";; `%s' ignored" % path, file = SYS.stderr)
-      elif bad: raise ExpectedError("bad ep list in `%s'", fn)
+      if not any:
+        #print(";;\tignored" % path, file = SYS.stderr)
+        pass
+      elif bad:
+        raise ExpectedError("bad ep list in `%s'", fn)
     me.seasons = seasons
 
 class AudioDisc (Source):