Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
added ability to change priority of SABnzbd downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
evilhero committed Sep 28, 2012
1 parent d1a4495 commit aa23a66
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
15 changes: 8 additions & 7 deletions data/interfaces/default/config.html
Expand Up @@ -122,14 +122,15 @@ <h1 class="clearfix"><img src="interfaces/default/images/icon_gear.png" alt="set
<label>SABnzbd Category:</label> <label>SABnzbd Category:</label>
<input type="text" name="sab_category" value="${config['sab_cat']}" size="20"> <input type="text" name="sab_category" value="${config['sab_cat']}" size="20">
</div> </div>
<div class="row radio clearfix">
<label>SABNzbd Priority:</label>
<input type="radio" name="sab_priority" value="1" ${config['sab_priority_1']} /><label>default Priority</label>
<input type="radio" name="sab_priority" value="2" ${config['sab_priority_2']} /><label>Low Priority</label>
<input type="radio" name="sab_priority" value="3" ${config['sab_priority_3']} /><label>Normal Priority</label>
<input type="radio" name="sab_priority" value="4" ${config['sab_priority_4']} /><label>High Priority</label>
<input type="radio" name="sab_priority" value="5" ${config['sab_priority_5']} /><label>Paused</label>
</div>
</fieldset> </fieldset>
<fieldset>
<legend>Downloads</legend>
<div class="row">
<label>Comic Download Directory:</label>
<small>Full path where SAB downloads your comics. e.g. /Users/name/Downloads/comics</small>
</div>
</fieldset>
</td> </td>


<td> <td>
Expand Down
5 changes: 4 additions & 1 deletion mylar/__init__.py
Expand Up @@ -109,6 +109,7 @@
SAB_PASSWORD = None SAB_PASSWORD = None
SAB_APIKEY = None SAB_APIKEY = None
SAB_CATEGORY = None SAB_CATEGORY = None
SAB_PRIORITY = None


NZBSU = False NZBSU = False
NZBSU_APIKEY = None NZBSU_APIKEY = None
Expand Down Expand Up @@ -185,7 +186,7 @@ def initialize():
HTTP_PORT, HTTP_HOST, HTTP_USERNAME, HTTP_PASSWORD, HTTP_ROOT, LAUNCH_BROWSER, GIT_PATH, \ HTTP_PORT, HTTP_HOST, HTTP_USERNAME, HTTP_PASSWORD, HTTP_ROOT, LAUNCH_BROWSER, GIT_PATH, \
CURRENT_VERSION, LATEST_VERSION, CHECK_GITHUB, CHECK_GITHUB_ON_STARTUP, CHECK_GITHUB_INTERVAL, MUSIC_DIR, DESTINATION_DIR, \ CURRENT_VERSION, LATEST_VERSION, CHECK_GITHUB, CHECK_GITHUB_ON_STARTUP, CHECK_GITHUB_INTERVAL, MUSIC_DIR, DESTINATION_DIR, \
DOWNLOAD_DIR, USENET_RETENTION, SEARCH_INTERVAL, INTERFACE, AUTOWANT_ALL, AUTOWANT_UPCOMING, \ DOWNLOAD_DIR, USENET_RETENTION, SEARCH_INTERVAL, INTERFACE, AUTOWANT_ALL, AUTOWANT_UPCOMING, \
LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, BLACKHOLE, BLACKHOLE_DIR, \ LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, SAB_PRIORITY, BLACKHOLE, BLACKHOLE_DIR, \
NZBSU, NZBSU_APIKEY, DOGNZB, DOGNZB_APIKEY, \ NZBSU, NZBSU_APIKEY, DOGNZB, DOGNZB_APIKEY, \
RAW, RAW_PROVIDER, RAW_USERNAME, RAW_PASSWORD, RAW_GROUPS, EXPERIMENTAL, \ RAW, RAW_PROVIDER, RAW_USERNAME, RAW_PASSWORD, RAW_GROUPS, EXPERIMENTAL, \
PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, \ PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, CORRECT_METADATA, FOLDER_FORMAT, FILE_FORMAT, REPLACE_CHAR, REPLACE_SPACES, \
Expand Down Expand Up @@ -247,6 +248,7 @@ def initialize():
SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '') SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')
SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '') SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '')
SAB_CATEGORY = check_setting_str(CFG, 'SABnzbd', 'sab_category', '') SAB_CATEGORY = check_setting_str(CFG, 'SABnzbd', 'sab_category', '')
SAB_PRIORITY = check_setting_int(CFG, 'SABnzbd', 'sab_priority', 0)


