From d4fbd7a829f40249b033a6e7933be5bf45efec81 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 2 Nov 2014 10:12:52 -0800 Subject: [PATCH] cleanup --- mutaext.py | 2 ++ unsync.py | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/mutaext.py b/mutaext.py index 8cb42e0..ea3c0fe 100644 --- a/mutaext.py +++ b/mutaext.py @@ -86,6 +86,8 @@ class SyncFile(MutableMapping): self.seen = False def __getitem__(self, key): + if self.md == None: + print(self.path) d = self.md[key] try: return d[0] diff --git a/unsync.py b/unsync.py index ee9ae7d..7770115 100755 --- a/unsync.py +++ b/unsync.py @@ -15,7 +15,8 @@ import convert from mutaext import SyncFile # BUG: doesn't work with my .m4a files? -goodexts = ('.mp3', '.m4a', '.flac', '.ogg') +#goodexts = ('.mp3', '.mp2', '.m4a', '.flac', '.ogg') +goodexts = ('.mp3', '.flac', '.ogg') matchtags = ['artist', 'album', 'title'] alltags = [\ @@ -123,8 +124,12 @@ def run(args): elif updatemetadata(md, match): print("UPD", p) md.md.save() + else: + print("___", p) + lament("[beginning tosync]") for md in tosync: + #print("SYN", md.path) fn = makefilename(md) fout = os.path.join(outdir, fn) @@ -161,9 +166,10 @@ def run(args): return 0 -ret = 0 -try: - ret = run(sys.argv) -except KeyboardInterrupt: - sys.exit(1) -sys.exit(ret) +if __name__ == '__main__': + ret = 0 + try: + ret = run(sys.argv) + except KeyboardInterrupt: + sys.exit(1) + sys.exit(ret)