Merge pull request #1016 from geogolem/exclusionsFix

Exclusions fix
geogolem 8 years ago committed by GitHub
commit 0aa6066a6f

@ -92,7 +92,7 @@ namespace NzbDrone.Core.NetImport
bool foundMatch = false;
foreach (var listedMovie in listedMovies)
{
if (movie.ImdbId == listedMovie.ImdbId)
if (movie.TmdbId == listedMovie.TmdbId)
{
foundMatch = true;
break;
@ -146,11 +146,16 @@ namespace NzbDrone.Core.NetImport
{
foreach (var exclusion in importExclusions)
{
if (exclusion == movie.ImdbId || exclusion == movie.TmdbId.ToString())
//var excludedTmdbId = exclusion.Substring(exclusion.LastIndexOf('-')+1);
int excludedTmdbId;
if (Int32.TryParse(exclusion.Substring(exclusion.LastIndexOf('-') + 1), out excludedTmdbId))
{
_logger.Info("Movie: {0} was found but will not be added because {1} was found on your exclusion list",movie, exclusion);
shouldAdd = false;
break;
if (excludedTmdbId == movie.TmdbId)
{
_logger.Info("Movie: {0} was found but will not be added because {1} was found on your exclusion list", movie, exclusion);
shouldAdd = false;
break;
}
}
}
}

@ -250,11 +250,11 @@ namespace NzbDrone.Core.Tv
{
if (_configService.ImportExclusions.Empty())
{
_configService.ImportExclusions = movie.ImdbId;
_configService.ImportExclusions = movie.TitleSlug;
}
else if (!_configService.ImportExclusions.Contains(movie.ImdbId) && !_configService.ImportExclusions.Contains(movie.TmdbId.ToString()))
else if (!_configService.ImportExclusions.Contains(movie.TitleSlug))
{
_configService.ImportExclusions += ',' + movie.ImdbId;
_configService.ImportExclusions += ',' + movie.TitleSlug;
}
}
_movieRepository.Delete(movieId);

@ -95,6 +95,7 @@
}
}
/*
var itemValue = self.options.itemValue(item),
itemText = self.options.itemText(item),
tagClass = self.options.tagClass(item);
@ -113,7 +114,7 @@
// if length greater than limit
if (self.items().toString().length + item.length + 1 > self.options.maxInputLength)
return;
*/
// raise beforeItemAdd arg
var beforeItemAddEvent = $.Event('beforeItemAdd', { item: item, cancel: false });
self.$element.trigger(beforeItemAddEvent);
@ -121,7 +122,45 @@
return;
// register item in internal array and map
//self.itemsArray.push(item);
// read var beforeItemAddEvent with new value
var item = beforeItemAddEvent.item; // Get text from event (BeforeItemAddEvent)
var itemValue = self.options.itemValue(item),
itemText = self.options.itemText(item),
tagClass = self.options.tagClass(item);
// Ignore items allready added
var existing = $.grep(self.itemsArray, function(item) { return self.options.itemValue(item) === itemValue; } )[0];
if (existing && !self.options.allowDuplicates) {
// Invoke onTagExists
if (self.options.onTagExists) {
var $existingTag = $(".tag", self.$container).filter(function() { return $(this).data("item") === existing; });
self.options.onTagExists(item, $existingTag);
}
return;
}
// if length greater than limit
if (self.items().toString().length + item.length + 1 > self.options.maxInputLength)
return;
// register item in internal array and map
self.itemsArray.push(item);
if (beforeItemAddEvent.tagClass !== undefined){ var tagClass = beforeItemAddEvent.tagClass; }
if (item != undefined){
var items = item.toString().split(',');
if (items.length > 1) {
for (var i = 0; i < items.length; i++) {
this.add(items[i], true);
}
if (!dontPushVal)
self.pushVal(self.options.triggerChange);
return;
}
}
// add a tag element
var $tag = $('<span class="tag ' + htmlEncode(tagClass) + '">' + htmlEncode(itemText) + '<span data-role="remove"></span></span>');

@ -90,12 +90,19 @@ var view = Marionette.ItemView.extend({
});
promise.success(function(response) {
event.cancel=false;
//var newText = response['tmdbId']+'-';
//if (event.item.startsWith('tt')) {
// newText = newText+'['+event.item+']';
//}
event.item = response['titleSlug'];//+' ('+response['year']+')-'+response['tmdbId'];
});
promise.error(function(request, status, error) {
event.cancel = true;
window.alert(event.item+' is not a valid! Must be valid tt#### IMDB ID or #### TMDB ID');
});
});
return event;
});
},

@ -32,11 +32,11 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Import Exclusions</label>
<div class="col-sm-1 col-sm-push-2 help-inline">
<div class="col-sm-1 col-sm-push-4 help-inline">
<i class="icon-sonarr-form-warning" title="Movies in this field will not be imported even if they exist on your lists."/>
<i class="icon-sonarr-form-info" title="Comma separated imdbid or tmdbid: tt0120915,216138,tt0121765"/>
</div>
<div class="col-sm-2 col-sm-pull-1">
<div class="col-sm-4 col-sm-pull-1">
<input type="text" name="importExclusions" class="form-control x-import-exclusions"/>
</div>

Loading…
Cancel
Save