NZBSU = bool(check_setting_int(CFG, 'NZBsu', 'nzbsu', 0)) NZBSU = bool(check_setting_int(CFG, 'NZBsu', 'nzbsu', 0))
NZBSU_APIKEY = check_setting_str(CFG, 'NZBsu', 'nzbsu_apikey', '') NZBSU_APIKEY = check_setting_str(CFG, 'NZBsu', 'nzbsu_apikey', '')
Expand Down Expand Up @@ -456,6 +458,7 @@ def config_write():
new_config['SABnzbd']['sab_password'] = SAB_PASSWORD new_config['SABnzbd']['sab_password'] = SAB_PASSWORD
new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY
new_config['SABnzbd']['sab_category'] = SAB_CATEGORY new_config['SABnzbd']['sab_category'] = SAB_CATEGORY
new_config['SABnzbd']['sab_priority'] = SAB_PRIORITY


new_config['NZBsu'] = {} new_config['NZBsu'] = {}
new_config['NZBsu']['nzbsu'] = int(NZBSU) new_config['NZBsu']['nzbsu'] = int(NZBSU)
Expand Down
7 changes: 7 additions & 0 deletions mylar/search.py
Expand Up @@ -168,6 +168,11 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr):
elif mylar.PREFERRED_QUALITY == 1: filetype = ".cbr" elif mylar.PREFERRED_QUALITY == 1: filetype = ".cbr"
elif mylar.PREFERRED_QUALITY == 2: filetype = ".cbz" elif mylar.PREFERRED_QUALITY == 2: filetype = ".cbz"


if mylar.SAB_PRIORITY == 1: sabpriority = "-100"
elif mylar.SAB_PRIORITY == 2: sabpriority = "-1"
elif mylar.SAB_PRIORITY == 3: sabpriority = "0"
elif mylar.SAB_PRIORITY == 4: sabpriority = "1"
elif mylar.SAB_PRIORITY == 5: sabpriority = "-2"
# figure out what was missed via rss feeds and do a manual search via api # figure out what was missed via rss feeds and do a manual search via api
#tsc = int(tot-1) #tsc = int(tot-1)
findcomic = [] findcomic = []
Expand Down Expand Up @@ -479,6 +484,8 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr):
renameit = str(ComicNM) + " " + str(IssueNumber) + " (" + str(SeriesYear) + ")" + " " + "(" + str(comyear) + ")" renameit = str(ComicNM) + " " + str(IssueNumber) + " (" + str(SeriesYear) + ")" + " " + "(" + str(comyear) + ")"
renameit = renameit.replace(' ', repchar) renameit = renameit.replace(' ', repchar)
renamer = renameit.replace(' ', repurlchar) renamer = renameit.replace(' ', repurlchar)
nzo_prio = str(mylar.SAB_HOST) + "/api?mode=queue&name=priority&apikey=" + str(mylar.SAB_APIKEY) + "&value=" + str(slot_nzoid) + "&value2=" + str(sabpriority)
urllib2.urlopen(nzo_prio);
nzo_ren = str(mylar.SAB_HOST) + "/api?mode=queue&name=rename&apikey=" + str(mylar.SAB_APIKEY) + "&value=" + str(slot_nzoid) + "&value2=" + str(renamer) nzo_ren = str(mylar.SAB_HOST) + "/api?mode=queue&name=rename&apikey=" + str(mylar.SAB_APIKEY) + "&value=" + str(slot_nzoid) + "&value2=" + str(renamer)
urllib2.urlopen(nzo_ren); urllib2.urlopen(nzo_ren);
logger.info(u"Renamed nzb file in SABnzbd queue to : " + str(renameit)) logger.info(u"Renamed nzb file in SABnzbd queue to : " + str(renameit))
Expand Down

0 comments on commit aa23a66

Please sign in to comment.