[totem/gnome-3-10] opensubtitles: Make decoding download items work
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/gnome-3-10] opensubtitles: Make decoding download items work
- Date: Fri, 14 Mar 2014 10:06:22 +0000 (UTC)
commit 15872af34c156f68a6da484ca8ce139d44fa8f8a
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jan 30 11:48:56 2014 +0100
opensubtitles: Make decoding download items work
Stop using StringIO, gzip and base64 modules, and use GLib for
the base64 decoding, and zlib for the decompression.
https://bugzilla.gnome.org/show_bug.cgi?id=723074
src/plugins/opensubtitles/opensubtitles.py | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index 0339fc3..0109284 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -5,6 +5,7 @@ from gi.repository import Gio, Pango, Totem # pylint: disable-msg=E0611
import xmlrpclib
import threading
+import zlib
from os import sep, path, mkdir
import gettext
@@ -355,14 +356,11 @@ class OpenSubtitlesModel (object):
self._lock.release ()
return (None, error_message)
- import StringIO, gzip, base64
- subtitle_decoded = base64.decodestring (subtitle64)
- subtitle_gzipped = StringIO.StringIO (subtitle_decoded)
- subtitle_gzipped_file = gzip.GzipFile (fileobj=subtitle_gzipped)
+ subtitle_unzipped = zlib.decompress(GLib.base64_decode (subtitle64), 47)
self._lock.release ()
- return (subtitle_gzipped_file.read (), message)
+ return (subtitle_unzipped, message)
else:
message = log_in_message
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]