From 2557476f8a53e36549251050eebee24c2130134b Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Nov 29 2007 18:26:59 +0000 Subject: - Apply patch from Ivo Manca fixing the downloading of files with an unknown size, thanks! --- diff --git a/autodownloader-0.2.0-check-existing-files.patch b/autodownloader-0.2.0-check-existing-files.patch new file mode 100644 index 0000000..3c13525 --- /dev/null +++ b/autodownloader-0.2.0-check-existing-files.patch @@ -0,0 +1,24 @@ +diff -up autodownloader-0.2.0/AutoDL.py.orig autodownloader-0.2.0/AutoDL.py +--- autodownloader-0.2.0/AutoDL.py.orig 2007-10-04 13:34:39.000000000 +0200 ++++ autodownloader-0.2.0/AutoDL.py 2007-10-04 14:28:50.000000000 +0200 +@@ -244,7 +244,8 @@ class Downloader: + fs.write(md5 + " " + filename) + fs.close() + +- check_result = os.system("md5sum --status -c " + fname) ++ check_result = os.system("md5sum --status -c " + fname + ++ " 2> /dev/null") + os.remove(fname) + + if check_result == 0: +@@ -256,6 +257,10 @@ class Downloader: + self.remaining_files = filelist + for x in filelist: + download_complete = False ++ ++ if self.md5_check(x['path'] + '/' + x['filename'], x['md5']): ++ self.remaining_files = self.remaining_files[1:] ++ download_complete = True + + self.mirror_count = 0 + self.mirror_total = len (x['urllist']) diff --git a/autodownloader-0.2.0-unknown-file-size.patch b/autodownloader-0.2.0-unknown-file-size.patch new file mode 100644 index 0000000..da8f5aa --- /dev/null +++ b/autodownloader-0.2.0-unknown-file-size.patch @@ -0,0 +1,46 @@ +--- autodl/AutoDL.py 2007-11-26 12:31:17.000000000 +0100 ++++ autodl/AutoDL.py.new 2007-11-26 12:34:25.000000000 +0100 +@@ -235,7 +235,7 @@ + raise Next_mirror + + bytes = blocks * blocksize +- if bytes >= filesize: return ++ if (filesize > 0) and (bytes >= filesize): return + self.caller.report_progress(bytes, filesize) + + def md5_check(self, filename, md5): +@@ -406,18 +406,23 @@ + + def report_progress(self, bytes, filesize): + +- percentage = (100.0 * bytes) / filesize +- text_percent = "%s" % int (percentage) +- text_filesize = "%s" % int (filesize/1024) + text_downloaded = "%s" % int (bytes/1024) +- +- self.widgets['progressbar1'].set_text(text_percent + " %") +- self.widgets['progressbar1'].set_fraction(percentage/100) +- self.widgets['label13'].set_text(text_downloaded + " Kb / " + text_filesize + " Kb") +- if percentage >= 99.5: +- self.widgets['progressbar1'].set_fraction(1) +- self.widgets['progressbar1'].set_text("100 %") +- self.widgets['label13'].set_text(text_filesize + " Kb / " + text_filesize + " Kb") ++ if filesize > 0: ++ percentage = (100.0 * bytes) / filesize ++ text_percent = "%s" % int (percentage) ++ text_filesize = "%s" % int (filesize/1024) ++ ++ self.widgets['progressbar1'].set_text(text_percent + " %") ++ self.widgets['progressbar1'].set_fraction(percentage/100) ++ self.widgets['label13'].set_text(text_downloaded + " Kb / " + text_filesize + " Kb") ++ if percentage >= 99.5: ++ self.widgets['progressbar1'].set_fraction(1) ++ self.widgets['progressbar1'].set_text("100 %") ++ self.widgets['label13'].set_text(text_filesize + " Kb / " + text_filesize + " Kb") ++ else: ++ self.widgets['progressbar1'].set_text("Unknown file size") ++ self.widgets['label13'].set_text(text_downloaded + " Kb / Unkown") ++ self.widgets['progressbar1'].pulse() + + self.refresh() + diff --git a/autodownloader.spec b/autodownloader.spec index db1ec8b..46f2705 100644 --- a/autodownloader.spec +++ b/autodownloader.spec @@ -1,12 +1,14 @@ Name: autodownloader Version: 0.2.0 -Release: 3%{?dist} +Release: 5%{?dist} Summary: GUI-tool to automate the download of certain files License: GPLv2+ Group: Applications/Internet URL: http://sourceforge.net/projects/autodownloader Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz Patch0: autodownloader-0.2.0-timeout.patch +Patch1: autodownloader-0.2.0-check-existing-files.patch +Patch2: autodownloader-0.2.0-unknown-file-size.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch Requires: pygtk2-libglade @@ -30,6 +32,8 @@ are not permitted to be (re)distributed unlike most files in Fedora. %prep %setup -q %patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build @@ -52,6 +56,14 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Nov 29 2007 Hans de Goede 0.2.0-5 +- Apply patch from Ivo Manca fixing the downloading of files with an + unknown size, thanks! + +* Thu Oct 4 2007 Hans de Goede 0.2.0-4 +- Check if files exist (and have the correct md5sum) from a previous download + and skip downloading them (bz 309381) + * Fri Aug 3 2007 Hans de Goede 0.2.0-3 - Update License tag for new Licensing Guidelines compliance