summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
50c4d6c)
Eliminates the last compiled module. I half wonder if this flag were there
from the beginning and my stupid flac module was never needed, but I'm not
going digging for the answer to that right now.
import org.diplodocus.jobs
from org.diplodocus.util import run_or_die
import org.diplodocus.jobs
from org.diplodocus.util import run_or_die
-from flac_archive import flac
from flac_archive.tags import Tags
################################################################################
# The child processes
def flac2mp3(fn, title, artist, album_artist, album, discnum, date,
from flac_archive.tags import Tags
################################################################################
# The child processes
def flac2mp3(fn, title, artist, album_artist, album, discnum, date,
- track, skip_until, pics=None):
(title, artist, album) = [(x == None and 'unknown') or x
for x in (title, artist, album)]
if date == None:
(title, artist, album) = [(x == None and 'unknown') or x
for x in (title, artist, album)]
if date == None:
return quoted_outfile.replace(r"'\''", "'")
pic_options = ''
return quoted_outfile.replace(r"'\''", "'")
pic_options = ''
- if pics:
- (fd, picfn) = tempfile.mkstemp()
- f = os.fdopen(fd, 'wb')
- f.write(pics[0][7])
- f.close()
+ (fd, picfn) = tempfile.mkstemp()
+ os.close(fd)
+ p = Popen(['metaflac', '--export-picture-to=' + picfn, fn], stderr=PIPE)
+ status = p.wait()
+ stderr = ''.join(p.stderr)
+ # Hacky check for flac with no album art
+ if 'no PICTURE block' in stderr:
+ # That's fine, just no picture.
+ pass
+ else:
+ if status != 0:
+ sys.stderr.write('metaflac exited %d: %s\n' % (status, stderr))
+ return
pic_options = "--ti '%s'" % picfn
pic_options = "--ti '%s'" % picfn
+ os.system('md5sum ' + picfn)
try:
run_or_die(3, "flac %s -cd %s '%s' | lame --id3v2-only --id3v2-latin1 --pad-id3v2-size 0 %s --tt '%s' --ta '%s' --tl '%s' --ty '%s' --tn %d %s %s %s - '%s'"
% (flac_options, ' '.join(skip_until), fn,
try:
run_or_die(3, "flac %s -cd %s '%s' | lame --id3v2-only --id3v2-latin1 --pad-id3v2-size 0 %s --tt '%s' --ta '%s' --tl '%s' --ty '%s' --tn %d %s %s %s - '%s'"
% (flac_options, ' '.join(skip_until), fn,
pic_options, album_artist_options,
discnum_options, quoted_outfile))
finally:
pic_options, album_artist_options,
discnum_options, quoted_outfile))
finally:
try:
os.unlink(picfn)
except:
try:
os.unlink(picfn)
except:
- pics = flac.get_pictures(fn)
-
for i in range(len(tags)):
title = tags.gets('TITLE', track, separator)
part = tags.gets('PART', track)
for i in range(len(tags)):
title = tags.gets('TITLE', track, separator)
part = tags.gets('PART', track)
', '.join(artist),
album_artist, album, discnum,
tags.gets('DATE', track),
', '.join(artist),
album_artist, album, discnum,
tags.gets('DATE', track),
if not os.path.exists(mp3):
print fn
break
if not os.path.exists(mp3):
print fn
break
', '.join(artist),
album_artist, album, discnum,
tags.gets('DATE', track),
', '.join(artist),
album_artist, album, discnum,
tags.gets('DATE', track),
track = i + 2
except Exception, error:
sys.stderr.write(getattr(error, 'msg', ''))
track = i + 2
except Exception, error:
sys.stderr.write(getattr(error, 'msg', ''))