diff options
author | ehaupt <ehaupt@FreeBSD.org> | 2013-05-09 17:13:39 +0800 |
---|---|---|
committer | ehaupt <ehaupt@FreeBSD.org> | 2013-05-09 17:13:39 +0800 |
commit | 3ea0852cf960bacf83882465a3a58d8782f10aea (patch) | |
tree | 9b315826c2225b41cfd26773e84ff20464cde9d4 /multimedia/py-subliminal | |
parent | 8675ef32321b286638c9da3b542ba84f377a9c53 (diff) | |
download | freebsd-ports-gnome-3ea0852cf960bacf83882465a3a58d8782f10aea.tar.gz freebsd-ports-gnome-3ea0852cf960bacf83882465a3a58d8782f10aea.tar.zst freebsd-ports-gnome-3ea0852cf960bacf83882465a3a58d8782f10aea.zip |
Fix compatibility with py-requests 1.1 which is now default
PR: 178219
Submitted by: Ralf van der Enden <tremere@cainites.net>
Approved by: William Grzybowski <william88@gmail.com> (maintainer)
Diffstat (limited to 'multimedia/py-subliminal')
9 files changed, 149 insertions, 4 deletions
diff --git a/multimedia/py-subliminal/Makefile b/multimedia/py-subliminal/Makefile index 06cba60e1b0d..ef83c7c55ea8 100644 --- a/multimedia/py-subliminal/Makefile +++ b/multimedia/py-subliminal/Makefile @@ -3,6 +3,7 @@ PORTNAME= subliminal PORTVERSION= 0.6.3 +PORTREVISION= 1 CATEGORIES= multimedia python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -13,10 +14,11 @@ COMMENT= Python library to search and download subtitles LICENSE= LGPL3 RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}beautifulsoup>=4.0:${PORTSDIR}/www/py-beautifulsoup \ - ${PYTHON_PKGNAMEPREFIX}enzyme>0:${PORTSDIR}/multimedia/py-enzyme \ - ${PYTHON_PKGNAMEPREFIX}guessit>0:${PORTSDIR}/multimedia/py-guessit \ - ${PYTHON_PKGNAMEPREFIX}requests<1:${PORTSDIR}/www/py-requests \ - ${PYTHON_PKGNAMEPREFIX}html5lib>0:${PORTSDIR}/www/py-html5lib + ${PYTHON_PKGNAMEPREFIX}enzyme>=0.1:${PORTSDIR}/multimedia/py-enzyme \ + ${PYTHON_PKGNAMEPREFIX}guessit>=0.4.1:${PORTSDIR}/multimedia/py-guessit \ + ${PYTHON_PKGNAMEPREFIX}requests>=1.1:${PORTSDIR}/www/py-requests \ + ${PYTHON_PKGNAMEPREFIX}html5lib>0:${PORTSDIR}/www/py-html5lib \ + ${PYTHON_PKGNAMEPREFIX}lxml>0:${PORTSDIR}/devel/py-lxml USE_PYTHON= -2.7 USE_PYDISTUTILS= easy_install diff --git a/multimedia/py-subliminal/files/patch-setup.py b/multimedia/py-subliminal/files/patch-setup.py new file mode 100644 index 000000000000..7651eb9532ed --- /dev/null +++ b/multimedia/py-subliminal/files/patch-setup.py @@ -0,0 +1,11 @@ +--- setup.py.orig 2013-01-17 21:00:33.000000000 +0100 ++++ setup.py 2013-04-27 23:26:09.000000000 +0200 +@@ -24,7 +24,7 @@ + def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + +-required = ['beautifulsoup4 >= 4.0', 'guessit >= 0.4.1', 'requests < 1.0', 'enzyme >= 0.1', 'html5lib'] ++required = ['beautifulsoup4 >= 4.0', 'guessit >= 0.4.1', 'requests >= 1.1', 'enzyme >= 0.1', 'html5lib'] + if sys.hexversion < 0x20700f0: + required.append('argparse >= 1.1') + diff --git a/multimedia/py-subliminal/files/patch-subliminal__services____init__.py b/multimedia/py-subliminal/files/patch-subliminal__services____init__.py new file mode 100644 index 000000000000..ac08c92b11b6 --- /dev/null +++ b/multimedia/py-subliminal/files/patch-subliminal__services____init__.py @@ -0,0 +1,12 @@ +--- subliminal/services/__init__.py.orig 2013-01-17 20:47:10.000000000 +0100 ++++ subliminal/services/__init__.py 2013-04-27 23:33:06.000000000 +0200 +@@ -81,7 +81,8 @@ + def init(self): + """Initialize connection""" + logger.debug(u'Initializing %s' % self.__class__.__name__) +- self.session = requests.session(timeout=10, headers={'User-Agent': self.user_agent}) ++ self.session = requests.Session() ++ self.session.headers.update({'User-Agent': self.user_agent}) + + def init_cache(self): + """Initialize cache, make sure it is loaded from disk""" diff --git a/multimedia/py-subliminal/files/patch-subliminal__services__addic7ed.py b/multimedia/py-subliminal/files/patch-subliminal__services__addic7ed.py new file mode 100644 index 000000000000..62b3bd1d0fd5 --- /dev/null +++ b/multimedia/py-subliminal/files/patch-subliminal__services__addic7ed.py @@ -0,0 +1,29 @@ +--- subliminal/services/addic7ed.py.orig 2013-01-17 20:47:10.000000000 +0100 ++++ subliminal/services/addic7ed.py 2013-04-27 23:40:43.000000000 +0200 +@@ -48,7 +48,7 @@ + @cachedmethod + def get_series_id(self, name): + """Get the show page and cache every show found in it""" +- r = self.session.get('%s/shows.php' % self.server_url) ++ r = self.session.get('%s/shows.php' % self.server_url, timeout=self.timeout) + soup = BeautifulSoup(r.content, self.required_features) + for html_series in soup.select('h3 > a'): + series_name = html_series.text.lower() +@@ -70,7 +70,7 @@ + except KeyError: + logger.debug(u'Could not find series id for %s' % series) + return [] +- r = self.session.get('%s/show/%d&season=%d' % (self.server_url, series_id, season)) ++ r = self.session.get('%s/show/%d&season=%d' % (self.server_url, series_id, season), timeout=self.timeout) + soup = BeautifulSoup(r.content, self.required_features) + subtitles = [] + for row in soup('tr', {'class': 'epeven completed'}): +@@ -102,7 +102,7 @@ + def download(self, subtitle): + logger.info(u'Downloading %s in %s' % (subtitle.link, subtitle.path)) + try: +- r = self.session.get(subtitle.link, headers={'Referer': subtitle.link, 'User-Agent': self.user_agent}) ++ r = self.session.get(subtitle.link, timeout=self.timeout, headers={'Referer': subtitle.link}) + soup = BeautifulSoup(r.content, self.required_features) + if soup.title is not None and u'Addic7ed.com' in soup.title.text.strip(): + raise DownloadFailedError('Download limit exceeded') diff --git a/multimedia/py-subliminal/files/patch-subliminal__services__bierdopje.py b/multimedia/py-subliminal/files/patch-subliminal__services__bierdopje.py new file mode 100644 index 000000000000..a4f7b94f281e --- /dev/null +++ b/multimedia/py-subliminal/files/patch-subliminal__services__bierdopje.py @@ -0,0 +1,20 @@ +--- subliminal/services/bierdopje.py.orig 2013-01-17 20:47:10.000000000 +0100 ++++ subliminal/services/bierdopje.py 2013-04-27 23:42:59.000000000 +0200 +@@ -45,7 +45,7 @@ + + @cachedmethod + def get_show_id(self, series): +- r = self.session.get('%sGetShowByName/%s' % (self.server_url, urllib.quote(series.lower()))) ++ r = self.session.get('%sGetShowByName/%s' % (self.server_url, urllib.quote(series.lower())), timeout=self.timeout) + if r.status_code != 200: + logger.error(u'Request %s returned status code %d' % (r.url, r.status_code)) + return None +@@ -78,7 +78,7 @@ + subtitles = [] + for language in languages: + logger.debug(u'Getting subtitles for %s %d season %d episode %d with language %s' % (request_source, request_id, season, episode, language.alpha2)) +- r = self.session.get('%sGetAllSubsFor/%s/%s/%s/%s/%s' % (self.server_url, request_id, season, episode, language.alpha2, request_is_tvdbid)) ++ r = self.session.get('%sGetAllSubsFor/%s/%s/%s/%s/%s' % (self.server_url, request_id, season, episode, language.alpha2, request_is_tvdbid), timeout=self.timeout) + if r.status_code != 200: + logger.error(u'Request %s returned status code %d' % (r.url, r.status_code)) + return [] diff --git a/multimedia/py-subliminal/files/patch-subliminal__services__subswiki.py b/multimedia/py-subliminal/files/patch-subliminal__services__subswiki.py new file mode 100644 index 000000000000..1051ab5c1ccd --- /dev/null +++ b/multimedia/py-subliminal/files/patch-subliminal__services__subswiki.py @@ -0,0 +1,20 @@ +--- subliminal/services/subswiki.py.orig 2013-01-17 20:47:10.000000000 +0100 ++++ subliminal/services/subswiki.py 2013-04-27 23:44:34.000000000 +0200 +@@ -55,7 +55,7 @@ + if isinstance(request_series, unicode): + request_series = request_series.encode('utf-8') + logger.debug(u'Getting subtitles for %s season %d episode %d with languages %r' % (series, season, episode, languages)) +- r = self.session.get('%s/serie/%s/%s/%s/' % (self.server_url, urllib.quote(request_series), season, episode)) ++ r = self.session.get('%s/serie/%s/%s/%s/' % (self.server_url, urllib.quote(request_series), season, episode), timeout=self.timeout) + if r.status_code == 404: + logger.debug(u'Could not find subtitles for %s season %d episode %d with languages %r' % (series, season, episode, languages)) + return [] +@@ -64,7 +64,7 @@ + if isinstance(request_movie, unicode): + request_movie = request_movie.encode('utf-8') + logger.debug(u'Getting subtitles for %s (%d) with languages %r' % (movie, year, languages)) +- r = self.session.get('%s/film/%s_(%d)' % (self.server_url, urllib.quote(request_movie), year)) ++ r = self.session.get('%s/film/%s_(%d)' % (self.server_url, urllib.quote(request_movie), year), timeout=self.timeout) + if r.status_code == 404: + logger.debug(u'Could not find subtitles for %s (%d) with languages %r' % (movie, year, languages)) + return [] diff --git a/multimedia/py-subliminal/files/patch-subliminal__services__subtitulos.py b/multimedia/py-subliminal/files/patch-subliminal__services__subtitulos.py new file mode 100644 index 000000000000..b27ee959ad34 --- /dev/null +++ b/multimedia/py-subliminal/files/patch-subliminal__services__subtitulos.py @@ -0,0 +1,11 @@ +--- subliminal/services/subtitulos.py.orig 2013-01-17 20:47:10.000000000 +0100 ++++ subliminal/services/subtitulos.py 2013-04-27 23:45:04.000000000 +0200 +@@ -54,7 +54,7 @@ + if isinstance(request_series, unicode): + request_series = unicodedata.normalize('NFKD', request_series).encode('ascii', 'ignore') + logger.debug(u'Getting subtitles for %s season %d episode %d with languages %r' % (series, season, episode, languages)) +- r = self.session.get('%s/%s/%sx%.2d' % (self.server_url, urllib.quote(request_series), season, episode)) ++ r = self.session.get('%s/%s/%sx%.2d' % (self.server_url, urllib.quote(request_series), season, episode), timeout=self.timeout) + if r.status_code == 404: + logger.debug(u'Could not find subtitles for %s season %d episode %d with languages %r' % (series, season, episode, languages)) + return [] diff --git a/multimedia/py-subliminal/files/patch-subliminal__services__thesubdb.py b/multimedia/py-subliminal/files/patch-subliminal__services__thesubdb.py new file mode 100644 index 000000000000..070922bdb47e --- /dev/null +++ b/multimedia/py-subliminal/files/patch-subliminal__services__thesubdb.py @@ -0,0 +1,11 @@ +--- subliminal/services/thesubdb.py.orig 2013-01-17 20:47:10.000000000 +0100 ++++ subliminal/services/thesubdb.py 2013-04-27 23:47:24.000000000 +0200 +@@ -40,7 +40,7 @@ + return self.query(video.path, video.hashes['TheSubDB'], languages) + + def query(self, filepath, moviehash, languages): +- r = self.session.get(self.server_url, params={'action': 'search', 'hash': moviehash}) ++ r = self.session.get(self.server_url, timeout=self.timeout, params={'action': 'search', 'hash': moviehash}) + if r.status_code == 404: + logger.debug(u'Could not find subtitles for hash %s' % moviehash) + return [] diff --git a/multimedia/py-subliminal/files/patch-subliminal__services__tvsubtitles.py b/multimedia/py-subliminal/files/patch-subliminal__services__tvsubtitles.py new file mode 100644 index 000000000000..c0aabb61ad8f --- /dev/null +++ b/multimedia/py-subliminal/files/patch-subliminal__services__tvsubtitles.py @@ -0,0 +1,29 @@ +--- subliminal/services/tvsubtitles.py.orig 2013-01-17 20:47:10.000000000 +0100 ++++ subliminal/services/tvsubtitles.py 2013-04-27 23:48:50.000000000 +0200 +@@ -52,7 +52,7 @@ + + @cachedmethod + def get_likely_series_id(self, name): +- r = self.session.post('%s/search.php' % self.server_url, data={'q': name}) ++ r = self.session.post('%s/search.php' % self.server_url, data={'q': name}, timeout=self.timeout) + soup = BeautifulSoup(r.content, self.required_features) + maindiv = soup.find('div', 'left') + results = [] +@@ -70,7 +70,7 @@ + could be found.""" + # download the page of the season, contains ids for all episodes + episode_id = None +- r = self.session.get('%s/tvshow-%d-%d.html' % (self.server_url, series_id, season)) ++ r = self.session.get('%s/tvshow-%d-%d.html' % (self.server_url, series_id, season),timeout=self.timeout) + soup = BeautifulSoup(r.content, self.required_features) + table = soup.find('table', id='table5') + for row in table.find_all('tr'): +@@ -93,7 +93,7 @@ + # subtitles + def get_sub_ids(self, episode_id): + subids = [] +- r = self.session.get('%s/episode-%d.html' % (self.server_url, episode_id)) ++ r = self.session.get('%s/episode-%d.html' % (self.server_url, episode_id), timeout=self.timeout) + epsoup = BeautifulSoup(r.content, self.required_features) + for subdiv in epsoup.find_all('a'): + if 'href' not in subdiv.attrs or not subdiv['href'].startswith('/subtitle'): |