Merge lp:~raoul-snyman/openlp/bug-851653 into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Approved by: Andreas Preikschat
Approved revision: 1745
Merged at revision: 1747
Proposed branch: lp:~raoul-snyman/openlp/bug-851653
Merge into: lp:openlp
Diff against target: 16 lines (+4/-2)
1 file modified
openlp/plugins/songs/lib/mediaitem.py (+4/-2)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/bug-851653
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Andreas Preikschat (community) Approve
Review via email: mp+75684@code.launchpad.net

Commit message

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

Description of the change

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

To post a comment you must log in.
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Looks ok (although I did not test it).

review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
2--- openlp/plugins/songs/lib/mediaitem.py 2011-09-12 17:09:11 +0000
3+++ openlp/plugins/songs/lib/mediaitem.py 2011-09-16 08:40:15 +0000
4@@ -399,8 +399,10 @@
5 except:
6 log.exception('Could not remove file: %s', audio)
7 try:
8- os.rmdir(os.path.join(AppLocation.get_section_data_path(
9- self.plugin.name), 'audio', str(item_id)))
10+ save_path = os.path.join(AppLocation.get_section_data_path(
11+ self.plugin.name), 'audio', str(item_id))
12+ if os.path.exists(save_path):
13+ os.rmdir(save_path)
14 except OSError:
15 log.exception(u'Could not remove directory: %s', save_path)
16 self.plugin.manager.delete_object(Song, item_id)