mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-02 09:49:36 +01:00
Merge branch 'incompleteread' into develop
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import urllib, urllib2, urlparse
|
import urllib, urllib2, urlparse, httplib
|
||||||
import lib.feedparser as feedparser
|
import lib.feedparser as feedparser
|
||||||
from lib.pygazelle import api as gazelleapi
|
from lib.pygazelle import api as gazelleapi
|
||||||
from lib.pygazelle import encoding as gazelleencoding
|
from lib.pygazelle import encoding as gazelleencoding
|
||||||
@@ -84,7 +84,17 @@ def url_fix(s, charset='utf-8'):
|
|||||||
scheme, netloc, path, qs, anchor = urlparse.urlsplit(s)
|
scheme, netloc, path, qs, anchor = urlparse.urlsplit(s)
|
||||||
path = urllib.quote(path, '/%')
|
path = urllib.quote(path, '/%')
|
||||||
qs = urllib.quote_plus(qs, ':&=')
|
qs = urllib.quote_plus(qs, ':&=')
|
||||||
return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
|
return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
|
||||||
|
|
||||||
|
def patch_http_response_read(func):
|
||||||
|
def inner(*args):
|
||||||
|
try:
|
||||||
|
return func(*args)
|
||||||
|
except httplib.IncompleteRead, e:
|
||||||
|
return e.partial
|
||||||
|
|
||||||
|
return inner
|
||||||
|
httplib.HTTPResponse.read = patch_http_response_read(httplib.HTTPResponse.read)
|
||||||
|
|
||||||
|
|
||||||
def searchforalbum(albumid=None, new=False, lossless=False):
|
def searchforalbum(albumid=None, new=False, lossless=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user