mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Merge branch 'feature/AddReleaseGroupsOptions' into develop
This commit is contained in:
commit
33aa238060
11 changed files with 173 additions and 97 deletions
|
@ -57,9 +57,12 @@
|
|||
* Change the AniDB provider image for a sharper looking version
|
||||
* Change to streamline iCal function and make it handle missing network names
|
||||
* Change when picking a best result to only test items that have a size specifier against the failed history
|
||||
* Add anime release groups to add new show options page
|
||||
|
||||
[develop changelog]
|
||||
* Change uT params from unicode to str.format as magnet URLs worked but sending files in POST bodies failed
|
||||
* Fix black and white list initialization on new show creation
|
||||
* Fix validation of release groups when no group is detected
|
||||
|
||||
|
||||
### 0.6.4 (2015-02-10 20:20:00 UTC)
|
||||
|
|
|
@ -949,6 +949,11 @@ div.formpaginate {
|
|||
font-weight: 900
|
||||
}
|
||||
|
||||
#addShowForm #blackwhitelist,
|
||||
#addShowForm #blackwhitelist h4 {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* =======================================================================
|
||||
home_addExistingShow.tmpl
|
||||
========================================================================== */
|
||||
|
|
|
@ -148,13 +148,11 @@ Separate words with a comma, e.g. "word1,word2,word3"
|
|||
<br /><br />
|
||||
|
||||
#if $show.is_anime:
|
||||
#from sickbeard.blackandwhitelist import *
|
||||
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_blackwhitelist.tmpl")
|
||||
#from sickbeard.blackandwhitelist import *
|
||||
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_blackwhitelist.tmpl")
|
||||
<script type="text/javascript" src="$sbRoot/js/blackwhite.js?$sbPID"></script>
|
||||
#end if
|
||||
|
||||
<input type="hidden" name="whitelist" id="whitelist"/>
|
||||
<input type="hidden" name="blacklist" id="blacklist"/>
|
||||
|
||||
<input type="submit" id="submit" value="Submit" class="btn btn-primary" />
|
||||
</form>
|
||||
|
||||
|
@ -172,20 +170,9 @@ Separate words with a comma, e.g. "word1,word2,word3"
|
|||
});
|
||||
|
||||
\$("#exceptions_list").val(all_exceptions);
|
||||
|
||||
var realvalues = [];
|
||||
|
||||
\$('#white option').each(function(i, selected) {
|
||||
realvalues[i] = \$(selected).val();
|
||||
});
|
||||
\$("#whitelist").val(realvalues.join(","));
|
||||
|
||||
realvalues = [];
|
||||
\$('#black option').each(function(i, selected) {
|
||||
realvalues[i] = \$(selected).val();
|
||||
});
|
||||
\$("#blacklist").val(realvalues.join(","));
|
||||
|
||||
#if $show.is_anime:
|
||||
generate_bwlist()
|
||||
#end if
|
||||
});
|
||||
|
||||
\$('#addSceneName').click(function() {
|
||||
|
@ -230,43 +217,6 @@ Separate words with a comma, e.g. "word1,word2,word3"
|
|||
|
||||
\$(this).toggle_SceneException();
|
||||
|
||||
\$('#removeW').click(function() {
|
||||
return !\$('#white option:selected').remove().appendTo('#pool');
|
||||
});
|
||||
\$('#addW').click(function() {
|
||||
return !\$('#pool option:selected').remove().appendTo('#white');
|
||||
});
|
||||
\$('#addB').click(function() {
|
||||
return !\$('#pool option:selected').remove().appendTo('#black');
|
||||
});
|
||||
\$('#removeP').click(function() {
|
||||
return !\$('#pool option:selected').remove();
|
||||
});
|
||||
\$('#removeB').click(function() {
|
||||
return !\$('#black option:selected').remove().appendTo('#pool');
|
||||
});
|
||||
|
||||
\$('#addToWhite').click(function() {
|
||||
var group = \$('#addToPoolText').attr("value")
|
||||
if(group == "")
|
||||
return
|
||||
\$('#addToPoolText').attr("value", "")
|
||||
var option = \$("<option>")
|
||||
option.attr("value",group)
|
||||
option.html(group)
|
||||
return option.appendTo('#white');
|
||||
});
|
||||
\$('#addToBlack').click(function() {
|
||||
var group = \$('#addToPoolText').attr("value")
|
||||
if(group == "")
|
||||
return
|
||||
\$('#addToPoolText').attr("value", "")
|
||||
var option = \$("<option>")
|
||||
option.attr("value",group)
|
||||
option.html(group)
|
||||
return option.appendTo('#black');
|
||||
});
|
||||
|
||||
//-->
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
</div>
|
||||
|
||||
<script type="text/javascript" src="$sbRoot/js/rootDirs.js?$sbPID"></script>
|
||||
<script type="text/javascript" src="$sbRoot/js/blackwhite.js?$sbPID"></script>
|
||||
|
||||
</div></div>
|
||||
|
||||
|
|
|
@ -76,3 +76,6 @@
|
|||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
#from sickbeard.blackandwhitelist import *
|
||||
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_blackwhitelist.tmpl")
|
|
@ -1,3 +1,7 @@
|
|||
<div id="blackwhitelist">
|
||||
<input type="hidden" name="whitelist" id="whitelist"/>
|
||||
<input type="hidden" name="blacklist" id="blacklist"/>
|
||||
|
||||
<b>Fansub Groups:</b>
|
||||
<div >
|
||||
<p>Select your preferred fansub groups from the <b>Available Groups</b> and add them to the <b>Whitelist</b>. Add groups to the <b>Blacklist</b> to ignore them.</p>
|
||||
|
@ -51,3 +55,4 @@
|
|||
</div>
|
||||
<br style="clear:both" />
|
||||
</div>
|
||||
</div>
|
54
gui/slick/js/blackwhite.js
Normal file
54
gui/slick/js/blackwhite.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
function generate_bwlist() {
|
||||
var realvalues = [];
|
||||
|
||||
$('#white option').each(function(i, selected) {
|
||||
realvalues[i] = $(selected).val();
|
||||
});
|
||||
$("#whitelist").val(realvalues.join(","));
|
||||
|
||||
realvalues = [];
|
||||
$('#black option').each(function(i, selected) {
|
||||
realvalues[i] = $(selected).val();
|
||||
});
|
||||
$("#blacklist").val(realvalues.join(","));
|
||||
};
|
||||
|
||||
$('#removeW').click(function() {
|
||||
!$('#white option:selected').remove().appendTo('#pool');
|
||||
});
|
||||
|
||||
$('#addW').click(function() {
|
||||
!$('#pool option:selected').remove().appendTo('#white');
|
||||
});
|
||||
|
||||
$('#addB').click(function() {
|
||||
!$('#pool option:selected').remove().appendTo('#black');
|
||||
});
|
||||
|
||||
$('#removeP').click(function() {
|
||||
!$('#pool option:selected').remove();
|
||||
});
|
||||
|
||||
$('#removeB').click(function() {
|
||||
!$('#black option:selected').remove().appendTo('#pool');
|
||||
});
|
||||
|
||||
$('#addToWhite').click(function() {
|
||||
var group = $('#addToPoolText').attr("value");
|
||||
if(group == "") { return; }
|
||||
$('#addToPoolText').attr("value", "");
|
||||
var option = $("<option>");
|
||||
option.attr("value",group);
|
||||
option.html(group);
|
||||
option.appendTo('#white');
|
||||
});
|
||||
|
||||
$('#addToBlack').click(function() {
|
||||
var group = $('#addToPoolText').attr("value");
|
||||
if(group == "") { return; }
|
||||
$('#addToPoolText').attr("value", "");
|
||||
var option = $("<option>");
|
||||
option.attr("value",group);
|
||||
option.html(group);
|
||||
option.appendTo('#black');
|
||||
});
|
|
@ -131,6 +131,7 @@ $(document).ready(function () {
|
|||
alert('You must choose a show to continue');
|
||||
return false;
|
||||
}
|
||||
generate_bwlist()
|
||||
$('#addShowForm').submit();
|
||||
});
|
||||
|
||||
|
@ -192,7 +193,7 @@ $(document).ready(function () {
|
|||
} else {
|
||||
show_name = '';
|
||||
}
|
||||
|
||||
update_bwlist(show_name);
|
||||
var sample_text = '<p>Adding show <span class="show-name">' + show_name + '</span>'
|
||||
+ ('' == show_name ? 'into<br />' : '<br />into')
|
||||
+ ' <span class="show-dest">';
|
||||
|
@ -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>");
|
||||
option.attr("value", group.name);
|
||||
option.html(group.name + ' | ' + group.rating + ' | ' + group.range);
|
||||
option.appendTo('#pool');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$('#blackwhitelist').hide();
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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'
|
||||
|
||||
|
||||
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
|
|
@ -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():
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue