From 717a5075d19b8f16dbe095a294b6f7b63449717f Mon Sep 17 00:00:00 2001 From: BrotherJohn Date: Apr 22 2013 09:58:19 +0000 Subject: bddemux.py * Added writing track list to a logfile --- diff --git a/bddemux.py b/bddemux.py index 39d015e..886edf7 100644 --- a/bddemux.py +++ b/bddemux.py @@ -41,6 +41,7 @@ def main(): "- If you enter nothing the tracks marked in the list will be extracted.\n" "- Type q to quit.") + # loop until user quits or inputs a valid track list while True: print("> ", end="") sys.stdout.flush() @@ -51,10 +52,19 @@ def main(): if len(err_msgs) == 0: break else: - print_err("\n" + "\n".join(err_msgs)) + print_err("\n".join(err_msgs)) print("") # empty line + # write track list to a logfile + with open("eac3to-tracks.log", "w") as log: + log.write("Playlist: %s\n"%(eac.playlist_fullpath())) + log.write(header + "\n") + for track in tracks: + log.write(track["display"] + "\n") + if "coredisplay" in track: + log.write(track["coredisplay"] + "\n") + result = False try: result = eac.extract(tracks) @@ -139,15 +149,15 @@ def parse_track_selection(selected_tracks, tracks): continue if (trackno < 1) or (trackno > len(tracks)): - err_msgs.append("%02d: Track number does not exist in this movie."%(trackno)) + err_msgs.append("%d: Track number does not exist in this movie."%(trackno)) continue if core: if tracks[trackno-1]["type"] != TrackType.audio: - err_msgs.append("%02d: Track number is not an audio track. Cannot extract core."%(trackno)) + err_msgs.append("%d: Track number is not an audio track. Cannot extract core."%(trackno)) continue if "coreextract" not in tracks[trackno-1]: - err_msgs.append("%02d: Audio track does not have a core to extract."%(trackno)) + err_msgs.append("%d: Audio track does not have a core to extract."%(trackno)) continue selected_clean.append("%03d%s"%(trackno, CORE_CHAR[core])) @@ -425,6 +435,10 @@ class EacExecuter: self._playlist = "%05d.mpls"%(number) + def playlist_fullpath(self): + return os.path.abspath(os.path.join(self._disc_path, self._playlist)) + + def set_disc_path(self, path): path = os.path.join(path.strip(), "BDMV", "PLAYLIST")