");
+ option.attr("value",group);
+ option.html(group);
+ option.appendTo('#black');
+});
\ No newline at end of file
diff --git a/gui/slick/js/newShow.js b/gui/slick/js/newShow.js
index 8ec6157b..290305c0 100644
--- a/gui/slick/js/newShow.js
+++ b/gui/slick/js/newShow.js
@@ -84,7 +84,7 @@ $(document).ready(function () {
resultStr += ''
+ ' '
+ ('' == show_name ? 'into ' : ' into')
+ ' ';
@@ -275,4 +276,34 @@ $(document).ready(function () {
});
});
+ $('#anime').change (function () {
+ updateSampleText();
+ myform.loadsection(2);
+ });
+
+ function update_bwlist (show_name) {
+
+ $('#white').children().remove();
+ $('#black').children().remove();
+ $('#pool').children().remove();
+
+ if ($('#anime').prop('checked')) {
+ $('#blackwhitelist').show();
+ if (show_name) {
+ $.getJSON(sbRoot + '/home/fetch_releasegroups', {'show_name': show_name}, function (data) {
+ if (data['result'] == 'success') {
+ $.each(data.groups, function(i, group) {
+ var option = $("");
+ option.attr("value", group.name);
+ option.html(group.name + ' | ' + group.rating + ' | ' + group.range);
+ option.appendTo('#pool');
+ });
+ }
+ });
+ }
+ } else {
+ $('#blackwhitelist').hide();
+ }
+ };
+
});
diff --git a/sickbeard/blackandwhitelist.py b/sickbeard/blackandwhitelist.py
index 75737710..82353295 100644
--- a/sickbeard/blackandwhitelist.py
+++ b/sickbeard/blackandwhitelist.py
@@ -16,7 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with Sick Beard. If not, see .
-from sickbeard import db, logger
+import sickbeard
+from sickbeard import db, logger, helpers
class BlackAndWhiteList(object):
@@ -71,6 +72,10 @@ class BlackAndWhiteList(object):
def is_valid(self, result):
+ if not result.release_group:
+ logger.log('Failed to detect release group, invalid result', logger.DEBUG)
+ return False
+
if result.release_group.lower() in [x.lower() for x in self.whitelist]:
white_result = True
else:
@@ -88,5 +93,23 @@ class BlackAndWhiteList(object):
else:
return False
+
class BlackWhitelistNoShowIDException(Exception):
- 'No show_id was given'
\ No newline at end of file
+ 'No show_id was given'
+
+
+def short_group_names(groups):
+ groups = groups.split(",")
+ shortGroupList = []
+ if helpers.set_up_anidb_connection():
+ for groupName in groups:
+ group = sickbeard.ADBA_CONNECTION.group(gname=groupName)
+ for line in group.datalines:
+ if line["shortname"]:
+ shortGroupList.append(line["shortname"])
+ else:
+ if not groupName in shortGroupList:
+ shortGroupList.append(groupName)
+ else:
+ shortGroupList = groups
+ return shortGroupList
\ No newline at end of file
diff --git a/sickbeard/show_queue.py b/sickbeard/show_queue.py
index 16e162c3..393dc838 100644
--- a/sickbeard/show_queue.py
+++ b/sickbeard/show_queue.py
@@ -31,7 +31,6 @@ from sickbeard import name_cache
from sickbeard.exceptions import ex
from sickbeard.blackandwhitelist import BlackAndWhiteList
-
class ShowQueue(generic_queue.GenericQueue):
def __init__(self):
generic_queue.GenericQueue.__init__(self)
@@ -133,9 +132,9 @@ class ShowQueue(generic_queue.GenericQueue):
return queueItemObj
def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None,
- lang="en", subtitles=None, anime=None, scene=None, paused=None):
+ lang="en", subtitles=None, anime=None, scene=None, paused=None, blacklist=None, whitelist=None):
queueItemObj = QueueItemAdd(indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang,
- subtitles, anime, scene, paused)
+ subtitles, anime, scene, paused, blacklist, whitelist)
self.add_item(queueItemObj)
@@ -192,7 +191,7 @@ class ShowQueueItem(generic_queue.QueueItem):
class QueueItemAdd(ShowQueueItem):
def __init__(self, indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, subtitles, anime,
- scene, paused):
+ scene, paused, blacklist, whitelist):
self.indexer = indexer
self.indexer_id = indexer_id
@@ -205,6 +204,8 @@ class QueueItemAdd(ShowQueueItem):
self.anime = anime
self.scene = scene
self.paused = paused
+ self.blacklist = blacklist
+ self.whitelist = whitelist
self.show = None
@@ -296,6 +297,10 @@ class QueueItemAdd(ShowQueueItem):
if self.show.anime:
self.show.release_groups = BlackAndWhiteList(self.show.indexerid)
+ if self.blacklist:
+ self.show.release_groups.set_black_keywords(self.blacklist)
+ if self.whitelist:
+ self.show.release_groups.set_white_keywords(self.whitelist)
# be smartish about this
if self.show.genre and "talk show" in self.show.genre.lower():
diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py
index 7577f8e2..95798741 100644
--- a/sickbeard/webserve.py
+++ b/sickbeard/webserve.py
@@ -58,7 +58,7 @@ from sickbeard.scene_numbering import get_scene_numbering, set_scene_numbering,
get_xem_numbering_for_show, get_scene_absolute_numbering_for_show, get_xem_absolute_numbering_for_show, \
get_scene_absolute_numbering
-from sickbeard.blackandwhitelist import BlackAndWhiteList
+from sickbeard.blackandwhitelist import BlackAndWhiteList, short_group_names
from browser import WebFileBrowser
from mimetypes import MimeTypes
@@ -2871,6 +2871,9 @@ class NewHomeAddShows(MainHandler):
t.other_shows = other_shows
t.provided_indexer = int(indexer or sickbeard.INDEXER_DEFAULT)
t.indexers = sickbeard.indexerApi().indexers
+ t.whitelist = []
+ t.blacklist = []
+ t.groups = []
return _munge(t)
@@ -2971,6 +2974,9 @@ class NewHomeAddShows(MainHandler):
"""
t = PageTemplate(headers=self.request.headers, file="home_addExistingShow.tmpl")
t.submenu = HomeMenu()
+ t.whitelist = []
+ t.blacklist = []
+ t.groups = []
return _munge(t)
@@ -2982,7 +2988,7 @@ class NewHomeAddShows(MainHandler):
def addNewShow(self, whichSeries=None, indexerLang="en", rootDir=None, defaultStatus=None,
anyQualities=None, bestQualities=None, flatten_folders=None, subtitles=None,
fullShowPath=None, other_shows=None, skipShow=None, providedIndexer=None, anime=None,
- scene=None):
+ scene=None, blacklist=None, whitelist=None):
"""
Receive tvdb id, dir, and other options and create a show from them. If extra show dirs are
provided then it forwards back to newShow, if not it goes to /home.
@@ -3065,6 +3071,11 @@ class NewHomeAddShows(MainHandler):
flatten_folders = config.checkbox_to_value(flatten_folders)
subtitles = config.checkbox_to_value(subtitles)
+ if whitelist:
+ whitelist = short_group_names(whitelist)
+ if blacklist:
+ blacklist = short_group_names(blacklist)
+
if not anyQualities:
anyQualities = []
if not bestQualities:
@@ -3078,7 +3089,7 @@ class NewHomeAddShows(MainHandler):
# add the show
sickbeard.showQueueScheduler.action.addShow(indexer, indexer_id, show_dir, int(defaultStatus), newQuality,
flatten_folders, indexerLang, subtitles, anime,
- scene) # @UndefinedVariable
+ scene, None, blacklist, whitelist) # @UndefinedVariable
ui.notifications.message('Show added', 'Adding the specified show into ' + show_dir)
return finishAddShow()
@@ -3862,40 +3873,15 @@ class Home(MainHandler):
if anime:
if not showObj.release_groups:
showObj.release_groups = BlackAndWhiteList(showObj.indexerid)
-
if whitelist:
- whitelist = whitelist.split(",")
- shortWhiteList = []
- if helpers.set_up_anidb_connection():
- for groupName in whitelist:
- group = sickbeard.ADBA_CONNECTION.group(gname=groupName)
- for line in group.datalines:
- if line["shortname"]:
- shortWhiteList.append(line["shortname"])
- else:
- if not groupName in shortWhiteList:
- shortWhiteList.append(groupName)
- else:
- shortWhiteList = whitelist
- showObj.release_groups.set_white_keywords(shortWhiteList)
+ shortwhitelist = short_group_names(whitelist)
+ showObj.release_groups.set_white_keywords(shortwhitelist)
else:
showObj.release_groups.set_white_keywords([])
if blacklist:
- blacklist = blacklist.split(",")
- shortBlacklist = []
- if helpers.set_up_anidb_connection():
- for groupName in blacklist:
- group = sickbeard.ADBA_CONNECTION.group(gname=groupName)
- for line in group.datalines:
- if line["shortname"]:
- shortBlacklist.append(line["shortname"])
- else:
- if not groupName in shortBlacklist:
- shortBlacklist.append(groupName)
- else:
- shortBlacklist = blacklist
- showObj.release_groups.set_black_keywords(shortBlacklist)
+ shortblacklist = short_group_names(blacklist)
+ showObj.release_groups.set_black_keywords(shortblacklist)
else:
showObj.release_groups.set_black_keywords([])
@@ -4545,6 +4531,16 @@ class Home(MainHandler):
else:
return json.dumps({'result': 'failure'})
+ @staticmethod
+ def fetch_releasegroups(show_name):
+
+ if helpers.set_up_anidb_connection():
+ anime = adba.Anime(sickbeard.ADBA_CONNECTION, name=show_name)
+ groups = anime.get_groups()
+ return json.dumps({'result': 'success', 'groups': groups})
+
+ return json.dumps({'result': 'failure'})
+
class UI(MainHandler):
def add_message(self):