-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inline Testing from within NZBGet; fixes #21
- Loading branch information
Showing
3 changed files
with
239 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,9 @@ | |
# | ||
# Info about this Notify NZB Script: | ||
# Author: Chris Caron ([email protected]). | ||
# Date: Wed, Jul 5th, 2017. | ||
# Date: Wed, Jul 7th, 2017. | ||
# License: GPLv2 (http://www.gnu.org/licenses/gpl.html). | ||
# Script Version: 0.6.0 | ||
# Script Version: 0.6.1 | ||
# | ||
|
||
########################################################################### | ||
|
@@ -291,6 +291,9 @@ | |
# if they have this extra bit of detail in your logging output. | ||
#Debug=no | ||
|
||
# You can test your server configuration here. | ||
#TestServers@Test Server Configuration | ||
|
||
### NZBGET QUEUE/POST-PROCESSING SCRIPT | ||
########################################################################### | ||
import sys | ||
|
@@ -1150,6 +1153,53 @@ def hhmmss(seconds): | |
notify_type=notify_type, | ||
) | ||
|
||
def action_testservers(self, *args, **kwargs): | ||
""" | ||
Execute the TestServers Test Action | ||
""" | ||
|
||
if not self.validate(keys=( | ||
'Servers', | ||
'IncludeImage', | ||
'IncludeFiles', | ||
'IncludeStats', | ||
'IncludeLogs', | ||
'OnFailure', | ||
'OnSuccess', | ||
)): | ||
return False | ||
|
||
servers = self.parse_list(self.get('Servers', '')) | ||
on_failure = self.parse_bool(self.get('OnFailure')) | ||
on_success = self.parse_bool(self.get('OnSuccess')) | ||
|
||
include_stats = self.parse_bool(self.get('IncludeStats')) | ||
include_files = self.parse_bool(self.get('IncludeFiles')) | ||
include_logs = self.get('IncludeLogs', 'NO').upper() | ||
|
||
# Prepare our Test Response | ||
notify_type = NotifyType.INFO | ||
title='NZBGet-Notify Configuration Test' | ||
body='## NZBGet-Notify Configuration Test ##\r\n' | ||
body += '- **OnFailure**: %s\r\n' % ( | ||
'Yes' if on_failure else 'No') | ||
body += '- **OnSuccess**: %s\r\n' % ( | ||
'Yes' if on_success else 'No') | ||
body += '- **Include Statistics**: %s\r\n' % ( | ||
'Yes' if include_stats else 'No') | ||
body += '- **Include File Listings**: %s\r\n' % ( | ||
'Yes' if include_files else 'No') | ||
body += '- **Include Log Details**: %s\r\n' % ( | ||
'Yes' if include_logs else 'No') | ||
|
||
# Preform Notifications | ||
return self.notify( | ||
servers, | ||
title=title, | ||
body=body, | ||
notify_type=notify_type, | ||
) | ||
|
||
def main(self, *args, **kwargs): | ||
"""CLI | ||
""" | ||
|
Oops, something went wrong.