Notification update
This commit is contained in:
@@ -5,7 +5,7 @@ import os.path
|
||||
import re
|
||||
|
||||
|
||||
class Plugin():
|
||||
class Plugin(object):
|
||||
|
||||
def conf(self, attr, default = None):
|
||||
return Env.setting(attr, self.getName().lower(), default = default)
|
||||
@@ -35,4 +35,4 @@ class Plugin():
|
||||
return not self.isEnabled()
|
||||
|
||||
def isEnabled(self):
|
||||
return self.conf('enabled')
|
||||
return self.conf('enabled') or self.conf('enabled') == None
|
||||
|
||||
@@ -149,6 +149,10 @@ class Renamer(Plugin):
|
||||
if multiple:
|
||||
cd += 1
|
||||
|
||||
# Notify on download
|
||||
download_message = 'Download of %s (%s) successful.' % (group['library']['titles'][0]['title'], replacements['quality'])
|
||||
fireEvent('notify', type = 'movie.downloaded', message = download_message, data = replacements)
|
||||
|
||||
# Before renaming, remove the lower quality files
|
||||
db = get_session()
|
||||
library = db.query(Library).filter_by(identifier = group['library']['identifier']).first()
|
||||
@@ -172,6 +176,10 @@ class Renamer(Plugin):
|
||||
for rename_me in rename_files:
|
||||
filename = os.path.basename(rename_me)
|
||||
rename_files[rename_me] = rename_me.replace(filename, '_EXISTS_%s' % filename)
|
||||
|
||||
# Notify on rename fail
|
||||
download_message = 'Renaming of %s (%s) canceled, exists in %s already.' % (movie.library.titles[0].title, group['meta_data']['quality']['label'], release.quality.label)
|
||||
fireEvent('notify', type = 'movie.renaming.canceled', message = download_message, data = group)
|
||||
|
||||
break
|
||||
|
||||
@@ -200,7 +208,7 @@ class Renamer(Plugin):
|
||||
|
||||
#print rename_me, rename_files[rename_me]
|
||||
|
||||
# Search for trailers
|
||||
# Search for trailers etc
|
||||
fireEvent('renamer.after', group)
|
||||
|
||||
def moveFile(self, old, dest, suppress = True):
|
||||
|
||||
@@ -91,7 +91,6 @@ class Searcher(Plugin):
|
||||
successful = fireEvent('download', data = nzb, movie = movie, single = True)
|
||||
|
||||
if successful:
|
||||
log.info('Downloading of %s successful.' % nzb.get('name'))
|
||||
|
||||
# Mark release as snatched
|
||||
db = get_session()
|
||||
@@ -105,6 +104,9 @@ class Searcher(Plugin):
|
||||
mvie.status_id = snatched_status.get('id')
|
||||
db.commit()
|
||||
|
||||
log.info('Downloading of %s successful.' % nzb.get('name'))
|
||||
fireEvent('notify', type = 'movie.snatched', message = 'Downloading of %s successful.' % nzb.get('name'), data = rls.to_dict())
|
||||
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user