diff options
author | Martin Michlmayr <tbm@cyrius.com> | 2006-02-05 20:24:07 +0100 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2006-02-05 20:24:07 +0100 |
commit | 97d87e1fa0808cf747bf0a4fe3b39d1cbdb5efc8 (patch) | |
tree | c817c2371ea765b6fd6f9e47f4985209dd1937dd /jack_ripstuff.py |
Import jack_3.1.1+cvs20050801.orig.tar.gz
[dgit import orig jack_3.1.1+cvs20050801.orig.tar.gz]
Diffstat (limited to 'jack_ripstuff.py')
-rwxr-xr-x | jack_ripstuff.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/jack_ripstuff.py b/jack_ripstuff.py new file mode 100755 index 0000000..82a2c7b --- /dev/null +++ b/jack_ripstuff.py @@ -0,0 +1,78 @@ +### jack_ripstuff: container module for +### jack - extract audio from a CD and encode it using 3rd party software +### Copyright (C) 1999-2004 Arne Zellentin <zarne@users.sf.net> + +### This program is free software; you can redistribute it and/or modify +### it under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2 of the License, or +### (at your option) any later version. + +### This program is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. + +### You should have received a copy of the GNU General Public License +### along with this program; if not, write to the Free Software +### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +import jack_freedb + +import locale + +from jack_globals import * + +all_tracks_orig = [] +all_tracks_todo_sorted = [] +all_tracks = [] + +wavs_ready = None + +printable_names = None # these are displayed for the track names +max_name_len = None # max len of printable_names[] + +raw_space = None # free diskspace + +def gen_printable_names(track_names, todo): + global printable_names + global max_name_len + + printable_names=[] + for i in range(CDDA_MAXTRACKS): + printable_names.append("") + + if jack_freedb.names_available and cf['_show_names']: + if cf['_various']: + max_name_len = max(map(lambda x: len(track_names[x[NUM]][0] + " - " + track_names[x[NUM]][1]), todo)) + else: + max_name_len = max(map(lambda x: len(track_names[x[NUM]][1]), todo)) + max_name_len = len("01 ") + max_name_len + if cf['_show_time']: + max_name_len = max_name_len + 6 + else: + max_name_len = len("01") + if cf['_show_time']: + max_name_len = max_name_len + len(" 01:23") + + for i in todo: + if cf['_show_time']: + len_tmp = i[LEN] / CDDA_BLOCKS_PER_SECOND + len_tmp = ("%02i:%02i") % (len_tmp / 60, len_tmp % 60) + + if jack_freedb.names_available and cf['_show_names']: + if cf['_show_time']: + tmp = "%02i %5s " % (i[NUM], len_tmp) + else: + tmp = "%02i " % i[NUM] + if cf['_various']: + tmp = tmp + track_names[i[NUM]][0] + " - " + track_names[i[NUM]][1] + else: + tmp = tmp + track_names[i[NUM]][1] + p_tmp = tmp.encode(locale.getpreferredencoding(), "replace") + printable_names[i[NUM]] = p_tmp + "." * (max_name_len - len(tmp)) + else: + if cf['_show_time']: + printable_names[i[NUM]] = ("%02i " % i[NUM]) + len_tmp + "." * (max_name_len - len(i[NAME]) - 6) + else: + printable_names[i[NUM]] = i[NAME] + "." * (max_name_len - len(i[NAME])) + |