]> git.dolda2000.com Git - automanga.git/commitdiff
Added clen attribute to imgstreams.
authorFredrik Tolf <fredrik@dolda2000.com>
Sat, 11 May 2013 04:18:34 +0000 (06:18 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Sat, 11 May 2013 04:18:34 +0000 (06:18 +0200)
manga/lib.py
manga/mangafox.py

index 8ec9c2eb9f7666eb1383caa57e579fb956b81a3a..d901e9fcd9d1e9f8b449dd7360108ea4caa26432 100644 (file)
@@ -115,7 +115,9 @@ class imgstream(object):
     when exiting the with-scope.
 
     All imgstreams should contain an attribute `ctype', being the
-    Content-Type of the image being read by the stream."""
+    Content-Type of the image being read by the stream, and `clen`,
+    being either an int describing the total number of bytes in the
+    stream, or None if the value is not known in advance."""
 
     def __enter__(self):
         return self
index 339ed5e182abaa62f0ece5ec5228e11ccdd7e24c..572853c82b5cb1dcd0f8444735472fb22ded80c9 100644 (file)
@@ -7,6 +7,7 @@ class imgstream(lib.imgstream):
     def __init__(self, url):
         self.bk = urllib.urlopen(url)
         self.ctype = self.bk.info()["Content-Type"]
+        self.clen = int(self.bk.info()["Content-Length"])
 
     def fileno(self):
         return self.bk.fileno()