i gave up

This commit is contained in:
Connor Olding 2014-05-25 16:34:58 -07:00
parent fef8ae685d
commit c61c00dfd6

View file

@ -8,6 +8,7 @@ import os.path
import sys
import shutil
import tempfile
from zlib import crc32
import mutaext
import convert
@ -79,12 +80,13 @@ def makefilename(md):
title = md['title']
artist = md['artist']
album = md['album']
sync = md.get('sync')
# TODO: strip /'s and other possible nasties
if sync:
return "!%(sync)s %(artist)s - %(album)s - %(title)s.ogg" % locals()
return "%(artist)s - %(album)s - %(title)s.ogg" % locals()
fn = "%(artist)s - %(album)s - %(title)s" % locals()
crc = crc32(fn.encode('utf-8')) & 0xFFFFFFFF
# FAT is a pain to deal with so just use nondescript filenames
fn = '{:08X}.ogg'.format(crc)
return fn
def run(args):
if not len(args) in (2, 3):
@ -129,13 +131,13 @@ def run(args):
if md.seen:
try:
_from = md.seen
_to = fout.encode('utf-8')
_to = fout
if type(_from) != type(_to):
raise TypeError
if _from != _to:
print("MOV", _from)
#os.rename(_from, _to)
os.rename(_from, _to)
continue
except:
lament(type(_from), type(_to))