Ticket #1012 (closed feature-request: fixed)

Opened 11 months ago

Last modified 6 months ago

Add gzip decoding support to httpdownloader

Reported by: johnnyg Owned by: johnnyg
Priority: minor Milestone: 1.3.0
Component: core Version:
Keywords: gzip http encoding decoding Cc:

Description

Would fix issue here:  http://forum.deluge-torrent.org/viewtopic.php?f=7&t=23635 Saves bandwidth when downloading larger files.

Change History

follow-up: ↓ 2   Changed 10 months ago by Nezmer

I'm not a programmer but I googled urllib and compression .

If I run this and save the output in a file , It works :

#!/usr/bin/env python
import urllib
urllib.urlretrieve("http://torrage.com/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent" , "4.torrent")
import gzip
f = gzip.open("4.torrent")
unc = f.read()
print (unc)

in reply to: ↑ 1   Changed 10 months ago by johnnyg

Replying to Nezmer:

I'm not a programmer but I googled urllib and compression . If I run this and save the output in a file , It works : {{{ #!/usr/bin/env python import urllib urllib.urlretrieve(" http://torrage.com/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent" , "4.torrent") import gzip f = gzip.open("4.torrent") unc = f.read() print (unc) }}}

Unfortunately it's not quite as easy as that (although it will use gzip).

  Changed 10 months ago by Nezmer

I see how It's a little bit complicated to implement this on the downloader .

But , should a python equivalent to this bash code be implemented for now to at least solve the issue with gzipped torrent files ?

#!/bin/bash
filemime="$(file -b --mime-type $1)"
if [[ "$filemime" == "application/x-gzip" ]]; then
echo "gzip datastream found , decompressing...."
basename="$(basename $1 .torrent)"
gzip -d -S .torrent $1
mv $basename $1
fi

  Changed 10 months ago by johnnyg

There's really not much point in writing a quick fix for it as it'll be in trunk and hence won't be an immediate fix (unless you're running trunk).

The proper fix should only be a few lines, however it's not at the top of list of things that need to be finished for 1.2.

  Changed 9 months ago by andar

  • version 1.2.0_dev deleted
  • milestone changed from 1.2.0 to Future

  Changed 7 months ago by johnnyg

  • status changed from new to closed
  • resolution set to fixed
  • summary changed from Add gzip encoding support to httpdownloader to Add gzip decoding support to httpdownloader

This has been implemented in r6093.

  Changed 6 months ago by johnnyg

  • milestone changed from Future to 1.3.0
Note: See TracTickets for help on using tickets.