Update of /cvsroot/freevo/freevo/src/audio/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6505
Modified Files:
cdbackup.py
Log Message:
o Fix bug when AlertBox has no input focus
o Make it possible to abort a ripping session
Index: cdbackup.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/audio/plugins/cdbackup.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** cdbackup.py 18 Jan 2004 16:51:48 -0000 1.31
--- cdbackup.py 28 May 2004 20:23:19 -0000 1.32
***************
*** 1,18 ****
# if 0 /*
# -----------------------------------------------------------------------
! # cdbackup.py - CD Backup plugin for ripping/backing up CDs to
# your hard drive
# -----------------------------------------------------------------------
# $Id$
! #
! # Notes: This is the cdbackup module which can be accessed from the audio menu
# by hitting 'e' or enter (not return) whilst a CD is selected.
! #
# It allows you to backup CDs as .wav files or as .mp3s.
! #
! # To Activate Plugin, add the following to local_conf.py:
! # plugin.activate('audio.cdbackup')
! #
! # Todo:
#
# Add a status bar showing progress Parse the output of cdparanoia and
--- 1,18 ----
# if 0 /*
# -----------------------------------------------------------------------
! # cdbackup.py - CD Backup plugin for ripping/backing up CDs to
# your hard drive
# -----------------------------------------------------------------------
# $Id$
! #
! # Notes: This is the cdbackup module which can be accessed from the audio menu
# by hitting 'e' or enter (not return) whilst a CD is selected.
! #
# It allows you to backup CDs as .wav files or as .mp3s.
! #
! # To Activate Plugin, add the following to local_conf.py:
! # plugin.activate('audio.cdbackup')
! #
! # Todo:
#
# Add a status bar showing progress Parse the output of cdparanoia and
***************
*** 29,32 ****
--- 29,36 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.32 2004/05/28 20:23:19 dischi
+ # o Fix bug when AlertBox has no input focus
+ # o Make it possible to abort a ripping session
+ #
# Revision 1.31 2004/01/18 16:51:48 dischi
# (re)move unneeded variables
***************
*** 105,123 ****
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
! #
# 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 MER-
# CHANTABILITY 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
! #
# ----------------------------------------------------------------------- */
# endif
--- 109,127 ----
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
! #
# 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 MER-
# CHANTABILITY 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
! #
# ----------------------------------------------------------------------- */
# endif
***************
*** 140,143 ****
--- 144,149 ----
from event import *
+ from util import popen3
+
# Included to be able to access the info for Audio CDs
import mmpython
***************
*** 146,156 ****
"""
Backup audio CDs in .mp3, .ogg, or .wav format.
!
The following variables are needed by this plugin. Please set them in
your local_conf.py:
!
Directory that you want to backup your audio CD to.
AUDIO_BACKUP_DIR = '/music/MP3'
!
You can use any combination of the 4 variables below to create subdirectories,
and filename of songs.
--- 152,162 ----
"""
Backup audio CDs in .mp3, .ogg, or .wav format.
!
The following variables are needed by this plugin. Please set them in
your local_conf.py:
!
Directory that you want to backup your audio CD to.
AUDIO_BACKUP_DIR = '/music/MP3'
!
You can use any combination of the 4 variables below to create subdirectories,
and filename of songs.
***************
*** 160,186 ****
like to use -which will be appended to AUDIO_BACKUP_DIR.
CD_RIP_PN_PREF= '%(genre)s/%(artist)s/%(album)s/%(song)s'
!
This would give you something like:
/music/MP3/metal/Metallica/And Justice For All/Blackened.mp3
(or Blackened.wav, Blackened.ogg)
!
Here is another example which includes the artist and album in the filename:
CD_RIP_PN_PREF = '%(artist)s/%(artist)s - %(album)s - %(song)s'
/music/MP3/Metallica/Metallica - And Justice For All - Blackened.mp3
!
cdparanoia is used to rip the CD to your hard drive. The actual command that
will be executed is stored in CDPAR_CMD.
CDPAR_CMD = 'cdparanoia'
!
Lame .mp3 encoding parameters:
Lame is used for .mp3 encoding. The actual command that will be executed is
stored in LAME_CMD
LAME_CMD = 'lame'
!
For ripping to .mp3 you can provide your own Lame encoder parameters for
bitrate, algorithm, and various other lame options. Add your custom parameters
in CD_RIP_LAME_OPTS.
CD_RIP_LAME_OPTS = '--vbr-new'
!
Ogg Encoding:
Likewise for Ogg format, the command is as below, and you can add your own
--- 166,192 ----
like to use -which will be appended to AUDIO_BACKUP_DIR.
CD_RIP_PN_PREF= '%(genre)s/%(artist)s/%(album)s/%(song)s'
!
This would give you something like:
/music/MP3/metal/Metallica/And Justice For All/Blackened.mp3
(or Blackened.wav, Blackened.ogg)
!
Here is another example which includes the artist and album in the filename:
CD_RIP_PN_PREF = '%(artist)s/%(artist)s - %(album)s - %(song)s'
/music/MP3/Metallica/Metallica - And Justice For All - Blackened.mp3
!
cdparanoia is used to rip the CD to your hard drive. The actual command that
will be executed is stored in CDPAR_CMD.
CDPAR_CMD = 'cdparanoia'
!
Lame .mp3 encoding parameters:
Lame is used for .mp3 encoding. The actual command that will be executed is
stored in LAME_CMD
LAME_CMD = 'lame'
!
For ripping to .mp3 you can provide your own Lame encoder parameters for
bitrate, algorithm, and various other lame options. Add your custom parameters
in CD_RIP_LAME_OPTS.
CD_RIP_LAME_OPTS = '--vbr-new'
!
Ogg Encoding:
Likewise for Ogg format, the command is as below, and you can add your own
***************
*** 188,218 ****
OGGENC_CMD ='oggenc'
CD_RIP_OGG_OPTS = ' '
!
To activate this plugin, add the following to local_conf.py:
plugin.activate('audio.cdbackup')
!
Finally, to actually backup an audio CD within Freeevo, when you are in the
Music menu, highlight/choose a CD, then hit 'e' on keyboard or 'ENTER' on
your remote control and you will be able to access the rip/backup menu.
!
Here is a list of all the above mentioned parameters for simple cutting and
pasting:
!
! #The following are for adding and configuring the CD Audio backup plugin:
! AUDIO_BACKUP_DIR = '/music/MP3'
!
! CD_RIP_PN_PREF= '%(genre)s/%(artist)s/%(album)s/%(song)s'
! CDPAR_CMD = 'cdparanoia'
!
! LAME_CMD = 'lame'
! CD_RIP_LAME_OPTS = '--vbr-new'
!
#You can leave this out if you never use ogg and it won't show up in the
! #backup menu
! OGGENC_CMD ='oggenc'
! CD_RIP_OGG_OPTS = ' '
!
! #To activate the cdbackup plugin:
! plugin.activate('audio.cdbackup')
"""
--- 194,224 ----
OGGENC_CMD ='oggenc'
CD_RIP_OGG_OPTS = ' '
!
To activate this plugin, add the following to local_conf.py:
plugin.activate('audio.cdbackup')
!
Finally, to actually backup an audio CD within Freeevo, when you are in the
Music menu, highlight/choose a CD, then hit 'e' on keyboard or 'ENTER' on
your remote control and you will be able to access the rip/backup menu.
!
Here is a list of all the above mentioned parameters for simple cutting and
pasting:
!
! #The following are for adding and configuring the CD Audio backup plugin:
! AUDIO_BACKUP_DIR = '/music/MP3'
!
! CD_RIP_PN_PREF= '%(genre)s/%(artist)s/%(album)s/%(song)s'
! CDPAR_CMD = 'cdparanoia'
!
! LAME_CMD = 'lame'
! CD_RIP_LAME_OPTS = '--vbr-new'
!
#You can leave this out if you never use ogg and it won't show up in the
! #backup menu
! OGGENC_CMD ='oggenc'
! CD_RIP_OGG_OPTS = ' '
!
! #To activate the cdbackup plugin:
! plugin.activate('audio.cdbackup')
"""
***************
*** 225,229 ****
self.rip_thread = None
!
def config(self):
"""
--- 231,235 ----
self.rip_thread = None
!
def config(self):
"""
***************
*** 245,253 ****
def actions(self, item):
self.item = item
!
try:
if (self.item.type == 'audiocd'):
if self.rip_thread and self.rip_thread.current_track != -1:
! return [ ( self.show_status, _( 'Show CD ripping status' ) ) ]
else:
self.device = self.item.devicename
--- 251,260 ----
def actions(self, item):
self.item = item
!
try:
if (self.item.type == 'audiocd'):
if self.rip_thread and self.rip_thread.current_track != -1:
! return [ ( self.show_status, _( 'Show CD ripping status' ) ),
! ( self.stop_ripping, _( 'Stop CD ripping') ) ]
else:
self.device = self.item.devicename
***************
*** 261,264 ****
--- 268,277 ----
+ def stop_ripping(self, arg=None, menuw=None):
+ self.rip_thread.abort = True
+ self.rip_thread.join()
+ menuw.delete_submenu()
+
+
def show_status(self, arg=None, menuw=None):
t = self.rip_thread
***************
*** 267,272 ****
(t.current_track, t.max_track))
pop.show()
!
!
def create_backup_menu(self, arg=None, menuw=None):
mm_menu = self.create_backup_items(self.device, menuw=None)
--- 280,285 ----
(t.current_track, t.max_track))
pop.show()
!
!
def create_backup_menu(self, arg=None, menuw=None):
mm_menu = self.create_backup_items(self.device, menuw=None)
***************
*** 275,279 ****
! def create_backup_items(self, arg, menuw):
items = []
--- 288,292 ----
! def create_backup_items(self, arg, menuw):
items = []
***************
*** 292,305 ****
backupmenu = menu.Menu(_('CD Backup'), items,
reload_func=self.create_backup_menu)
return backupmenu
-
! def cd_backup(self, arg, menuw=None):
device, type = arg
! self.rip_thread = main_backup_thread(device=device, rip_format=type)
self.rip_thread.start()
! AlertBox(text=_( 'Ripping started' ) ).show()
menuw.delete_menu()
! menuw.back_one_menu()
!
--- 305,320 ----
backupmenu = menu.Menu(_('CD Backup'), items,
reload_func=self.create_backup_menu)
return backupmenu
!
! def cd_backup(self, arg, menuw=None):
device, type = arg
! self.rip_thread = main_backup_thread(device=device, rip_format=type)
self.rip_thread.start()
! # delete the choose format menu
menuw.delete_menu()
! # delete submenu
! menuw.delete_submenu()
! # show message
! rc.post_event(Event(OSD_MESSAGE, _( 'Ripping started' )))
***************
*** 316,352 ****
self.output_directory = ''
! def run(self, rip_format='mp3'):
if self.rip_format == 'mp3' :
self.cd_backup_threaded(self.device, rip_format='mp3')
elif self.rip_format == 'ogg' :
! self.cd_backup_threaded(self.device, rip_format='ogg')
elif self.rip_format == 'wav' :
! self.cd_backup_threaded(self.device, rip_format='wav')
elif self.rip_format == 'flac' :
self.cd_backup_threaded(self.device, rip_format='flac')
!
!
! def cd_backup_threaded(self, device, rip_format='mp3'):
rip_format = rip_format
! album = 'default_album'
! artist = 'default_artist'
! genre = 'default_genre'
! dir_audio_default = "dir_audio_default"
path_head = ''
for media in config.REMOVABLE_MEDIA:
if media.devicename == device:
media.type = 'cdrip'
!
! # Get the artist, album and song_names
(discid, artist, album, genre, song_names) =
self.get_formatted_cd_info(device)
!
dir_audio = config.AUDIO_BACKUP_DIR
!
user_rip_path_prefs = { 'artist': artist,
'album': album,
'genre': genre }
!
path_list = re.split("\\/", config.CD_RIP_PN_PREF)
!
# Get everything up to the last "/"
if len(path_list) != 0:
--- 331,369 ----
self.output_directory = ''
! def run(self, rip_format='mp3'):
! self.abort = False
!
if self.rip_format == 'mp3' :
self.cd_backup_threaded(self.device, rip_format='mp3')
elif self.rip_format == 'ogg' :
! self.cd_backup_threaded(self.device, rip_format='ogg')
elif self.rip_format == 'wav' :
! self.cd_backup_threaded(self.device, rip_format='wav')
elif self.rip_format == 'flac' :
self.cd_backup_threaded(self.device, rip_format='flac')
!
!
! def cd_backup_threaded(self, device, rip_format='mp3'):
rip_format = rip_format
! album = 'default_album'
! artist = 'default_artist'
! genre = 'default_genre'
! dir_audio_default = "dir_audio_default"
path_head = ''
for media in config.REMOVABLE_MEDIA:
if media.devicename == device:
media.type = 'cdrip'
!
! # Get the artist, album and song_names
(discid, artist, album, genre, song_names) =
self.get_formatted_cd_info(device)
!
dir_audio = config.AUDIO_BACKUP_DIR
!
user_rip_path_prefs = { 'artist': artist,
'album': album,
'genre': genre }
!
path_list = re.split("\\/", config.CD_RIP_PN_PREF)
!
# Get everything up to the last "/"
if len(path_list) != 0:
***************
*** 354,358 ****
path_head += '/' + path_list[i]
path_tail_temp = '/' + path_list[len(path_list)-1]
!
# If no directory structure preferences were given use default dir structure
if len(path_list) == 0:
--- 371,375 ----
path_head += '/' + path_list[i]
path_tail_temp = '/' + path_list[len(path_list)-1]
!
# If no directory structure preferences were given use default dir structure
if len(path_list) == 0:
***************
*** 362,367 ****
path_temp = dir_audio + path_head
pathname = path_temp % user_rip_path_prefs
!
! try:
os.makedirs(pathname, 0777)
except:
--- 379,384 ----
path_temp = dir_audio + path_head
pathname = path_temp % user_rip_path_prefs
!
! try:
os.makedirs(pathname, 0777)
except:
***************
*** 381,386 ****
self.max_track = len(song_names)
for i in range (0, len(song_names)):
! # Keep track of track#
! track = i +1
self.current_track = track
--- 398,408 ----
self.max_track = len(song_names)
for i in range (0, len(song_names)):
! if self.abort:
! rc.post_event(Event(OSD_MESSAGE, arg=_('Ripping aborted')))
! self.current_track = -1
! return
!
! # Keep track of track#
! track = i +1
self.current_track = track
***************
*** 397,403 ****
'track': track,
'song': song_names[i] }
!
! path_tail = path_tail_temp % user_rip_path_prefs
!
# If rip_format is mp3 or ogg, then copy the file to
# /tmp/track_being_ripped.wav
--- 419,425 ----
'track': track,
'song': song_names[i] }
!
! path_tail = path_tail_temp % user_rip_path_prefs
!
# If rip_format is mp3 or ogg, then copy the file to
# /tmp/track_being_ripped.wav
***************
*** 407,442 ****
pathname_cdparanoia = '/tmp'
path_tail_cdparanoia = '/track_being_ripped'
!
# Otherwise if it's going to be a .wav just use the the users preferred
# directory and filename. i.e. don't bother putting into /tmp directory,
! # just use directory and filename of final destination.
! else:
pathname_cdparanoia = pathname
path_tail_cdparanoia = path_tail
!
# Build the cdparanoia command to be run
! cdparanoia_command = '%s -s %s "%s%s.wav" >/dev/null 2>&1' % \
! (config.CDPAR_CMD, str(i+1),
! pathname_cdparanoia, path_tail_cdparanoia)
_debug_('cdparanoia: %s' % cdparanoia_command)
!
! # Have the OS execute the CD Paranoia rip command
! os.system(cdparanoia_command)
!
# Build the lame command to be run if mp3 format is selected
if string.upper(rip_format) == 'MP3':
! lame_command = '%s --nohist -h %s "%s%s.wav" "%s%s.mp3" >/dev/null
2>&1' % \
! (config.LAME_CMD, config.CD_RIP_LAME_OPTS,
! pathname_cdparanoia, path_tail_cdparanoia,
! pathname, path_tail)
! _debug_('lame: %s' %lame_command)
! os.system(lame_command)
! try:
! util.tagmp3(pathname+path_tail+'.mp3', title=song_names[i],
! artist=artist, album=album, track=track,
! tracktotal=len(song_names))
except IOError:
# This sometimes fails if the CD has a data track
--- 429,478 ----
pathname_cdparanoia = '/tmp'
path_tail_cdparanoia = '/track_being_ripped'
! keep_wav = False
!
# Otherwise if it's going to be a .wav just use the the users preferred
# directory and filename. i.e. don't bother putting into /tmp directory,
! # just use directory and filename of final destination.
! else:
pathname_cdparanoia = pathname
path_tail_cdparanoia = path_tail
! keep_wav = True
!
! wav_file = '%s%s.wav' % (pathname_cdparanoia, path_tail_cdparanoia)
! output = ''
!
# Build the cdparanoia command to be run
! cdparanoia_command = str('%s -s %s' % (config.CDPAR_CMD,
str(i+1))).split(' ')+\
! [ wav_file ]
_debug_('cdparanoia: %s' % cdparanoia_command)
!
! # Have the OS execute the CD Paranoia rip command
! popen3.run(cdparanoia_command, self, 9)
! if self.abort:
! rc.post_event(Event(OSD_MESSAGE, arg=_('Ripping aborted')))
! self.current_track = -1
!
! # Remove the .wav file.
! if os.path.exists (wav_file):
! os.unlink(wav_file)
! return
!
!
# Build the lame command to be run if mp3 format is selected
if string.upper(rip_format) == 'MP3':
! output = '%s%s.mp3' % (pathname, path_tail)
! cmd = str('%s --nohist -h %s' % (config.LAME_CMD,
config.CD_RIP_LAME_OPTS))
! cmd = cmd.split(' ') + [ wav_file, output ]
! _debug_('lame: %s' % cmd)
! popen3.run(cmd, self, 9)
!
! try:
! if not self.abort:
! util.tagmp3(pathname+path_tail+'.mp3', title=song_names[i],
! artist=artist, album=album, track=track,
! tracktotal=len(song_names))
except IOError:
# This sometimes fails if the CD has a data track
***************
*** 444,474 ****
# it's trying to tag a data track
pass
-
- # Remove the .wav file.
- rm_command = '%s%s.wav' % (pathname_cdparanoia, path_tail_cdparanoia)
- if os.path.exists (rm_command): os.unlink(rm_command)
! # Build the oggenc command to be run if ogg format is selected
elif string.upper(rip_format) == 'OGG':
! oggenc_command = '%s %s -a "%s" -G "%s" -N "%s" -t "%s" -l "%s" ' \
! '"%s%s.wav" -o "%s%s.ogg"' % \
! (config.OGGENC_CMD, config.CD_RIP_OGG_OPTS,
! artist, genre, track, song_names[i], album,
! pathname_cdparanoia, path_tail_cdparanoia,
pathname,
! path_tail)
- _debug_('oggenc_command: %s' %oggenc_command)
- os.system(oggenc_command)
-
- # Remove the .wav file.
- rm_command = '%s%s.wav' % (pathname_cdparanoia, path_tail_cdparanoia)
- if os.path.exists (rm_command): os.unlink(rm_command)
# Build the flacenc command
elif string.upper(rip_format) == 'FLAC':
! flac_command = '%s %s "%s%s.wav" -o "%s%s.flac"' % \
! ( config.FLAC_CMD, config.FLAC_OPTS,
pathname_cdparanoia,
! path_tail_cdparanoia, pathname, path_tail)
metaflac_command = \
'metaflac --set-vc-field=ARTIST="%s" --set-vc-field=ALBUM="%s" '\
--- 480,503 ----
# it's trying to tag a data track
pass
! # Build the oggenc command to be run if ogg format is selected
elif string.upper(rip_format) == 'OGG':
! output = '%s%s.ogg' % (pathname, path_tail)
! cmd = str('%s %s' % (config.OGGENC_CMD, config.CD_RIP_OGG_OPTS))
! cmd = cmd.split(' ') + \
! [ '-a', artist, 'G', genre, '-N', track, '-t', song_names[i],
! '-l', album, wav_file, '-o', output ]
!
! _debug_('oggenc_command: %s' % cmd)
! popen3.run(cmd, self, 9)
# Build the flacenc command
elif string.upper(rip_format) == 'FLAC':
! output = '%s%s.flac' % (pathname, path_tail)
! cmd = '%s %s' % ( config.FLAC_CMD, config.FLAC_OPTS )
! cmd = cmd.split(' ') + [ wav_file, '-o', output ]
!
metaflac_command = \
'metaflac --set-vc-field=ARTIST="%s" --set-vc-field=ALBUM="%s" '\
***************
*** 476,486 ****
'"%s%s.flac"' % (artist, album, song_names[i], track,
len(song_names), pathname, path_tail)
_debug_('flac_command: %s' % (flac_command))
_debug_('metaflac : %s' % (metaflac_command))
! os.system(flac_command)
! os.system(metaflac_command)
! rm_command = '%s%s.wav' % (pathname_cdparanoia, path_tail_cdparanoia)
! if os.path.exists (rm_command): os.unlink(rm_command)
!
for media in config.REMOVABLE_MEDIA:
if media.devicename == device:
--- 505,533 ----
'"%s%s.flac"' % (artist, album, song_names[i], track,
len(song_names), pathname, path_tail)
+
_debug_('flac_command: %s' % (flac_command))
_debug_('metaflac : %s' % (metaflac_command))
! popen3.run(cmd, self, 9)
!
! if not self.abort:
! os.system(metaflac_command)
!
!
!
!
! # Remove the .wav file.
! if os.path.exists(wav_file) and not keep_wav:
! os.unlink(wav_file)
!
! # abort set?
! if self.abort:
! rc.post_event(Event(OSD_MESSAGE, arg=_('Ripping aborted')))
! self.current_track = -1
!
! # Remove the unfinished output file.
! if output and os.path.exists (output):
! os.unlink(output)
! return
!
for media in config.REMOVABLE_MEDIA:
if media.devicename == device:
***************
*** 492,499 ****
!
def get_formatted_cd_info(self, device):
cd_info = mmpython.parse(device)
!
# Check if getting CDDB data failed -is there a better way to do this?
# Give some defaults with a timestamp to uniqueify artist and album names.
--- 539,546 ----
!
def get_formatted_cd_info(self, device):
cd_info = mmpython.parse(device)
!
# Check if getting CDDB data failed -is there a better way to do this?
# Give some defaults with a timestamp to uniqueify artist and album names.
***************
*** 503,511 ****
_debug_( _( 'WARNING' ) + ': ' + _( 'No CDDB data available to mmpython'
) ,2)
current_time = time.strftime('%d-%b-%y-%I:%M%P')
!
artist = _( 'Unknown Artist' ) + ' ' + current_time + ' - ' + _(
'RENAME' )
album = _( 'Unknown CD Album' ) + ' ' + current_time + ' - ' + _(
'RENAME' )
genre = _( 'Other' )
!
# Flash a popup window indicating copying is done
popup_string=_( "CD info not found!\nMust manually rename files\nwhen
finished ripping" )
--- 550,558 ----
_debug_( _( 'WARNING' ) + ': ' + _( 'No CDDB data available to mmpython'
) ,2)
current_time = time.strftime('%d-%b-%y-%I:%M%P')
!
artist = _( 'Unknown Artist' ) + ' ' + current_time + ' - ' + _(
'RENAME' )
album = _( 'Unknown CD Album' ) + ' ' + current_time + ' - ' + _(
'RENAME' )
genre = _( 'Other' )
!
# Flash a popup window indicating copying is done
popup_string=_( "CD info not found!\nMust manually rename files\nwhen
finished ripping" )
***************
*** 520,524 ****
genre = self.replace_special_char(cd_info.tracks[0].genre, '-')
! song_names = []
for track in cd_info.tracks:
song_names.append(self.fix_case(self.replace_special_char(track.title,
'-')))
--- 567,571 ----
genre = self.replace_special_char(cd_info.tracks[0].genre, '-')
! song_names = []
for track in cd_info.tracks:
song_names.append(self.fix_case(self.replace_special_char(track.title,
'-')))
***************
*** 528,536 ****
song_names = song_names[:-1]
! return [cd_info.id, artist, album, genre, song_names]
!
# This function gets rid of the slash, '/', in a string, and replaces it
! # with join_string
def slash_split(self, string, join_string = '-'):
split_string= re.split(" \\/ ", string)
--- 575,583 ----
song_names = song_names[:-1]
! return [cd_info.id, artist, album, genre, song_names]
!
# This function gets rid of the slash, '/', in a string, and replaces it
! # with join_string
def slash_split(self, string, join_string = '-'):
split_string= re.split(" \\/ ", string)
***************
*** 542,546 ****
if (i == (len(split_string) - 1)):
rejoined_string += split_string[i]
! # if not at the last slash, keep adding to string the join_string
else :
rejoined_string += split_string[i] + join_string
--- 589,593 ----
if (i == (len(split_string) - 1)):
rejoined_string += split_string[i]
! # if not at the last slash, keep adding to string the join_string
else :
rejoined_string += split_string[i] + join_string
***************
*** 549,559 ****
else:
rejoined_string = string
!
! return rejoined_string
# Function to get rid of funky characters that exist in a string
! # so that when for example writing a file to disk, the filename
# doesn't contain any special reserved characters.
! # This list of special_chars probably contains some characters that are okay.
def replace_special_char(self, string, repl='-'):
# Regular Expression Special Chars = . ^ $ * + ? { [ ] \ | ( )
--- 596,606 ----
else:
rejoined_string = string
!
! return rejoined_string
# Function to get rid of funky characters that exist in a string
! # so that when for example writing a file to disk, the filename
# doesn't contain any special reserved characters.
! # This list of special_chars probably contains some characters that are okay.
def replace_special_char(self, string, repl='-'):
# Regular Expression Special Chars = . ^ $ * + ? { [ ] \ | ( )
***************
*** 561,568 ****
new_string = string
num = 0
!
for j in special_chars:
pattern = j
! try:
# A few of the special characters get automatically converted to a
# different char, rather than what is passed in as repl
--- 608,615 ----
new_string = string
num = 0
!
for j in special_chars:
pattern = j
! try:
# A few of the special characters get automatically converted to a
# different char, rather than what is passed in as repl
***************
*** 570,574 ****
(new_string, num) = re.subn(pattern, "\\\'", new_string, count=0)
elif (pattern == '/'):
! (new_string, num) = re.subn(pattern, '\\\\', new_string,
count=0)
else:
(new_string, num) = re.subn(pattern, repl, new_string, count=0)
--- 617,621 ----
(new_string, num) = re.subn(pattern, "\\\'", new_string, count=0)
elif (pattern == '/'):
! (new_string, num) = re.subn(pattern, '\\\\', new_string, count=0)
else:
(new_string, num) = re.subn(pattern, repl, new_string, count=0)
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog