diff --git a/couchpotato/core/notifications/base.py b/couchpotato/core/notifications/base.py index 254059e0..f4444fba 100644 --- a/couchpotato/core/notifications/base.py +++ b/couchpotato/core/notifications/base.py @@ -3,13 +3,14 @@ from couchpotato.core.event import addEvent from couchpotato.core.helpers.request import jsonified from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin +from couchpotato.environment import Env log = CPLog(__name__) class Notification(Plugin): - default_title = 'CouchPotato' + default_title = Env.get('appname') test_message = 'ZOMG Lazors Pewpewpew!' listen_to = ['movie.downloaded', 'movie.snatched', 'updater.available'] diff --git a/couchpotato/core/notifications/growl/main.py b/couchpotato/core/notifications/growl/main.py index 06accc87..40cc7e56 100644 --- a/couchpotato/core/notifications/growl/main.py +++ b/couchpotato/core/notifications/growl/main.py @@ -1,6 +1,7 @@ from couchpotato.core.event import fireEvent from couchpotato.core.logger import CPLog from couchpotato.core.notifications.base import Notification +from couchpotato.environment import Env from gntp import notifier import logging import traceback @@ -29,7 +30,7 @@ class Growl(Notification): port = self.conf('port') self.growl = notifier.GrowlNotifier( - applicationName = 'CouchPotato', + applicationName = Env.get('appname'), notifications = ["Updates"], defaultNotifications = ["Updates"], applicationIcon = '%s/static/images/couch.png' % fireEvent('app.api_url', single = True), diff --git a/couchpotato/core/providers/nzb/newznab/main.py b/couchpotato/core/providers/nzb/newznab/main.py index 57691b74..0d648a95 100644 --- a/couchpotato/core/providers/nzb/newznab/main.py +++ b/couchpotato/core/providers/nzb/newznab/main.py @@ -4,6 +4,7 @@ from couchpotato.core.helpers.rss import RSS from couchpotato.core.helpers.variable import cleanHost from couchpotato.core.logger import CPLog from couchpotato.core.providers.nzb.base import NZBProvider +from couchpotato.environment import Env from dateutil.parser import parse import time import xml.etree.ElementTree as XMLTree @@ -99,7 +100,7 @@ class Newznab(NZBProvider, RSS): def createItems(self, url, cache_key, host, single_cat = False, movie = None, quality = None, for_feed = False): results = [] - data = self.getCache(cache_key, url) + data = self.getCache(cache_key, url, cache_timeout = 1800, headers = {'User-Agent': Env.getIdentifier()}) if data: try: try: diff --git a/couchpotato/core/providers/nzb/nzbmatrix/main.py b/couchpotato/core/providers/nzb/nzbmatrix/main.py index e2b426b0..2a6e5a87 100644 --- a/couchpotato/core/providers/nzb/nzbmatrix/main.py +++ b/couchpotato/core/providers/nzb/nzbmatrix/main.py @@ -51,7 +51,7 @@ class NZBMatrix(NZBProvider, RSS): cache_key = 'nzbmatrix.%s.%s' % (movie['library'].get('identifier'), cat_ids) single_cat = True - data = self.getCache(cache_key, url, cache_timeout = 1800, headers = {'User-Agent': 'CouchPotato'}) + data = self.getCache(cache_key, url, cache_timeout = 1800, headers = {'User-Agent': Env.getIdentifier()}) if data: try: try: diff --git a/couchpotato/environment.py b/couchpotato/environment.py index 1ac184f0..d2fe5be8 100644 --- a/couchpotato/environment.py +++ b/couchpotato/environment.py @@ -5,6 +5,8 @@ import os class Env(object): + _appname = 'CouchPotato' + ''' Environment variables ''' _encoding = '' _uses_git = False @@ -96,3 +98,7 @@ class Env(object): return '%d %s' % (os.getpid(), '(%d)' % parent if parent and parent > 1 else '') except: return 0 + + @staticmethod + def getIdentifier(): + return '%s %s' % (Env.get('appname'), fireEvent('app.version', single = True))