try: os.makedirs(lossy_destination_path) except Exception, e: logger.error('Could not create folder for %s. Not moving: %s' % (release['AlbumTitle'], e)) return albumpath logger.info('Checking which files we need to move.....') # Move files to the destination folder, renaming them if they already exist # If we have two desination_dirs, move non-music files to both if make_lossy_folder and make_lossless_folder: for file_to_move in files_to_move: if any(file_to_move.lower().endswith('.' + x.lower()) for x in headphones.LOSSY_MEDIA_FORMATS): helpers.smartMove(file_to_move, lossy_destination_path) elif any(file_to_move.lower().endswith('.' + x.lower()) for x in headphones.LOSSLESS_MEDIA_FORMATS): helpers.smartMove(file_to_move, lossless_destination_path) # If it's a non-music file, move it to both dirs # TODO: Move specific-to-lossless files to the lossless dir only else: moved_to_lossy_folder = helpers.smartMove(file_to_move, lossy_destination_path, delete=False) moved_to_lossless_folder = helpers.smartMove(file_to_move, lossless_destination_path, delete=False) if moved_to_lossy_folder or moved_to_lossless_folder: try: os.remove(file_to_move) except Exception, e:
except Exception, e: logger.error('Could not create folder for %s. Not moving: %s' % (release['AlbumTitle'], e)) return [albumpath] logger.info('Checking which files we need to move.....') # Move files to the destination folder, renaming them if they already exist # If we have two desination_dirs, move non-music files to both if make_lossy_folder and make_lossless_folder: for file_to_move in files_to_move: if any(file_to_move.lower().endswith('.' + x.lower()) for x in headphones.LOSSY_MEDIA_FORMATS): helpers.smartMove(file_to_move, lossy_destination_path) elif any(file_to_move.lower().endswith('.' + x.lower()) for x in headphones.LOSSLESS_MEDIA_FORMATS): helpers.smartMove(file_to_move, lossless_destination_path) # If it's a non-music file, move it to both dirs # TODO: Move specific-to-lossless files to the lossless dir only else: moved_to_lossy_folder = helpers.smartMove( file_to_move, lossy_destination_path, delete=False) moved_to_lossless_folder = helpers.smartMove( file_to_move, lossless_destination_path, delete=False) if moved_to_lossy_folder or moved_to_lossless_folder: