Updated .gitignore to not store .nzb
Add [PROPER] to titleFix if it's a proper. User can now change the QualityProfile when adding a series (new or existing), option will default to their DefaultQualityProfile.
This commit is contained in:
parent
c6a7eaab93
commit
e62cb3b5da
|
@ -21,11 +21,12 @@ Thumbs.db
|
|||
[Dd]ebug*/
|
||||
*.lib
|
||||
*.sbr
|
||||
*.nzb
|
||||
obj/
|
||||
[Rr]elease*/
|
||||
_ReSharper*/
|
||||
[Tt]est[Rr]esult[s]
|
||||
|
||||
[Nn]zbs
|
||||
[Bb]uild/
|
||||
[Ll]ogs/
|
||||
/[Pp]ackage/
|
||||
|
|
|
@ -9,5 +9,6 @@ namespace NzbDrone.Core.Model
|
|||
{
|
||||
public string Path { get; set; }
|
||||
public int TvDbId { get; set; }
|
||||
public int QualityProfileId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Providers
|
|||
bool IsMonitored(long id);
|
||||
TvdbSeries MapPathToSeries(string path);
|
||||
TvdbSeries MapPathToSeries(int tvDbId);
|
||||
void AddSeries(string path, TvdbSeries series);
|
||||
void AddSeries(string path, TvdbSeries series, int qualityProfileId);
|
||||
Series FindSeries(string cleanTitle);
|
||||
bool QualityWanted(int seriesId, QualityTypes quality);
|
||||
void UpdateSeries(Series series);
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace NzbDrone.Core.Providers
|
|||
public interface ISyncProvider
|
||||
{
|
||||
bool BeginSyncUnmappedFolders(List<SeriesMappingModel> unmapped);
|
||||
bool BeginAddNewSeries(string dir, int seriesId, string seriesName);
|
||||
bool BeginAddExistingSeries(string path, int seriesId);
|
||||
bool BeginAddNewSeries(string dir, int seriesId, string seriesName, int qualityProfileId);
|
||||
bool BeginAddExistingSeries(string path, int seriesId, int qualityProfileId);
|
||||
List<String> GetUnmappedFolders(string path);
|
||||
}
|
||||
}
|
|
@ -154,6 +154,10 @@ namespace NzbDrone.Core.Providers
|
|||
var titleFix = GetTitleFix(new List<EpisodeParseResult> { episode }, episodeModel.SeriesId);
|
||||
titleFix = String.Format("{0} [{1}]", titleFix, nzb.Quality); //Add Quality to the titleFix
|
||||
|
||||
//If it is a PROPER we want to put PROPER in the titleFix
|
||||
if (nzb.Proper)
|
||||
titleFix = String.Format("{0} [PROPER]", titleFix);
|
||||
|
||||
if (!Convert.ToBoolean(_configProvider.GetValue("UseBlackhole", true, true)))
|
||||
if (_sabProvider.IsInQueue(titleFix))
|
||||
return;
|
||||
|
@ -162,6 +166,10 @@ namespace NzbDrone.Core.Providers
|
|||
nzb.TitleFix = GetTitleFix(episodeParseResults, series.SeriesId); //Get the TitleFix so we can use it later
|
||||
nzb.TitleFix = String.Format("{0} [{1}]", nzb.TitleFix, nzb.Quality); //Add Quality to the titleFix
|
||||
|
||||
//If it is a PROPER we want to put PROPER in the titleFix
|
||||
if (nzb.Proper)
|
||||
nzb.TitleFix = String.Format("{0} [PROPER]", nzb.TitleFix);
|
||||
|
||||
if (Convert.ToBoolean(_configProvider.GetValue("UseBlackHole", true, true)))
|
||||
{
|
||||
if (DownloadNzb(nzb))
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace NzbDrone.Core.Providers
|
|||
return _tvDb.GetSeries(tvDbId, false);
|
||||
}
|
||||
|
||||
public void AddSeries(string path, TvdbSeries series)
|
||||
public void AddSeries(string path, TvdbSeries series, int qualityProfileId)
|
||||
{
|
||||
Logger.Info("Adding Series [{0}]:{1} Path: {2}", series.Id, series.SeriesName, path);
|
||||
var repoSeries = new Series();
|
||||
|
@ -95,7 +95,10 @@ namespace NzbDrone.Core.Providers
|
|||
repoSeries.Path = path;
|
||||
repoSeries.CleanTitle = Parser.NormalizeTitle(series.SeriesName);
|
||||
repoSeries.Monitored = true; //New shows should be monitored
|
||||
repoSeries.QualityProfileId = qualityProfileId;
|
||||
if (qualityProfileId == 0)
|
||||
repoSeries.QualityProfileId = Convert.ToInt32(_config.GetValue("DefaultQualityProfile", "1", true));
|
||||
|
||||
repoSeries.SeasonFolder = true;
|
||||
|
||||
if (!Convert.ToBoolean(_config.GetValue("Sorting_SeasonFolder", true, true)))
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace NzbDrone.Core.Providers
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool BeginAddNewSeries(string dir, int seriesId, string seriesName)
|
||||
public bool BeginAddNewSeries(string dir, int seriesId, string seriesName, int qualityProfileId)
|
||||
{
|
||||
Logger.Debug("User has requested adding of new series");
|
||||
if (_seriesSyncThread == null || !_seriesSyncThread.IsAlive)
|
||||
|
@ -110,7 +110,7 @@ namespace NzbDrone.Core.Providers
|
|||
_diskProvider.CreateDirectory(path);
|
||||
|
||||
//Add it to the list so it will be processed
|
||||
_syncList.Add(new SeriesMappingModel { Path = path, TvDbId = seriesId });
|
||||
_syncList.Add(new SeriesMappingModel { Path = path, TvDbId = seriesId, QualityProfileId = qualityProfileId });
|
||||
|
||||
_seriesSyncThread.Start();
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ namespace NzbDrone.Core.Providers
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool BeginAddExistingSeries(string path, int seriesId)
|
||||
public bool BeginAddExistingSeries(string path, int seriesId, int qualityProfileId)
|
||||
{
|
||||
Logger.Debug("User has requested adding of new series");
|
||||
if (_seriesSyncThread == null || !_seriesSyncThread.IsAlive)
|
||||
|
@ -141,7 +141,7 @@ namespace NzbDrone.Core.Providers
|
|||
_syncList = new List<SeriesMappingModel>();
|
||||
|
||||
//Add it to the list so it will be processed
|
||||
_syncList.Add(new SeriesMappingModel { Path = path, TvDbId = seriesId });
|
||||
_syncList.Add(new SeriesMappingModel { Path = path, TvDbId = seriesId, QualityProfileId = qualityProfileId });
|
||||
|
||||
_seriesSyncThread.Start();
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ namespace NzbDrone.Core.Providers
|
|||
if (_seriesProvider.GetSeries(mappedSeries.Id) == null)
|
||||
{
|
||||
_seriesSyncNotification.CurrentStatus = String.Format("{0}: downloading series info...", mappedSeries.SeriesName);
|
||||
_seriesProvider.AddSeries(seriesFolder.Path, mappedSeries);
|
||||
_seriesProvider.AddSeries(seriesFolder.Path, mappedSeries, seriesFolder.QualityProfileId);
|
||||
_episodeProvider.RefreshEpisodeInfo(mappedSeries.Id);
|
||||
_seriesSyncNotification.CurrentStatus = String.Format("{0}: finding episodes on disk...", mappedSeries.SeriesName);
|
||||
_mediaFileProvider.Scan(_seriesProvider.GetSeries(mappedSeries.Id));
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace NzbDrone.Web.Controllers
|
|||
private readonly IRootDirProvider _rootDirProvider;
|
||||
private readonly ITvDbProvider _tvDbProvider;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IConfigProvider _configProvider;
|
||||
|
||||
//
|
||||
// GET: /Series/
|
||||
|
@ -37,7 +38,8 @@ namespace NzbDrone.Web.Controllers
|
|||
IEpisodeProvider episodeProvider, IRssSyncProvider rssSyncProvider,
|
||||
IQualityProvider qualityProvider, IMediaFileProvider mediaFileProvider,
|
||||
IRenameProvider renameProvider, IRootDirProvider rootDirProvider,
|
||||
ITvDbProvider tvDbProvider, IDiskProvider diskProvider)
|
||||
ITvDbProvider tvDbProvider, IDiskProvider diskProvider,
|
||||
IConfigProvider configProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
_episodeProvider = episodeProvider;
|
||||
|
@ -49,6 +51,7 @@ namespace NzbDrone.Web.Controllers
|
|||
_rootDirProvider = rootDirProvider;
|
||||
_tvDbProvider = tvDbProvider;
|
||||
_diskProvider = diskProvider;
|
||||
_configProvider = configProvider;
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
|
@ -64,6 +67,13 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
public ActionResult AddExisting()
|
||||
{
|
||||
var defaultQuality = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", "1", true));
|
||||
var profiles = _qualityProvider.GetAllProfiles();
|
||||
var selectList = new SelectList(profiles, "QualityProfileId", "Name");
|
||||
|
||||
ViewData["QualityProfileId"] = defaultQuality;
|
||||
ViewData["QualitySelectList"] = selectList;
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
|
@ -72,10 +82,16 @@ namespace NzbDrone.Web.Controllers
|
|||
ViewData["RootDirs"] = _rootDirProvider.GetAll();
|
||||
ViewData["DirSep"] = Path.DirectorySeparatorChar;
|
||||
|
||||
var profiles = _qualityProvider.GetAllProfiles();
|
||||
var selectList = new SelectList(profiles, "QualityProfileId", "Name");
|
||||
var defaultQuality = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", "1", true));
|
||||
|
||||
var model = new AddNewSeriesModel
|
||||
{
|
||||
DirectorySeparatorChar = Path.DirectorySeparatorChar.ToString(),
|
||||
RootDirectories = _rootDirProvider.GetAll()
|
||||
RootDirectories = _rootDirProvider.GetAll(),
|
||||
QualityProfileId = defaultQuality,
|
||||
QualitySelectList = selectList
|
||||
};
|
||||
|
||||
return View(model);
|
||||
|
@ -83,9 +99,15 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
public ActionResult AddExistingManual(string path)
|
||||
{
|
||||
var profiles = _qualityProvider.GetAllProfiles();
|
||||
var selectList = new SelectList(profiles, "QualityProfileId", "Name");
|
||||
var defaultQuality = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", "1", true));
|
||||
|
||||
var model = new AddExistingManualModel();
|
||||
model.Path = path;
|
||||
model.FolderName = _diskProvider.GetFolderName(path);
|
||||
model.QualityProfileId = defaultQuality;
|
||||
model.QualitySelectList = selectList;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
@ -177,11 +199,12 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
var path = HttpUtility.UrlDecode(nvc["path"]);
|
||||
var tvDbId = Convert.ToInt32(HttpUtility.UrlDecode(nvc["tvdbid"]));
|
||||
var qualityProfileId = Convert.ToInt32(HttpUtility.UrlDecode(nvc["qualityProfileId"]));
|
||||
|
||||
//If the TvDbId for this show is 0 then skip it... User made a mistake... They will have to manually map it
|
||||
if (tvDbId < 1) continue;
|
||||
|
||||
unmappedList.Add(new SeriesMappingModel{Path = path, TvDbId = tvDbId});
|
||||
unmappedList.Add(new SeriesMappingModel{Path = path, TvDbId = tvDbId, QualityProfileId = qualityProfileId});
|
||||
}
|
||||
|
||||
if(_syncProvider.BeginSyncUnmappedFolders(unmappedList))
|
||||
|
@ -190,25 +213,25 @@ namespace NzbDrone.Web.Controllers
|
|||
return Content("Sync already in progress, please wait for it to complete before retrying.");
|
||||
}
|
||||
|
||||
public ActionResult AddNewSeries(string dir, int seriesId, string seriesName)
|
||||
public ActionResult AddNewSeries(string dir, int seriesId, string seriesName, int qualityProfileId)
|
||||
{
|
||||
//Get TVDB Series Name
|
||||
//Create new folder for series
|
||||
//Add the new series to the Database
|
||||
|
||||
if (_syncProvider.BeginAddNewSeries(dir, seriesId, seriesName))
|
||||
if (_syncProvider.BeginAddNewSeries(dir, seriesId, seriesName, qualityProfileId))
|
||||
return Content("Adding new series has started.");
|
||||
|
||||
return Content("Unable to add new series, please wait for previous scans to complete first.");
|
||||
}
|
||||
|
||||
public ActionResult AddExistingSeries(string path, int seriesId)
|
||||
public ActionResult AddExistingSeries(string path, int seriesId, int qualityProfileId)
|
||||
{
|
||||
//Get TVDB Series Name
|
||||
//Create new folder for series
|
||||
//Add the new series to the Database
|
||||
|
||||
if (_syncProvider.BeginAddExistingSeries(path, seriesId))
|
||||
if (_syncProvider.BeginAddExistingSeries(path, seriesId, qualityProfileId))
|
||||
return Content("Manual adding of existing series has started");
|
||||
|
||||
return Content("Unable to add existing series, please wait for previous scans to complete first.");
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace NzbDrone.Web.Models
|
||||
{
|
||||
|
@ -9,5 +11,10 @@ namespace NzbDrone.Web.Models
|
|||
{
|
||||
public string Path { get; set; }
|
||||
public string FolderName { get; set; }
|
||||
|
||||
[DisplayName("Quality Profile")]
|
||||
public int QualityProfileId { get; set; }
|
||||
|
||||
public SelectList QualitySelectList { get; set; }
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ using System.ComponentModel;
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Web.Models
|
||||
|
@ -19,5 +20,10 @@ namespace NzbDrone.Web.Models
|
|||
public string DirectorySeparatorChar { get; set; }
|
||||
|
||||
public List<RootDir> RootDirectories { get; set; }
|
||||
|
||||
[DisplayName("Quality Profile")]
|
||||
public int QualityProfileId { get; set; }
|
||||
|
||||
public SelectList QualitySelectList { get; set; }
|
||||
}
|
||||
}
|
|
@ -38,6 +38,9 @@
|
|||
|
||||
</script>
|
||||
|
||||
<%= Html.Label("Quality Profile")%>
|
||||
<%: Html.DropDownList("qualityProfileId", (SelectList)ViewData["QualitySelectList"], ViewData["QualityProfileId"])%>
|
||||
|
||||
<div id="unmappedGrid" style="display:none">
|
||||
<%
|
||||
Html.Telerik().Grid<AddExistingSeriesModel>().Name("Unmapped_Series_Folders")
|
||||
|
@ -105,8 +108,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var qualityProfileId = $("#qualityProfileId").val();
|
||||
|
||||
|
||||
$("#result").load('<%=Url.Action("SyncSelectedSeries", "Series") %>', {
|
||||
checkedRecords: $checkedRecords.map(function () { return jQuery.param({ path: this.name, tvdbid: this.value }) })
|
||||
checkedRecords: $checkedRecords.map(function () { return jQuery.param({ path: this.name, tvdbid: this.value, qualityProfileId: qualityProfileId }) })
|
||||
});
|
||||
|
||||
//Hide the series that we just tried to sync up (uncheck them too, otherwise they will be re-sync'd if we sync again)
|
||||
|
|
|
@ -22,9 +22,18 @@
|
|||
<h4><%= Html.Label(Model.Path) %></h4>
|
||||
</div>
|
||||
|
||||
<div style="width: 60%">
|
||||
<div style="display:inline">
|
||||
<%= Html.Label("Enter a Series Name") %>
|
||||
<%= Html.TextBoxFor(m => m.FolderName, new { id="existing_series_id" }) %>
|
||||
<%= Html.TextBoxFor(m => m.Path, new { id ="series_path", style="display:none" }) %>
|
||||
</div>
|
||||
|
||||
<div style="display:inline; float:right;">
|
||||
<%= Html.LabelFor(m => m.QualityProfileId)%>
|
||||
<%: Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()">Search</button>
|
||||
|
@ -72,13 +81,15 @@
|
|||
|
||||
var id = "#" + checkedSeries + "_text";
|
||||
var seriesName = $(id).val();
|
||||
var qualityProfileId = $("#QualityProfileId").val();
|
||||
|
||||
var pathTest = $('#series_path').val();
|
||||
$('#tester').text(pathTest);
|
||||
|
||||
$("#addResult").load('<%=Url.Action("AddExistingSeries", "Series") %>', {
|
||||
path: pathTest,
|
||||
seriesId: checkedSeries
|
||||
seriesId: checkedSeries,
|
||||
qualityProfileId: qualityProfileId
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,17 @@
|
|||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
|
||||
|
||||
<div style="width: 60%">
|
||||
<div style="display:inline">
|
||||
<%= Html.Label("Enter a Series Name") %>
|
||||
<%= Html.TextBox("new_series_name", String.Empty, new { id="new_series_id" }) %>
|
||||
</div>
|
||||
|
||||
<div style="display:inline; float:right;">
|
||||
<%= Html.LabelFor(m => m.QualityProfileId)%>
|
||||
<%: Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()">Search</button>
|
||||
|
@ -90,11 +99,13 @@
|
|||
|
||||
var id = "#" + checkedSeries + "_text";
|
||||
var seriesName = $(id).val();
|
||||
var qualityProfileId = $("#QualityProfileId").val();
|
||||
|
||||
$("#addResult").load('<%=Url.Action("AddNewSeries", "Series") %>', {
|
||||
dir: checkedDir,
|
||||
seriesId: checkedSeries,
|
||||
seriesName: seriesName
|
||||
seriesName: seriesName,
|
||||
qualityProfileId: qualityProfileId
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue