Fixed bug #851653, where deleting a song without audio files raised an exception.

bzr-revno: 1747
Fixes: https://launchpad.net/bugs/851653
This commit is contained in:
Raoul Snyman 2011-09-16 13:20:44 +02:00
commit f6927ef5b7

View File

@ -399,8 +399,10 @@ class SongMediaItem(MediaManagerItem):
except: except:
log.exception('Could not remove file: %s', audio) log.exception('Could not remove file: %s', audio)
try: try:
os.rmdir(os.path.join(AppLocation.get_section_data_path( save_path = os.path.join(AppLocation.get_section_data_path(
self.plugin.name), 'audio', str(item_id))) self.plugin.name), 'audio', str(item_id))
if os.path.exists(save_path):
os.rmdir(save_path)
except OSError: except OSError:
log.exception(u'Could not remove directory: %s', save_path) log.exception(u'Could not remove directory: %s', save_path)
self.plugin.manager.delete_object(Song, item_id) self.plugin.manager.delete_object(Song, item_id)