Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1012 closed feature-request (Fixed)

Add gzip decoding support to httpdownloader

Reported by: John Garland Owned by: John Garland
Priority: minor Milestone: 1.3
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 (7)

comment:1 by Nezmer, 15 years ago

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 comment:2 by John Garland, 15 years ago

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).

comment:3 by Nezmer, 15 years ago

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

comment:4 by John Garland, 15 years ago

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.

comment:5 by andar, 15 years ago

Milestone: 1.2.0Future
Version: 1.2.0_dev

comment:6 by John Garland, 15 years ago

Resolution: fixed
Status: newclosed
Summary: Add gzip encoding support to httpdownloaderAdd gzip decoding support to httpdownloader

This has been implemented in r6093.

comment:7 by John Garland, 15 years ago

Milestone: Future1.3.0
Note: See TracTickets for help on using tickets.