Show error message when download dir is readonly

when the download directory cannot be written to,
an error message is shown. This can help users spot
a configuration error where the download dir is set
to a folder that does not exist or is not writable
by the user.
This commit is contained in:
Thomas Perl 2009-06-04 12:35:18 +02:00
parent 42dfd1bc94
commit 081f120808
2 changed files with 13 additions and 4 deletions

View File

@ -2545,7 +2545,13 @@ class gPodder(BuilderWidget, dbus.service.Object):
if task_exists:
continue
task = download.DownloadTask(episode)
try:
task = download.DownloadTask(episode)
except Exception, e:
self.show_message(_('Download error while downloading %s:\n\n%s') % (episode.title, str(e)), _('Download error'))
log('Download error while downloading %s', episode.title, sender=self, traceback=True)
continue
if add_paused:
task.status = task.PAUSED
self.download_queue_manager.add_resumed_task(task)

View File

@ -254,9 +254,12 @@ class CoverDownloader(ObservableService):
if image_data is not None:
log('Saving image data to %s', channel.cover_file, sender=self)
fp = open(channel.cover_file, 'wb')
fp.write(image_data)
fp.close()
try:
fp = open(channel.cover_file, 'wb')
fp.write(image_data)
fp.close()
except IOError, ioe:
log('Cannot save image due to I/O error', sender=self, traceback=True)
if os.path.exists(channel.cover_file):
try: