diff --git a/couchpotato/core/notifications/base.py b/couchpotato/core/notifications/base.py index 7e98fa51..2604ef47 100644 --- a/couchpotato/core/notifications/base.py +++ b/couchpotato/core/notifications/base.py @@ -37,6 +37,9 @@ class Notification(Plugin): return notify + def getNotificationImage(self, size = 'small'): + return 'https://raw.github.com/RuudBurger/CouchPotatoServer/master/couchpotato/static/images/notify.couch.%s.png' % size + def notify(self, message = '', data = {}, listener = None): pass diff --git a/couchpotato/core/notifications/pushalot/main.py b/couchpotato/core/notifications/pushalot/main.py index 3b113311..1c82a25a 100644 --- a/couchpotato/core/notifications/pushalot/main.py +++ b/couchpotato/core/notifications/pushalot/main.py @@ -18,10 +18,10 @@ class Pushalot(Notification): 'AuthorizationToken': self.conf('auth_token'), 'Title': self.default_title, 'Body': toUnicode(message), - 'LinkTitle': toUnicode("CouchPotato"), - 'link': toUnicode("https://couchpota.to/"), 'IsImportant': self.conf('important'), 'IsSilent': self.conf('silent'), + 'Image': toUnicode(self.getNotificationImage('medium')), + 'Source': toUnicode(self.default_title) } headers = { diff --git a/couchpotato/core/notifications/xbmc/main.py b/couchpotato/core/notifications/xbmc/main.py index a1987bfa..0187a833 100755 --- a/couchpotato/core/notifications/xbmc/main.py +++ b/couchpotato/core/notifications/xbmc/main.py @@ -13,7 +13,6 @@ class XBMC(Notification): listen_to = ['renamer.after'] use_json_notifications = {} - couch_logo_url = 'https://raw.github.com/RuudBurger/CouchPotatoServer/master/couchpotato/static/images/xbmc-notify.png' def notify(self, message = '', data = {}, listener = None): if self.isDisabled(): return @@ -28,7 +27,7 @@ class XBMC(Notification): if self.use_json_notifications.get(host): response = self.request(host, [ - ('GUI.ShowNotification', {'title': self.default_title, 'message': message, 'image': self.couch_logo_url}), + ('GUI.ShowNotification', {'title': self.default_title, 'message': message, 'image': self.getNotificationImage('small')}), ('VideoLibrary.Scan', {}), ]) else: @@ -90,7 +89,7 @@ class XBMC(Notification): self.use_json_notifications[host] = True # send the text message - resp = self.request(host, [('GUI.ShowNotification', {'title':self.default_title, 'message':message, 'image':self.couch_logo_url})]) + resp = self.request(host, [('GUI.ShowNotification', {'title':self.default_title, 'message':message, 'image': self.getNotificationImage('small')})]) for result in resp: if (result.get('result') and result['result'] == 'OK'): log.debug('Message delivered successfully!') @@ -113,7 +112,7 @@ class XBMC(Notification): server = 'http://%s/xbmcCmds/' % host # Notification(title, message [, timeout , image]) - cmd = "xbmcHttp?command=ExecBuiltIn(Notification(%s,%s,'',%s))" % (urllib.quote(data['title']), urllib.quote(data['message']), urllib.quote(self.couch_logo_url)) + cmd = "xbmcHttp?command=ExecBuiltIn(Notification(%s,%s,'',%s))" % (urllib.quote(data['title']), urllib.quote(data['message']), urllib.quote(self.getNotificationImage('medium'))) server += cmd # I have no idea what to set to, just tried text/plain and seems to be working :) diff --git a/couchpotato/core/plugins/automation/__init__.py b/couchpotato/core/plugins/automation/__init__.py index b7b1ab28..440232b2 100644 --- a/couchpotato/core/plugins/automation/__init__.py +++ b/couchpotato/core/plugins/automation/__init__.py @@ -36,6 +36,20 @@ config = [{ 'unit': 'hours', 'description': 'hours', }, + { + 'name': 'required_genres', + 'label': 'Required Genres', + 'default': '', + 'placeholder': 'Example: Action, Crime & Drama', + 'description': 'Ignore movies that don\'t contain at least one set of genres. Sets are separated by "," and each word within a set must be separated with "&"' + }, + { + 'name': 'ignored_genres', + 'label': 'Ignored Genres', + 'default': '', + 'placeholder': 'Example: Horror, Comedy & Drama & Romance', + 'description': 'Ignore movies that contain at least one set of genres. Sets work the same as above.' + }, ], }, ], diff --git a/couchpotato/core/plugins/manage/__init__.py b/couchpotato/core/plugins/manage/__init__.py index 30f6ea68..46eee210 100644 --- a/couchpotato/core/plugins/manage/__init__.py +++ b/couchpotato/core/plugins/manage/__init__.py @@ -8,7 +8,7 @@ config = [{ 'groups': [ { 'tab': 'manage', - 'label': 'movie library manager', + 'label': 'Movie Library Manager', 'description': 'Add your existing movie folders.', 'options': [ { diff --git a/couchpotato/core/plugins/score/scores.py b/couchpotato/core/plugins/score/scores.py index 3d5a9e69..c9345fc0 100644 --- a/couchpotato/core/plugins/score/scores.py +++ b/couchpotato/core/plugins/score/scores.py @@ -116,13 +116,13 @@ def sizeScore(size): def providerScore(provider): - if provider in ['OMGWTFNZBs', 'PassThePopcorn', 'SceneAccess', 'TorrentLeech']: - return 20 - if provider in ['Newznab']: - return 10 + try: + score = tryInt(Env.setting('extra_score', section = provider.lower(), default = 0)) + except: + score = 0 - return 0 + return score def duplicateScore(nzb_name, movie_name): diff --git a/couchpotato/core/plugins/searcher/__init__.py b/couchpotato/core/plugins/searcher/__init__.py index a6dd6913..90cece46 100644 --- a/couchpotato/core/plugins/searcher/__init__.py +++ b/couchpotato/core/plugins/searcher/__init__.py @@ -40,6 +40,14 @@ config = [{ 'type': 'dropdown', 'values': [('usenet & torrents', 'both'), ('usenet', 'nzb'), ('torrents', 'torrent')], }, + { + 'name': 'always_search', + 'default': False, + 'advanced': True, + 'type': 'bool', + 'label': 'Always search', + 'description': 'Search for movies even before there is a ETA. Enabling this will probably get you a lot of fakes.', + }, ], }, { 'tab': 'searcher', diff --git a/couchpotato/core/plugins/searcher/main.py b/couchpotato/core/plugins/searcher/main.py index 1f320eab..b4c4937a 100644 --- a/couchpotato/core/plugins/searcher/main.py +++ b/couchpotato/core/plugins/searcher/main.py @@ -157,7 +157,7 @@ class Searcher(Plugin): ret = False for quality_type in movie['profile']['types']: - if not self.couldBeReleased(quality_type['quality']['identifier'] in pre_releases, release_dates): + if not self.conf('always_search') and not self.couldBeReleased(quality_type['quality']['identifier'] in pre_releases, release_dates): log.info('Too early to search for %s, %s', (quality_type['quality']['identifier'], default_title)) continue diff --git a/couchpotato/core/providers/automation/base.py b/couchpotato/core/providers/automation/base.py index 8d08f913..6aef58a1 100644 --- a/couchpotato/core/providers/automation/base.py +++ b/couchpotato/core/providers/automation/base.py @@ -2,6 +2,7 @@ from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.logger import CPLog from couchpotato.core.providers.base import Provider from couchpotato.environment import Env +from couchpotato.core.helpers.variable import splitString import time log = CPLog(__name__) @@ -59,7 +60,26 @@ class Automation(Provider): type_value = movie.get(minimal_type, 0) type_min = self.getMinimal(minimal_type) if type_value < type_min: - log.info('%s too low for %s, need %s has %s', (minimal_type, movie['imdb'], type_min, type_value)) + log.info('%s too low for %s, need %s has %s', (minimal_type, movie['original_title'], type_min, type_value)) + return False + + movie_genres = [genre.lower() for genre in movie['genres']] + required_genres = splitString(self.getMinimal('required_genres').lower()) + ignored_genres = splitString(self.getMinimal('ignored_genres').lower()) + + req_match = 0 + for req_set in required_genres: + req = splitString(req_set, '&') + req_match += len(list(set(movie_genres) & set(req))) == len(req) + + if self.getMinimal('required_genres') and req_match == 0: + log.info2("Required genre(s) missing for %s" % movie['original_title']) + return False + + for ign_set in ignored_genres: + ign = splitString(ign_set, '&') + if len(list(set(movie_genres) & set(ign))) == len(ign): + log.info2("%s has blacklisted genre(s): %s" % (movie['original_title'], ign)) return False return True diff --git a/couchpotato/core/providers/nzb/binsearch/__init__.py b/couchpotato/core/providers/nzb/binsearch/__init__.py index f4288b11..d3288604 100644 --- a/couchpotato/core/providers/nzb/binsearch/__init__.py +++ b/couchpotato/core/providers/nzb/binsearch/__init__.py @@ -18,6 +18,14 @@ config = [{ 'name': 'enabled', 'type': 'enabler', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/nzb/ftdworld/__init__.py b/couchpotato/core/providers/nzb/ftdworld/__init__.py index ca60ac4d..37aedb2a 100644 --- a/couchpotato/core/providers/nzb/ftdworld/__init__.py +++ b/couchpotato/core/providers/nzb/ftdworld/__init__.py @@ -27,6 +27,14 @@ config = [{ 'default': '', 'type': 'password', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/nzb/newznab/__init__.py b/couchpotato/core/providers/nzb/newznab/__init__.py index 9047d200..2349590f 100644 --- a/couchpotato/core/providers/nzb/newznab/__init__.py +++ b/couchpotato/core/providers/nzb/newznab/__init__.py @@ -30,13 +30,20 @@ config = [{ 'default': 'nzb.su,dognzb.cr,nzbs.org,https://index.nzbgeek.info', 'description': 'The hostname of your newznab provider', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'default': '0,0,0,0', + 'description': 'Starting score for each release found via this provider.', + }, { 'name': 'api_key', 'default': ',,,', 'label': 'Api Key', 'description': 'Can be found on your profile page', 'type': 'combined', - 'combine': ['use', 'host', 'api_key'], + 'combine': ['use', 'host', 'api_key', 'extra_score'], }, ], }, diff --git a/couchpotato/core/providers/nzb/newznab/main.py b/couchpotato/core/providers/nzb/newznab/main.py index 414e7112..11107c1f 100644 --- a/couchpotato/core/providers/nzb/newznab/main.py +++ b/couchpotato/core/providers/nzb/newznab/main.py @@ -1,6 +1,6 @@ from couchpotato.core.helpers.encoding import tryUrlencode from couchpotato.core.helpers.rss import RSS -from couchpotato.core.helpers.variable import cleanHost, splitString +from couchpotato.core.helpers.variable import cleanHost, splitString, tryInt from couchpotato.core.logger import CPLog from couchpotato.core.providers.base import ResultList from couchpotato.core.providers.nzb.base import NZBProvider @@ -76,6 +76,7 @@ class Newznab(NZBProvider, RSS): 'url': (self.getUrl(host['host'], self.urls['download']) % tryUrlencode(nzb_id)) + self.getApiExt(host), 'detail_url': '%sdetails/%s' % (cleanHost(host['host']), tryUrlencode(nzb_id)), 'content': self.getTextElement(nzb, 'description'), + 'score': host['extra_score'], }) def getHosts(self): @@ -83,13 +84,15 @@ class Newznab(NZBProvider, RSS): uses = splitString(str(self.conf('use'))) hosts = splitString(self.conf('host')) api_keys = splitString(self.conf('api_key')) + extra_score = splitString(self.conf('extra_score')) list = [] for nr in range(len(hosts)): list.append({ 'use': uses[nr], 'host': hosts[nr], - 'api_key': api_keys[nr] + 'api_key': api_keys[nr], + 'extra_score': tryInt(extra_score[nr]) if len(extra_score) > nr else 0 }) return list diff --git a/couchpotato/core/providers/nzb/nzbclub/__init__.py b/couchpotato/core/providers/nzb/nzbclub/__init__.py index 7859fe9c..9955462c 100644 --- a/couchpotato/core/providers/nzb/nzbclub/__init__.py +++ b/couchpotato/core/providers/nzb/nzbclub/__init__.py @@ -18,6 +18,14 @@ config = [{ 'name': 'enabled', 'type': 'enabler', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/nzb/nzbindex/__init__.py b/couchpotato/core/providers/nzb/nzbindex/__init__.py index 29eb0d38..aa8de4dd 100644 --- a/couchpotato/core/providers/nzb/nzbindex/__init__.py +++ b/couchpotato/core/providers/nzb/nzbindex/__init__.py @@ -19,6 +19,14 @@ config = [{ 'type': 'enabler', 'default': True, }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/nzb/nzbsrus/__init__.py b/couchpotato/core/providers/nzb/nzbsrus/__init__.py index 3a042784..863e6a37 100644 --- a/couchpotato/core/providers/nzb/nzbsrus/__init__.py +++ b/couchpotato/core/providers/nzb/nzbsrus/__init__.py @@ -35,6 +35,14 @@ config = [{ 'label': 'English only', 'description': 'Only search for English spoken movies on Nzbsrus', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/nzb/nzbx/__init__.py b/couchpotato/core/providers/nzb/nzbx/__init__.py index 9ce9226b..9cf80638 100644 --- a/couchpotato/core/providers/nzb/nzbx/__init__.py +++ b/couchpotato/core/providers/nzb/nzbx/__init__.py @@ -19,6 +19,14 @@ config = [{ 'type': 'enabler', 'default': True, }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/nzb/omgwtfnzbs/__init__.py b/couchpotato/core/providers/nzb/omgwtfnzbs/__init__.py index 287ced49..fe80518c 100644 --- a/couchpotato/core/providers/nzb/omgwtfnzbs/__init__.py +++ b/couchpotato/core/providers/nzb/omgwtfnzbs/__init__.py @@ -27,6 +27,14 @@ config = [{ 'label': 'Api Key', 'default': '', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'default': 20, + 'type': 'int', + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/torrent/iptorrents/__init__.py b/couchpotato/core/providers/torrent/iptorrents/__init__.py index bca8ce69..24f9772b 100644 --- a/couchpotato/core/providers/torrent/iptorrents/__init__.py +++ b/couchpotato/core/providers/torrent/iptorrents/__init__.py @@ -34,6 +34,14 @@ config = [{ 'type': 'bool', 'description': 'Only search for [FreeLeech] torrents.', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/torrent/kickasstorrents/__init__.py b/couchpotato/core/providers/torrent/kickasstorrents/__init__.py index 8ddb1f4a..999dbb1b 100644 --- a/couchpotato/core/providers/torrent/kickasstorrents/__init__.py +++ b/couchpotato/core/providers/torrent/kickasstorrents/__init__.py @@ -19,6 +19,14 @@ config = [{ 'type': 'enabler', 'default': True, }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/torrent/passthepopcorn/__init__.py b/couchpotato/core/providers/torrent/passthepopcorn/__init__.py index 06be7a89..a9f687c3 100644 --- a/couchpotato/core/providers/torrent/passthepopcorn/__init__.py +++ b/couchpotato/core/providers/torrent/passthepopcorn/__init__.py @@ -37,6 +37,14 @@ config = [{ { 'name': 'passkey', 'default': '', + }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 20, + 'description': 'Starting score for each release found via this provider.', } ], } diff --git a/couchpotato/core/providers/torrent/publichd/__init__.py b/couchpotato/core/providers/torrent/publichd/__init__.py index 2c356e20..3c27cf48 100644 --- a/couchpotato/core/providers/torrent/publichd/__init__.py +++ b/couchpotato/core/providers/torrent/publichd/__init__.py @@ -19,6 +19,14 @@ config = [{ 'type': 'enabler', 'default': True, }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/torrent/sceneaccess/__init__.py b/couchpotato/core/providers/torrent/sceneaccess/__init__.py index e12bf8bd..baad57f6 100644 --- a/couchpotato/core/providers/torrent/sceneaccess/__init__.py +++ b/couchpotato/core/providers/torrent/sceneaccess/__init__.py @@ -28,6 +28,14 @@ config = [{ 'default': '', 'type': 'password', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 20, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/torrent/scenehd/__init__.py b/couchpotato/core/providers/torrent/scenehd/__init__.py index 10c5e385..3cd2132e 100644 --- a/couchpotato/core/providers/torrent/scenehd/__init__.py +++ b/couchpotato/core/providers/torrent/scenehd/__init__.py @@ -28,6 +28,14 @@ config = [{ 'default': '', 'type': 'password', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/torrent/thepiratebay/__init__.py b/couchpotato/core/providers/torrent/thepiratebay/__init__.py index 38169084..f2394dd6 100644 --- a/couchpotato/core/providers/torrent/thepiratebay/__init__.py +++ b/couchpotato/core/providers/torrent/thepiratebay/__init__.py @@ -24,6 +24,14 @@ config = [{ 'advanced': True, 'label': 'Proxy server', 'description': 'Domain for requests, keep empty to let CouchPotato pick.', + }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', } ], } diff --git a/couchpotato/core/providers/torrent/torrentday/__init__.py b/couchpotato/core/providers/torrent/torrentday/__init__.py index 1a4d3c7f..de715b53 100644 --- a/couchpotato/core/providers/torrent/torrentday/__init__.py +++ b/couchpotato/core/providers/torrent/torrentday/__init__.py @@ -28,6 +28,14 @@ config = [{ 'default': '', 'type': 'password', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 0, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/core/providers/torrent/torrentleech/__init__.py b/couchpotato/core/providers/torrent/torrentleech/__init__.py index d96ac064..fa048d50 100644 --- a/couchpotato/core/providers/torrent/torrentleech/__init__.py +++ b/couchpotato/core/providers/torrent/torrentleech/__init__.py @@ -28,6 +28,14 @@ config = [{ 'default': '', 'type': 'password', }, + { + 'name': 'extra_score', + 'advanced': True, + 'label': 'Extra Score', + 'type': 'int', + 'default': 20, + 'description': 'Starting score for each release found via this provider.', + } ], }, ], diff --git a/couchpotato/static/images/notify.couch.large.png b/couchpotato/static/images/notify.couch.large.png new file mode 100644 index 00000000..e64347bd Binary files /dev/null and b/couchpotato/static/images/notify.couch.large.png differ diff --git a/couchpotato/static/images/notify.couch.medium.png b/couchpotato/static/images/notify.couch.medium.png new file mode 100644 index 00000000..c02974de Binary files /dev/null and b/couchpotato/static/images/notify.couch.medium.png differ diff --git a/couchpotato/static/images/xbmc-notify.png b/couchpotato/static/images/notify.couch.small.png similarity index 100% rename from couchpotato/static/images/xbmc-notify.png rename to couchpotato/static/images/notify.couch.small.png diff --git a/couchpotato/static/style/settings.css b/couchpotato/static/style/settings.css index 3af7dba7..a5655f88 100644 --- a/couchpotato/static/style/settings.css +++ b/couchpotato/static/style/settings.css @@ -133,6 +133,7 @@ display: inline-block; vertical-align: middle; padding-left: 2%; + line-height: 14px; } .page .check + .formHint { @@ -142,6 +143,7 @@ padding-left: 1% !important; height: 24px; vertical-align: middle; + line-height: 24px; } .page .ctrlHolder label { @@ -513,8 +515,21 @@ display: none; } .page .combined_table .head abbr.host { - margin-right: 197px; + margin-right: 190px; } + .page .combined_table .head abbr.api_key { + margin-right: 171px; + } + .page .combined_table .head .extra_score, + .page .combined_table .extra_score { + width: 70px; + text-align: center; + display: none; + } + .page.show_advanced .combined_table .head .extra_score, + .page.show_advanced .combined_table .extra_score { + display: inline-block; + } .page .combined_table .ctrlHolder { padding-top: 2px;