Merge branch 'refs/heads/develop'

This commit is contained in:
Ruud
2013-03-20 19:37:15 +01:00
31 changed files with 215 additions and 18 deletions
+3
View File
@@ -37,6 +37,9 @@ class Notification(Plugin):
return notify 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): def notify(self, message = '', data = {}, listener = None):
pass pass
@@ -18,10 +18,10 @@ class Pushalot(Notification):
'AuthorizationToken': self.conf('auth_token'), 'AuthorizationToken': self.conf('auth_token'),
'Title': self.default_title, 'Title': self.default_title,
'Body': toUnicode(message), 'Body': toUnicode(message),
'LinkTitle': toUnicode("CouchPotato"),
'link': toUnicode("https://couchpota.to/"),
'IsImportant': self.conf('important'), 'IsImportant': self.conf('important'),
'IsSilent': self.conf('silent'), 'IsSilent': self.conf('silent'),
'Image': toUnicode(self.getNotificationImage('medium')),
'Source': toUnicode(self.default_title)
} }
headers = { headers = {
+3 -4
View File
@@ -13,7 +13,6 @@ class XBMC(Notification):
listen_to = ['renamer.after'] listen_to = ['renamer.after']
use_json_notifications = {} 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): def notify(self, message = '', data = {}, listener = None):
if self.isDisabled(): return if self.isDisabled(): return
@@ -28,7 +27,7 @@ class XBMC(Notification):
if self.use_json_notifications.get(host): if self.use_json_notifications.get(host):
response = self.request(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', {}), ('VideoLibrary.Scan', {}),
]) ])
else: else:
@@ -90,7 +89,7 @@ class XBMC(Notification):
self.use_json_notifications[host] = True self.use_json_notifications[host] = True
# send the text message # 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: for result in resp:
if (result.get('result') and result['result'] == 'OK'): if (result.get('result') and result['result'] == 'OK'):
log.debug('Message delivered successfully!') log.debug('Message delivered successfully!')
@@ -113,7 +112,7 @@ class XBMC(Notification):
server = 'http://%s/xbmcCmds/' % host server = 'http://%s/xbmcCmds/' % host
# Notification(title, message [, timeout , image]) # 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 server += cmd
# I have no idea what to set to, just tried text/plain and seems to be working :) # I have no idea what to set to, just tried text/plain and seems to be working :)
@@ -36,6 +36,20 @@ config = [{
'unit': 'hours', 'unit': 'hours',
'description': '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.'
},
], ],
}, },
], ],
+1 -1
View File
@@ -8,7 +8,7 @@ config = [{
'groups': [ 'groups': [
{ {
'tab': 'manage', 'tab': 'manage',
'label': 'movie library manager', 'label': 'Movie Library Manager',
'description': 'Add your existing movie folders.', 'description': 'Add your existing movie folders.',
'options': [ 'options': [
{ {
+5 -5
View File
@@ -116,13 +116,13 @@ def sizeScore(size):
def providerScore(provider): def providerScore(provider):
if provider in ['OMGWTFNZBs', 'PassThePopcorn', 'SceneAccess', 'TorrentLeech']:
return 20
if provider in ['Newznab']: try:
return 10 score = tryInt(Env.setting('extra_score', section = provider.lower(), default = 0))
except:
score = 0
return 0 return score
def duplicateScore(nzb_name, movie_name): def duplicateScore(nzb_name, movie_name):
@@ -40,6 +40,14 @@ config = [{
'type': 'dropdown', 'type': 'dropdown',
'values': [('usenet & torrents', 'both'), ('usenet', 'nzb'), ('torrents', 'torrent')], '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', 'tab': 'searcher',
+1 -1
View File
@@ -157,7 +157,7 @@ class Searcher(Plugin):
ret = False ret = False
for quality_type in movie['profile']['types']: 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)) log.info('Too early to search for %s, %s', (quality_type['quality']['identifier'], default_title))
continue continue
+21 -1
View File
@@ -2,6 +2,7 @@ from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.providers.base import Provider from couchpotato.core.providers.base import Provider
from couchpotato.environment import Env from couchpotato.environment import Env
from couchpotato.core.helpers.variable import splitString
import time import time
log = CPLog(__name__) log = CPLog(__name__)
@@ -59,7 +60,26 @@ class Automation(Provider):
type_value = movie.get(minimal_type, 0) type_value = movie.get(minimal_type, 0)
type_min = self.getMinimal(minimal_type) type_min = self.getMinimal(minimal_type)
if type_value < type_min: 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 False
return True return True
@@ -18,6 +18,14 @@ config = [{
'name': 'enabled', 'name': 'enabled',
'type': 'enabler', 'type': 'enabler',
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -27,6 +27,14 @@ config = [{
'default': '', 'default': '',
'type': 'password', 'type': 'password',
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -30,13 +30,20 @@ config = [{
'default': 'nzb.su,dognzb.cr,nzbs.org,https://index.nzbgeek.info', 'default': 'nzb.su,dognzb.cr,nzbs.org,https://index.nzbgeek.info',
'description': 'The hostname of your newznab provider', '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', 'name': 'api_key',
'default': ',,,', 'default': ',,,',
'label': 'Api Key', 'label': 'Api Key',
'description': 'Can be found on your profile page', 'description': 'Can be found on your profile page',
'type': 'combined', 'type': 'combined',
'combine': ['use', 'host', 'api_key'], 'combine': ['use', 'host', 'api_key', 'extra_score'],
}, },
], ],
}, },
@@ -1,6 +1,6 @@
from couchpotato.core.helpers.encoding import tryUrlencode from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.rss import RSS 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.logger import CPLog
from couchpotato.core.providers.base import ResultList from couchpotato.core.providers.base import ResultList
from couchpotato.core.providers.nzb.base import NZBProvider 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), 'url': (self.getUrl(host['host'], self.urls['download']) % tryUrlencode(nzb_id)) + self.getApiExt(host),
'detail_url': '%sdetails/%s' % (cleanHost(host['host']), tryUrlencode(nzb_id)), 'detail_url': '%sdetails/%s' % (cleanHost(host['host']), tryUrlencode(nzb_id)),
'content': self.getTextElement(nzb, 'description'), 'content': self.getTextElement(nzb, 'description'),
'score': host['extra_score'],
}) })
def getHosts(self): def getHosts(self):
@@ -83,13 +84,15 @@ class Newznab(NZBProvider, RSS):
uses = splitString(str(self.conf('use'))) uses = splitString(str(self.conf('use')))
hosts = splitString(self.conf('host')) hosts = splitString(self.conf('host'))
api_keys = splitString(self.conf('api_key')) api_keys = splitString(self.conf('api_key'))
extra_score = splitString(self.conf('extra_score'))
list = [] list = []
for nr in range(len(hosts)): for nr in range(len(hosts)):
list.append({ list.append({
'use': uses[nr], 'use': uses[nr],
'host': hosts[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 return list
@@ -18,6 +18,14 @@ config = [{
'name': 'enabled', 'name': 'enabled',
'type': 'enabler', 'type': 'enabler',
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -19,6 +19,14 @@ config = [{
'type': 'enabler', 'type': 'enabler',
'default': True, 'default': True,
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -35,6 +35,14 @@ config = [{
'label': 'English only', 'label': 'English only',
'description': 'Only search for English spoken movies on Nzbsrus', '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.',
}
], ],
}, },
], ],
@@ -19,6 +19,14 @@ config = [{
'type': 'enabler', 'type': 'enabler',
'default': True, 'default': True,
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -27,6 +27,14 @@ config = [{
'label': 'Api Key', 'label': 'Api Key',
'default': '', 'default': '',
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'default': 20,
'type': 'int',
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -34,6 +34,14 @@ config = [{
'type': 'bool', 'type': 'bool',
'description': 'Only search for [FreeLeech] torrents.', '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.',
}
], ],
}, },
], ],
@@ -19,6 +19,14 @@ config = [{
'type': 'enabler', 'type': 'enabler',
'default': True, 'default': True,
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -37,6 +37,14 @@ config = [{
{ {
'name': 'passkey', 'name': 'passkey',
'default': '', 'default': '',
},
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 20,
'description': 'Starting score for each release found via this provider.',
} }
], ],
} }
@@ -19,6 +19,14 @@ config = [{
'type': 'enabler', 'type': 'enabler',
'default': True, 'default': True,
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -28,6 +28,14 @@ config = [{
'default': '', 'default': '',
'type': 'password', 'type': 'password',
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 20,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -28,6 +28,14 @@ config = [{
'default': '', 'default': '',
'type': 'password', 'type': 'password',
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -24,6 +24,14 @@ config = [{
'advanced': True, 'advanced': True,
'label': 'Proxy server', 'label': 'Proxy server',
'description': 'Domain for requests, keep empty to let CouchPotato pick.', '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.',
} }
], ],
} }
@@ -28,6 +28,14 @@ config = [{
'default': '', 'default': '',
'type': 'password', 'type': 'password',
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 0,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
@@ -28,6 +28,14 @@ config = [{
'default': '', 'default': '',
'type': 'password', 'type': 'password',
}, },
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',
'type': 'int',
'default': 20,
'description': 'Starting score for each release found via this provider.',
}
], ],
}, },
], ],
Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

+16 -1
View File
@@ -133,6 +133,7 @@
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
padding-left: 2%; padding-left: 2%;
line-height: 14px;
} }
.page .check + .formHint { .page .check + .formHint {
@@ -142,6 +143,7 @@
padding-left: 1% !important; padding-left: 1% !important;
height: 24px; height: 24px;
vertical-align: middle; vertical-align: middle;
line-height: 24px;
} }
.page .ctrlHolder label { .page .ctrlHolder label {
@@ -513,8 +515,21 @@
display: none; display: none;
} }
.page .combined_table .head abbr.host { .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 { .page .combined_table .ctrlHolder {
padding-top: 2px; padding-top: 2px;