From 2dc1c1dd388cb18716fdb02b6c4c6bbc44bcd107 Mon Sep 17 00:00:00 2001 From: peerster Date: Thu, 19 Feb 2015 20:07:22 +0100 Subject: [PATCH 1/9] Update torrentshack with new URL --- .../media/_base/providers/torrent/torrentshack.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/torrentshack.py b/couchpotato/core/media/_base/providers/torrent/torrentshack.py index b65222b3..71f4e625 100644 --- a/couchpotato/core/media/_base/providers/torrent/torrentshack.py +++ b/couchpotato/core/media/_base/providers/torrent/torrentshack.py @@ -13,12 +13,12 @@ log = CPLog(__name__) class Base(TorrentProvider): urls = { - 'test': 'http://torrentshack.eu/', - 'login': 'http://torrentshack.eu/login.php', - 'login_check': 'http://torrentshack.eu/inbox.php', - 'detail': 'http://torrentshack.eu/torrent/%s', - 'search': 'http://torrentshack.eu/torrents.php?action=advanced&searchstr=%s&scene=%s&filter_cat[%d]=1', - 'download': 'http://torrentshack.eu/%s', + 'test': 'https://theshack.us.to/', + 'login': 'https://theshack.us.to/login.php', + 'login_check': 'https://theshack.us.to/inbox.php', + 'detail': 'https://theshack.us.to/torrent/%s', + 'search': 'https://theshack.us.to/torrents.php?action=advanced&searchstr=%s&scene=%s&filter_cat[%d]=1', + 'download': 'https://theshack.us.to/%s', } http_time_between_calls = 1 # Seconds From b19b0775c7ca540c42a2fe9ed7aa36a43767689d Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 20 Feb 2015 22:16:12 +0100 Subject: [PATCH 2/9] Force update to new poster on refresh fix #4671 --- couchpotato/core/media/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/media/__init__.py b/couchpotato/core/media/__init__.py index 7a178b85..0d98600d 100755 --- a/couchpotato/core/media/__init__.py +++ b/couchpotato/core/media/__init__.py @@ -1,9 +1,10 @@ import os import traceback -from couchpotato import CPLog +from couchpotato import CPLog, md5 from couchpotato.core.event import addEvent, fireEvent, fireEventAsync from couchpotato.core.helpers.encoding import toUnicode +from couchpotato.core.helpers.variable import getExt from couchpotato.core.plugins.base import Plugin import six @@ -92,7 +93,15 @@ class MediaBase(Plugin): if not isinstance(image, (str, unicode)): continue - if file_type not in existing_files or len(existing_files.get(file_type, [])) == 0: + # Check if it has top image + filename = '%s.%s' % (md5(image), getExt(image)) + existing = existing_files.get(file_type, []) + has_latest = False + for x in existing: + if filename in x: + has_latest = True + + if not has_latest or file_type not in existing_files or len(existing_files.get(file_type, [])) == 0: file_path = fireEvent('file.download', url = image, single = True) if file_path: existing_files[file_type] = [toUnicode(file_path)] From f8631c6d536ec19ac5e6ecadee42d00006c0d8b4 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 21 Feb 2015 21:29:37 +0100 Subject: [PATCH 3/9] Add extra category for TorrentLeech fix #4683 --- .../core/media/_base/providers/torrent/torrentleech.py | 2 +- .../core/media/movie/providers/torrent/torrentleech.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/media/_base/providers/torrent/torrentleech.py b/couchpotato/core/media/_base/providers/torrent/torrentleech.py index 83eb5f1f..3daa10b2 100644 --- a/couchpotato/core/media/_base/providers/torrent/torrentleech.py +++ b/couchpotato/core/media/_base/providers/torrent/torrentleech.py @@ -17,7 +17,7 @@ class Base(TorrentProvider): 'login': 'https://www.torrentleech.org/user/account/login/', 'login_check': 'https://torrentleech.org/user/messages', 'detail': 'https://www.torrentleech.org/torrent/%s', - 'search': 'https://www.torrentleech.org/torrents/browse/index/query/%s/categories/%d', + 'search': 'https://www.torrentleech.org/torrents/browse/index/query/%s/categories/%s', 'download': 'https://www.torrentleech.org%s', } diff --git a/couchpotato/core/media/movie/providers/torrent/torrentleech.py b/couchpotato/core/media/movie/providers/torrent/torrentleech.py index d72f4257..eea74f80 100644 --- a/couchpotato/core/media/movie/providers/torrent/torrentleech.py +++ b/couchpotato/core/media/movie/providers/torrent/torrentleech.py @@ -16,12 +16,12 @@ class TorrentLeech(MovieProvider, Base): ([9], ['ts', 'tc']), ([10], ['r5', 'scr']), ([11], ['dvdrip']), - ([14], ['brrip']), + ([13, 14], ['brrip']), ([12], ['dvdr']), ] def buildUrl(self, title, media, quality): return ( tryUrlencode(title.replace(':', '')), - self.getCatId(quality)[0] + ','.join([str(x) for x in self.getCatId(quality)]) ) From 84a458d40b34de64a2d538a037b0d54e6d765d96 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 22 Feb 2015 13:06:29 +0100 Subject: [PATCH 4/9] Add user-agent and type to omdbapi --- couchpotato/core/media/movie/providers/info/omdbapi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/media/movie/providers/info/omdbapi.py b/couchpotato/core/media/movie/providers/info/omdbapi.py index d3a83b63..16f30adc 100644 --- a/couchpotato/core/media/movie/providers/info/omdbapi.py +++ b/couchpotato/core/media/movie/providers/info/omdbapi.py @@ -2,6 +2,7 @@ import json import re import traceback +from couchpotato import Env from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.helpers.encoding import tryUrlencode from couchpotato.core.helpers.variable import tryInt, tryFloat, splitString @@ -17,8 +18,8 @@ autoload = 'OMDBAPI' class OMDBAPI(MovieProvider): urls = { - 'search': 'http://www.omdbapi.com/?%s', - 'info': 'http://www.omdbapi.com/?i=%s', + 'search': 'http://www.omdbapi.com/?type=movie&%s', + 'info': 'http://www.omdbapi.com/?type=movie&i=%s', } http_time_between_calls = 0 @@ -38,7 +39,8 @@ class OMDBAPI(MovieProvider): } cache_key = 'omdbapi.cache.%s' % q - cached = self.getCache(cache_key, self.urls['search'] % tryUrlencode({'t': name_year.get('name'), 'y': name_year.get('year', '')}), timeout = 3) + url = self.urls['search'] % tryUrlencode({'t': name_year.get('name'), 'y': name_year.get('year', '')}) + cached = self.getCache(cache_key, url, timeout = 3, headers = {'User-Agent': Env.getIdentifier()}) if cached: result = self.parseMovie(cached) @@ -56,7 +58,7 @@ class OMDBAPI(MovieProvider): return {} cache_key = 'omdbapi.cache.%s' % identifier - cached = self.getCache(cache_key, self.urls['info'] % identifier, timeout = 3) + cached = self.getCache(cache_key, self.urls['info'] % identifier, timeout = 3, headers = {'User-Agent': Env.getIdentifier()}) if cached: result = self.parseMovie(cached) From 99a06212387814f42922c6e8957bbe60e3a505a0 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 22 Feb 2015 14:30:50 +0100 Subject: [PATCH 5/9] Use keep-alive connection --- couchpotato/core/plugins/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index e4b27c9b..6d63b83c 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -196,7 +196,7 @@ class Plugin(object): headers['Host'] = headers.get('Host', None) headers['User-Agent'] = headers.get('User-Agent', self.user_agent) headers['Accept-encoding'] = headers.get('Accept-encoding', 'gzip') - headers['Connection'] = headers.get('Connection', 'close') + headers['Connection'] = headers.get('Connection', 'keep-alive') headers['Cache-Control'] = headers.get('Cache-Control', 'max-age=0') r = Env.get('http_opener') From 6b8458d87f8f1b3b527300b3c10c6ff174a02015 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 22 Feb 2015 14:49:37 +0100 Subject: [PATCH 6/9] Hadouken apikey check not using correct settingskey fix #4674 --- couchpotato/core/downloaders/hadouken.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/downloaders/hadouken.py b/couchpotato/core/downloaders/hadouken.py index c7dddbe7..c89ed0e7 100644 --- a/couchpotato/core/downloaders/hadouken.py +++ b/couchpotato/core/downloaders/hadouken.py @@ -31,7 +31,7 @@ class Hadouken(DownloaderBase): log.error('Config properties are not filled in correctly, port is missing.') return False - if not self.conf('apikey'): + if not self.conf('api_key'): log.error('Config properties are not filled in correctly, API key is missing.') return False From 6598f53fd48df344fac30a71c7a16aaab45acfd8 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 22 Feb 2015 15:55:54 +0100 Subject: [PATCH 7/9] Quality check improve --- couchpotato/core/plugins/quality/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index 96fb1a3a..7d80f728 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -240,7 +240,7 @@ class QualityPlugin(Plugin): # Add additional size score if only 1 size validated if len(size_scores) == 1: - self.calcScore(score, size_scores[0], 8) + self.calcScore(score, size_scores[0], 7) del size_scores # Return nothing if all scores are <= 0 @@ -491,6 +491,7 @@ class QualityPlugin(Plugin): 'Movie Name.2014.720p Web-Dl Aac2.0 h264-ReleaseGroup': {'size': 3800, 'quality': 'brrip'}, 'Movie Name.2014.720p.WEBRip.x264.AC3-ReleaseGroup': {'size': 3000, 'quality': 'scr'}, 'Movie.Name.2014.1080p.HDCAM.-.ReleaseGroup': {'size': 5300, 'quality': 'cam'}, + 'Movie.Name.2014.720p.HDSCR.4PARTS.MP4.AAC.ReleaseGroup': {'size': 2401, 'quality': 'scr'}, } correct = 0 From 0d6c3c8ecb270f04cf336662f8f61666dcdf4b76 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 22 Feb 2015 16:06:07 +0100 Subject: [PATCH 8/9] Yify, only use data when available --- couchpotato/core/media/_base/providers/torrent/yify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/media/_base/providers/torrent/yify.py b/couchpotato/core/media/_base/providers/torrent/yify.py index 492eeb65..4071a156 100644 --- a/couchpotato/core/media/_base/providers/torrent/yify.py +++ b/couchpotato/core/media/_base/providers/torrent/yify.py @@ -41,7 +41,7 @@ class Base(TorrentProvider): data = self.getJsonData(search_url) data = data.get('data') - if data and data.get('movies'): + if isinstance(data, dict) and data.get('movies'): try: for result in data.get('movies'): From 0f82cda811c635d71d0d539b73f56fabd257431f Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 22 Feb 2015 16:09:22 +0100 Subject: [PATCH 9/9] Remove podnapisi from subtile list --- couchpotato/core/plugins/subtitle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/subtitle.py b/couchpotato/core/plugins/subtitle.py index 1766088e..e8baef0d 100644 --- a/couchpotato/core/plugins/subtitle.py +++ b/couchpotato/core/plugins/subtitle.py @@ -16,7 +16,7 @@ autoload = 'Subtitle' class Subtitle(Plugin): - services = ['opensubtitles', 'thesubdb', 'subswiki', 'podnapisi', 'subscenter'] + services = ['opensubtitles', 'thesubdb', 'subswiki', 'subscenter'] def __init__(self): addEvent('renamer.before', self.searchSingle)