Permalink
Browse files

added ability to change priority of SABnzbd downloads

  • Loading branch information...
1 parent d1a4495 commit aa23a663bae0edddb54ca0ad85f760806e376efc @evilhero committed Sep 28, 2012
Showing with 19 additions and 8 deletions.
  1. +8 −7 data/interfaces/default/config.html
  2. +4 −1 mylar/__init__.py
  3. +7 −0 mylar/search.py
@@ -122,14 +122,15 @@ <h1 class="clearfix"><img src="interfaces/default/images/icon_gear.png" alt="set
<label>SABnzbd Category:</label>
<input type="text" name="sab_category" value="${config['sab_cat']}" size="20">
</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>
- <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>
View
@@ -109,6 +109,7 @@
SAB_PASSWORD = None
SAB_APIKEY = None
SAB_CATEGORY = None
+SAB_PRIORITY = None
NZBSU = False
NZBSU_APIKEY = None
@@ -185,7 +186,7 @@ def initialize():
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, \
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, \
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, \
@@ -247,6 +248,7 @@ def initialize():
SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '')
SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '')
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_APIKEY = check_setting_str(CFG, 'NZBsu', 'nzbsu_apikey', '')
@@ -456,6 +458,7 @@ def config_write():
new_config['SABnzbd']['sab_password'] = SAB_PASSWORD
new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY
new_config['SABnzbd']['sab_category'] = SAB_CATEGORY
+ new_config['SABnzbd']['sab_priority'] = SAB_PRIORITY
new_config['NZBsu'] = {}
new_config['NZBsu']['nzbsu'] = int(NZBSU)
View
@@ -168,6 +168,11 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr):
elif mylar.PREFERRED_QUALITY == 1: filetype = ".cbr"
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
#tsc = int(tot-1)
findcomic = []
@@ -479,6 +484,8 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr):
renameit = str(ComicNM) + " " + str(IssueNumber) + " (" + str(SeriesYear) + ")" + " " + "(" + str(comyear) + ")"
renameit = renameit.replace(' ', repchar)
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)
urllib2.urlopen(nzo_ren);
logger.info(u"Renamed nzb file in SABnzbd queue to : " + str(renameit))

0 comments on commit aa23a66

Please sign in to comment.