Hello,
It seems that with the move to urllib the download authentication wasn't
re-implemented so I took care of it. I chose not to use urlparse because my
code was a bit smaller and it should be just as reliable. Also there was
a 'load_settings()' missing when loading the channels for the first time
which didn't load the custom channel titles and username/password info.
Another bug which I didn't have a chance to look into was that I couldn't
cancel a download that is in progress. If I have time, I'll look into it this
weekend (if you didn't already get to it).
nick
diff -u gpodder-r433/src/gpodder/download.py gpodder-r431-dev/src/gpodder/download.py
--- gpodder-r433/src/gpodder/download.py 2007-09-27 20:19:46.000000000 -0400
+++ gpodder-r431-dev/src/gpodder/download.py 2007-09-27 20:26:01.000000000 -0400
@@ -74,7 +74,16 @@
self.channel = channel
self.episode = episode
- self.url = self.episode.url
+ if channel.username or channel.password:
+ auth_string = urllib.quote(channel.username) + ':' + urllib.quote(channel.password) + '@'
+ url = self.episode.url
+ if self.episode.url[:7] == 'http://' or self.episode.url[:6] == 'ftp://':
+ self.url = url[:url.find('://')+3] + auth_string + url[url.find('://')+3:]
+ else:
+ self.url = auth_string + self.episode.url
+ else:
+ self.url = self.episode.url
+
self.filename = self.episode.local_filename()
self.tempname = os.path.join( os.path.dirname( self.filename), '.tmp-' + os.path.basename( self.filename))
@@ -142,7 +148,7 @@
return
util.delete_file( self.tempname)
- self.downloader.retrieve( self.episode.url, self.tempname, reporthook = self.status_updated)
+ self.downloader.retrieve( self.url, self.tempname, reporthook = self.status_updated)
shutil.move( self.tempname, self.filename)
self.channel.addDownloadedItem( self.episode)
finally:
diff -u gpodder-r433/src/gpodder/libpodcasts.py gpodder-r431-dev/src/gpodder/libpodcasts.py
--- gpodder-r433/src/gpodder/libpodcasts.py 2007-09-27 20:19:46.000000000 -0400
+++ gpodder-r431-dev/src/gpodder/libpodcasts.py 2007-09-27 20:28:33.000000000 -0400
@@ -663,7 +663,9 @@
for item in importer.items:
callback_proc and callback_proc( count, len( importer.items))
callback_url and callback_url( item['url'])
- result.append( podcastChannel.create_from_dict( item, load_items = load_items, force_update = force_update, callback_error = callback_error, offline = offline))
+ channel = podcastChannel.create_from_dict( item, load_items = load_items, force_update = force_update, callback_error = callback_error, offline = offline)
+ channel.load_settings()
+ result.append( channel)
count += 1
return result
_______________________________________________
gpodder-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/gpodder-devel