Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#1012 closed feature-request (Fixed)

Add gzip decoding support to httpdownloader

Reported by: johnnyg Owned by: johnnyg
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 follow-up: Changed 15 years 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)

comment:2 in reply to: ↑ 1 Changed 15 years 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).

comment:3 Changed 15 years 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

comment:4 Changed 15 years 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.

comment:5 Changed 14 years ago by andar

  • Milestone changed from 1.2.0 to Future
  • Version 1.2.0_dev deleted

comment:6 Changed 14 years ago by johnnyg

  • Resolution set to fixed
  • Status changed from new to closed
  • Summary changed from Add gzip encoding support to httpdownloader to Add gzip decoding support to httpdownloader

This has been implemented in r6093.

comment:7 Changed 14 years ago by johnnyg

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