Fixed bug #851653, added an if statement, and fixed the orphaned variable.

Fixes: https://launchpad.net/bugs/851653
This commit is contained in:
Raoul Snyman 2011-09-16 10:15:37 +02:00
parent ea7cda4418
commit 1afcbbc837
1 changed files with 4 additions and 2 deletions

View File

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