1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-11 12:02:35 +02:00

Searching for movie now works with downloading. They also get imported fine.

Additionally, a whole series (or movie in this case) can now be
downloaded manually.
Note: It probably won't start downloading missed releases. Only manually
clicking search for is working ATM.
This commit is contained in:
Leonardo Galli 2016-12-28 17:13:18 +01:00
parent 0b765d10fe
commit 0b278c7db8
13 changed files with 66 additions and 30 deletions

View File

@ -80,8 +80,9 @@ private IEnumerable<DownloadDecision> GetDecisions(List<ReleaseInfo> reports, Se
if (remoteEpisode.Series == null) if (remoteEpisode.Series == null)
{ {
remoteEpisode.DownloadAllowed = true; //Fuck you :) //remoteEpisode.DownloadAllowed = true; //Fuck you :)
decision = GetDecisionForReport(remoteEpisode, searchCriteria); //decision = GetDecisionForReport(remoteEpisode, searchCriteria);
decision = new DownloadDecision(remoteEpisode, new Rejection("Unknown release. Movie not Found."));
} }
else if (remoteEpisode.Episodes.Empty()) else if (remoteEpisode.Episodes.Empty())
{ {

View File

@ -17,8 +17,8 @@ public Decision IsSatisfiedBy(LocalEpisode localEpisode)
{ {
if (localEpisode.ParsedEpisodeInfo.FullSeason) if (localEpisode.ParsedEpisodeInfo.FullSeason)
{ {
_logger.Debug("Single episode file detected as containing all episodes in the season"); //_logger.Debug("Single episode file detected as containing all episodes in the season"); //Not needed for Movies mwhahahahah
return Decision.Reject("Single episode file contains all episodes in seasons"); //return Decision.Reject("Single episode file contains all episodes in seasons");
} }
return Decision.Accept(); return Decision.Accept();

View File

@ -65,7 +65,7 @@ public Tuple<Series, List<Episode>> GetSeriesInfo(int tvdbSeriesId)
series.Title = json.Title; series.Title = json.Title;
series.TitleSlug = series.Title.ToLower().Replace(" ", "-"); series.TitleSlug = series.Title.ToLower().Replace(" ", "-");
series.Overview = json.Plot; series.Overview = json.Plot;
series.CleanTitle = series.Title; series.CleanTitle = Parser.Parser.CleanSeriesTitle(series.Title);
series.TvdbId = tvdbSeriesId; series.TvdbId = tvdbSeriesId;
string airDateStr = json.Released; string airDateStr = json.Released;
DateTime airDate = DateTime.Parse(airDateStr); DateTime airDate = DateTime.Parse(airDateStr);
@ -76,6 +76,10 @@ public Tuple<Series, List<Episode>> GetSeriesInfo(int tvdbSeriesId)
string url = json.Poster; string url = json.Poster;
var imdbPoster = new MediaCover.MediaCover(MediaCoverTypes.Poster, url); var imdbPoster = new MediaCover.MediaCover(MediaCoverTypes.Poster, url);
series.Images.Add(imdbPoster); series.Images.Add(imdbPoster);
string runtime = json.Runtime;
int runtimeNum = 0;
int.TryParse(runtime.Replace("min", "").Trim(), out runtimeNum);
series.Runtime = runtimeNum;
var season = new Season(); var season = new Season();
season.SeasonNumber = 1; season.SeasonNumber = 1;
@ -85,7 +89,7 @@ public Tuple<Series, List<Episode>> GetSeriesInfo(int tvdbSeriesId)
var episode = new Episode(); var episode = new Episode();
episode.AirDate = airDate.ToShortTimeString(); episode.AirDate = airDate.ToBestDateString();
episode.Title = json.Title; episode.Title = json.Title;
episode.SeasonNumber = 1; episode.SeasonNumber = 1;
episode.EpisodeNumber = 1; episode.EpisodeNumber = 1;

View File

@ -26,6 +26,10 @@ public static class Parser
new Regex(@"^(?:\W*S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:[ex]){1,2}(?<episode>\d{1,3}(?!\d+)))+){2,}", new Regex(@"^(?:\W*S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:[ex]){1,2}(?<episode>\d{1,3}(?!\d+)))+){2,}",
RegexOptions.IgnoreCase | RegexOptions.Compiled), RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Matches Movie name with AirYear
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(?<!e|x)\d{4}(?!p|i|\d+|\)|\]|\W\d+)))+(\W+|_|$)(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Episodes without a title, Single (S01E05, 1x05) AND Multi (S01E04E05, 1x04x05, etc) //Episodes without a title, Single (S01E05, 1x05) AND Multi (S01E04E05, 1x04x05, etc)
new Regex(@"^(?:S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+)))+)", new Regex(@"^(?:S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+)))+)",
RegexOptions.IgnoreCase | RegexOptions.Compiled), RegexOptions.IgnoreCase | RegexOptions.Compiled),
@ -296,6 +300,8 @@ public static ParsedEpisodeInfo ParsePath(string path)
public static ParsedEpisodeInfo ParseTitle(string title) public static ParsedEpisodeInfo ParseTitle(string title)
{ {
ParsedEpisodeInfo realResult = null;
try try
{ {
if (!ValidateBeforeParsing(title)) return null; if (!ValidateBeforeParsing(title)) return null;
@ -342,6 +348,8 @@ public static ParsedEpisodeInfo ParseTitle(string title)
} }
} }
foreach (var regex in ReportTitleRegex) foreach (var regex in ReportTitleRegex)
{ {
var match = regex.Matches(simpleTitle); var match = regex.Matches(simpleTitle);
@ -383,6 +391,8 @@ public static ParsedEpisodeInfo ParseTitle(string title)
Logger.Debug("Release Hash parsed: {0}", result.ReleaseHash); Logger.Debug("Release Hash parsed: {0}", result.ReleaseHash);
} }
realResult = result;
return result; return result;
} }
} }
@ -401,7 +411,7 @@ public static ParsedEpisodeInfo ParseTitle(string title)
} }
Logger.Debug("Unable to parse {0}", title); Logger.Debug("Unable to parse {0}", title);
return null; return realResult;
} }
public static string ParseSeriesName(string title) public static string ParseSeriesName(string title)
@ -525,6 +535,7 @@ private static ParsedEpisodeInfo ParseMatchCollection(MatchCollection matchColle
int airYear; int airYear;
int.TryParse(matchCollection[0].Groups["airyear"].Value, out airYear); int.TryParse(matchCollection[0].Groups["airyear"].Value, out airYear);
//int.TryParse(matchCollection[0].Groups["year"].Value, out airYear);
ParsedEpisodeInfo result; ParsedEpisodeInfo result;

View File

@ -100,7 +100,7 @@ public Series GetSeries(string title)
if (parsedEpisodeInfo == null) if (parsedEpisodeInfo == null)
{ {
return _seriesService.FindByTitle(title); return _seriesService.FindByTitle(title); //Here we have a problem since it is not possible for movies to find a scene mapping, so these releases are always rejected :(
} }
var series = _seriesService.FindByTitle(parsedEpisodeInfo.SeriesTitle); var series = _seriesService.FindByTitle(parsedEpisodeInfo.SeriesTitle);
@ -252,10 +252,12 @@ private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tv
{ {
Series series = null; Series series = null;
/*var localEpisode = _seriesService.FindByTitle(parsedEpisodeInfo.SeriesTitle);
var sceneMappingTvdbId = _sceneMappingService.FindTvdbId(parsedEpisodeInfo.SeriesTitle); var sceneMappingTvdbId = _sceneMappingService.FindTvdbId(parsedEpisodeInfo.SeriesTitle);
if (sceneMappingTvdbId.HasValue) if (localEpisode != null)
{ {
if (searchCriteria != null && searchCriteria.Series.TvdbId == sceneMappingTvdbId.Value) if (searchCriteria != null && searchCriteria.Series.TvdbId == localEpisode.TvdbId)
{ {
return searchCriteria.Series; return searchCriteria.Series;
} }
@ -269,7 +271,7 @@ private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tv
} }
return series; return series;
} }*/ //This is only to find scene mapping should not be necessary for movies.
if (searchCriteria != null) if (searchCriteria != null)
{ {

View File

@ -114,7 +114,7 @@ static Quality()
new QualityDefinition(Quality.WEBDL720p) { Weight = 8, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.WEBDL720p) { Weight = 8, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.Bluray720p) { Weight = 9, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.Bluray720p) { Weight = 9, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.WEBDL1080p) { Weight = 10, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.WEBDL1080p) { Weight = 10, MinSize = 0, MaxSize = 100 },
new QualityDefinition(Quality.Bluray1080p) { Weight = 11, MinSize = 0, MaxSize = 100 }, new QualityDefinition(Quality.Bluray1080p) { Weight = 11, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.HDTV2160p) { Weight = 12, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.HDTV2160p) { Weight = 12, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.WEBDL2160p) { Weight = 13, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.WEBDL2160p) { Weight = 13, MinSize = 0, MaxSize = null },
new QualityDefinition(Quality.Bluray2160p) { Weight = 14, MinSize = 0, MaxSize = null }, new QualityDefinition(Quality.Bluray2160p) { Weight = 14, MinSize = 0, MaxSize = null },

View File

@ -35,10 +35,11 @@ module.exports = NzbDroneCell.extend({
}, },
_manualSearch : function() { _manualSearch : function() {
console.warn(this.cellValue);
vent.trigger(vent.Commands.ShowEpisodeDetails, { vent.trigger(vent.Commands.ShowEpisodeDetails, {
episode : this.cellValue, episode : this.cellValue,
hideSeriesLink : true, hideSeriesLink : true,
openingTab : 'search' openingTab : 'search'
}); });
} }
}); });

View File

@ -13,7 +13,7 @@ var SeriesEditorLayout = require('./Series/Editor/SeriesEditorLayout');
module.exports = NzbDroneController.extend({ module.exports = NzbDroneController.extend({
addSeries : function(action) { addSeries : function(action) {
this.setTitle('Add Series'); this.setTitle('Add Movie');
this.showMainRegion(new AddSeriesLayout({ action : action })); this.showMainRegion(new AddSeriesLayout({ action : action }));
}, },
@ -56,4 +56,4 @@ module.exports = NzbDroneController.extend({
this.setTitle('Series Editor'); this.setTitle('Series Editor');
this.showMainRegion(new SeriesEditorLayout()); this.showMainRegion(new SeriesEditorLayout());
} }
}); });

View File

@ -11,7 +11,7 @@ Handlebars.registerHelper('poster', function() {
if (!poster[0].url.match(/^https?:\/\//)) { if (!poster[0].url.match(/^https?:\/\//)) {
return new Handlebars.SafeString('<img class="series-poster x-series-poster" {0}>'.format(Handlebars.helpers.defaultImg.call(null, poster[0].url, 250))); return new Handlebars.SafeString('<img class="series-poster x-series-poster" {0}>'.format(Handlebars.helpers.defaultImg.call(null, poster[0].url, 250)));
} else { } else {
var url = poster[0].url.replace(/^https?\:/, ''); var url = poster[0].url.replace(/^https?\:/, 'https://'); //IMDb posters need https to work, k?
return new Handlebars.SafeString('<img class="series-poster x-series-poster" {0}>'.format(Handlebars.helpers.defaultImg.call(null, url))); return new Handlebars.SafeString('<img class="series-poster x-series-poster" {0}>'.format(Handlebars.helpers.defaultImg.call(null, url)));
} }
} }
@ -28,7 +28,7 @@ Handlebars.registerHelper('imdbUrl', function() {
}); });
Handlebars.registerHelper('tvdbUrl', function() { Handlebars.registerHelper('tvdbUrl', function() {
return 'http://www.thetvdb.com/?tab=series&id=' + this.tvdbId; return 'http://imdb.com/title/tt' + this.tvdbId;
}); });
Handlebars.registerHelper('tvRageUrl', function() { Handlebars.registerHelper('tvRageUrl', function() {

View File

@ -29,9 +29,9 @@
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<span class="series-info-links"> <span class="series-info-links">
<a href="{{traktUrl}}" class="label label-info">Trakt</a> <!--<a href="{{traktUrl}}" class="label label-info">Trakt</a>
<a href="{{tvdbUrl}}" class="label label-info">The TVDB</a> <a href="{{tvdbUrl}}" class="label label-info">The TVDB</a>-->
{{#if imdbId}} {{#if imdbId}}
<a href="{{imdbUrl}}" class="label label-info">IMDB</a> <a href="{{imdbUrl}}" class="label label-info">IMDB</a>

View File

@ -32,7 +32,8 @@ module.exports = Marionette.Layout.extend({
refresh : '.x-refresh', refresh : '.x-refresh',
rename : '.x-rename', rename : '.x-rename',
search : '.x-search', search : '.x-search',
poster : '.x-series-poster' poster : '.x-series-poster',
manualSearch : '.x-manual-search'
}, },
events : { events : {
@ -41,7 +42,8 @@ module.exports = Marionette.Layout.extend({
'click .x-edit' : '_editSeries', 'click .x-edit' : '_editSeries',
'click .x-refresh' : '_refreshSeries', 'click .x-refresh' : '_refreshSeries',
'click .x-rename' : '_renameSeries', 'click .x-rename' : '_renameSeries',
'click .x-search' : '_seriesSearch' 'click .x-search' : '_seriesSearch',
'click .x-manual-search' : '_manualSearchM'
}, },
initialize : function() { initialize : function() {
@ -178,11 +180,11 @@ module.exports = Marionette.Layout.extend({
if (self.model.get('id') !== seriesId) { if (self.model.get('id') !== seriesId) {
return []; return [];
} }
if (sceneSeasonNumber === undefined) { if (sceneSeasonNumber === undefined) {
sceneSeasonNumber = seasonNumber; sceneSeasonNumber = seasonNumber;
} }
return _.where(self.model.get('alternateTitles'), return _.where(self.model.get('alternateTitles'),
function(alt) { function(alt) {
return alt.sceneSeasonNumber === sceneSeasonNumber || alt.seasonNumber === seasonNumber; return alt.sceneSeasonNumber === sceneSeasonNumber || alt.seasonNumber === seasonNumber;
@ -254,5 +256,17 @@ module.exports = Marionette.Layout.extend({
} else { } else {
$('body').removeClass('backdrop'); $('body').removeClass('backdrop');
} }
},
_manualSearchM : function() {
console.warn("Manual Search started");
console.warn(this.model.get("seriesId"));
console.warn(this.model)
console.warn(this.episodeCollection);
vent.trigger(vent.Commands.ShowEpisodeDetails, {
episode : this.episodeCollection.models[0],
hideSeriesLink : true,
openingTab : 'search'
});
} }
}); });

View File

@ -5,23 +5,26 @@
<div class="col-md-12 col-lg-10"> <div class="col-md-12 col-lg-10">
<div> <div>
<h1 class="header-text"> <h1 class="header-text">
<i class="x-monitored" title="Toggle monitored state for entire series"/> <i class="x-monitored" title="Toggle monitored state for movie"/>
{{title}} {{title}}
<div class="series-actions pull-right"> <div class="series-actions pull-right">
<div class="x-episode-file-editor"> <div class="x-episode-file-editor">
<i class="icon-sonarr-episode-file" title="Modify episode files for series"/> <i class="icon-sonarr-episode-file" title="Modify episode files for movie"/>
</div> </div>
<div class="x-refresh"> <div class="x-refresh">
<i class="icon-sonarr-refresh icon-can-spin" title="Update series info and scan disk"/> <i class="icon-sonarr-refresh icon-can-spin" title="Update movie info and scan disk"/>
</div> </div>
<div class="x-rename"> <div class="x-rename">
<i class="icon-sonarr-rename" title="Preview rename for all episodes"/> <i class="icon-sonarr-rename" title="Preview rename for all episodes"/>
</div> </div>
<div class="x-search"> <div class="x-search">
<i class="icon-sonarr-search" title="Search for monitored episodes in this series"/> <i class="icon-sonarr-search" title="Search for movie"/>
</div>
<div class="x-manual-search">
<i class="icon-sonarr-search-manual" title="Manual Search"/>
</div> </div>
<div class="x-edit"> <div class="x-edit">
<i class="icon-sonarr-edit" title="Edit series"/> <i class="icon-sonarr-edit" title="Edit movie"/>
</div> </div>
</div> </div>
</h1> </h1>

View File

@ -80,7 +80,7 @@ module.exports = Marionette.Layout.extend({
collapse : true, collapse : true,
items : [ items : [
{ {
title : 'Add Series', title : 'Add Movie',
icon : 'icon-sonarr-add', icon : 'icon-sonarr-add',
route : 'addseries' route : 'addseries'
}, },