Delete M3U when removing a podcast (bug 1063)

When a podcast has its downloaded files removed,
the M3U playlist file corresponding to the podcast
should also be removed from the filesystem.
This commit is contained in:
Thomas Perl 2010-06-28 16:03:54 +02:00
parent dd706ad85b
commit bd21be1bea
1 changed files with 9 additions and 3 deletions

View File

@ -611,9 +611,15 @@ class PodcastChannel(PodcastModelObject):
save_dir = property(fget=get_save_dir)
def remove_downloaded( self):
shutil.rmtree( self.save_dir, True)
def remove_downloaded(self):
# Remove the playlist file if it exists
m3u_filename = self.get_playlist_filename()
if os.path.exists(m3u_filename):
util.delete_file(m3u_filename)
# Remove the download directory
shutil.rmtree(self.save_dir, True)
@property
def cover_file(self):
new_name = os.path.join(self.save_dir, 'folder.jpg')