Merge branch 'mark-fork'

pull/2/head
Keivan 14 years ago
commit ce1198642a

@ -64,13 +64,14 @@ namespace NzbDrone.Core
_kernel.Bind<IRssSyncProvider>().To<RssSyncProvider>().InSingletonScope();
_kernel.Bind<ISeasonProvider>().To<SeasonProvider>();
_kernel.Bind<IEpisodeProvider>().To<EpisodeProvider>();
_kernel.Bind<IUpcomingEpisodesProvider>().To<UpcomingEpisodesProvider>();
_kernel.Bind<UpcomingEpisodesProvider>().To<UpcomingEpisodesProvider>();
_kernel.Bind<IDiskProvider>().To<DiskProvider>();
_kernel.Bind<IDownloadProvider>().To<SabProvider>();
_kernel.Bind<SabProvider>().To<SabProvider>();
_kernel.Bind<IHistoryProvider>().To<HistoryProvider>();
_kernel.Bind<IRootDirProvider>().To<RootDirProvider>();
_kernel.Bind<IExtenalNotificationProvider>().To<ExternalNotificationProvider>();
_kernel.Bind<IXbmcProvider>().To<XbmcProvider>();
_kernel.Bind<RootDirProvider>().To<RootDirProvider>();
_kernel.Bind<ExternalNotificationProvider>().To<ExternalNotificationProvider>();
_kernel.Bind<XbmcProvider>().To<XbmcProvider>();
_kernel.Bind<PostProcessingProvider>().To<PostProcessingProvider>();
_kernel.Bind<IConfigProvider>().To<ConfigProvider>().InSingletonScope();
_kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope();
_kernel.Bind<IIndexerProvider>().To<IndexerProvider>().InSingletonScope();
@ -78,7 +79,7 @@ namespace NzbDrone.Core
_kernel.Bind<INotificationProvider>().To<NotificationProvider>().InSingletonScope();
_kernel.Bind<ILogProvider>().To<LogProvider>().InSingletonScope();
_kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>().InSingletonScope();
_kernel.Bind<ITimerProvider>().To<TimerProvider>().InSingletonScope();
_kernel.Bind<TimerProvider>().To<TimerProvider>().InSingletonScope();
_kernel.Bind<IRepository>().ToMethod(c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope();
_kernel.Bind<IRepository>().ToConstant(logRepository).WhenInjectedInto<SubsonicTarget>().InSingletonScope();
@ -90,7 +91,7 @@ namespace NzbDrone.Core
//Get the Timers going
var config = _kernel.Get<IConfigProvider>();
var timer = _kernel.Get<ITimerProvider>();
var timer = _kernel.Get<TimerProvider>();
timer.SetRssSyncTimer(Convert.ToInt32(config.GetValue("SyncFrequency", "15", true)));
timer.StartRssSyncTimer();
}

@ -183,17 +183,11 @@
<Compile Include="Providers\Feed\NzbsOrgFeedProvider.cs" />
<Compile Include="Providers\HistoryProvider.cs" />
<Compile Include="Providers\IBacklogProvider.cs" />
<Compile Include="Providers\IExtenalNotificationProvider.cs" />
<Compile Include="Providers\IHistoryProvider.cs" />
<Compile Include="Providers\IIndexerProvider.cs" />
<Compile Include="Providers\IndexerProvider.cs" />
<Compile Include="Providers\IPostProcessingProvider.cs" />
<Compile Include="Providers\IRenameProvider.cs" />
<Compile Include="Providers\IRootDirProvider.cs" />
<Compile Include="Providers\IRssSyncProvider.cs" />
<Compile Include="Providers\ITimerProvider.cs" />
<Compile Include="Providers\IUpcomingEpisodesProvider.cs" />
<Compile Include="Providers\IXbmcProvider.cs" />
<Compile Include="Providers\PostProcessingProvider.cs" />
<Compile Include="Providers\QualityProvider.cs" />
<Compile Include="Providers\RenameProvider.cs" />
@ -218,7 +212,6 @@
<Compile Include="Providers\Core\ConfigProvider.cs" />
<Compile Include="Providers\EpisodeProvider.cs" />
<Compile Include="Providers\Core\HttpProvider.cs" />
<Compile Include="Providers\IDownloadProvider.cs" />
<Compile Include="Providers\IEpisodeProvider.cs" />
<Compile Include="Providers\ISeasonProvider.cs" />
<Compile Include="Providers\ISeriesProvider.cs" />

@ -10,22 +10,21 @@ using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers
{
public class ExternalNotificationProvider : IExtenalNotificationProvider
public class ExternalNotificationProvider
{
private readonly IConfigProvider _configProvider;
private readonly IXbmcProvider _xbmcProvider;
private readonly XbmcProvider _xbmcProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public ExternalNotificationProvider(IConfigProvider configProvider, IXbmcProvider xbmcProvider)
public ExternalNotificationProvider(IConfigProvider configProvider, XbmcProvider xbmcProvider)
{
_configProvider = configProvider;
_xbmcProvider = xbmcProvider;
}
#region IExternalNotificationProvider Members
public void OnGrab(string message)
#region ExternalNotificationProvider Members
public virtual void OnGrab(string message)
{
var header = "NzbDrone [TV] - Grabbed";
@ -43,7 +42,7 @@ namespace NzbDrone.Core.Providers
Logger.Trace("XBMC Notifier is not enabled");
}
public void OnDownload(EpisodeRenameModel erm)
public virtual void OnDownload(EpisodeRenameModel erm)
{
var header = "NzbDrone [TV] - Downloaded";
var message = EpisodeRenameHelper.GetNewName(erm);
@ -75,7 +74,7 @@ namespace NzbDrone.Core.Providers
throw new NotImplementedException();
}
public void OnRename(EpisodeRenameModel erm)
public virtual void OnRename(EpisodeRenameModel erm)
{
var header = "NzbDrone [TV] - Renamed";
var message = EpisodeRenameHelper.GetNewName(erm);

@ -12,4 +12,4 @@ namespace NzbDrone.Core.Providers
bool StartSearch();
bool StartSearch(int seriesId);
}
}
}

@ -1,9 +0,0 @@
namespace NzbDrone.Core.Providers
{
public interface IDownloadProvider
{
bool AddByUrl(string url, string title); //Should accept something other than string (NzbInfo?) returns success or failure
bool IsInQueue(string title); //Should accept something other than string (Episode?) returns bool
bool AddById(string id, string title);
}
}

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers
{
public interface IExtenalNotificationProvider
{
void OnGrab(string message);
void OnDownload(EpisodeRenameModel erm);
void OnRename(EpisodeRenameModel erm);
}
}

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Providers
{
public interface IPostProcessingProvider
{
void ProcessEpisode(string dir, string nzbName);
}
}

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers
{
public interface IRootDirProvider
{
List<RootDir> GetAll();
void Add(RootDir rootDir);
void Remove(int rootDirId);
void Update(RootDir rootDir);
RootDir GetRootDir(int rootDirId);
}
}

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Providers
{
public interface ITimerProvider
{
void ResetRssSyncTimer();
void StartRssSyncTimer();
void StopRssSyncTimer();
void SetRssSyncTimer(int minutes);
TimeSpan RssSyncTimeLeft();
DateTime NextRssSyncTime();
void StartMinuteTimer();
void StopMinuteTimer();
}
}

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers
{
public interface IUpcomingEpisodesProvider
{
UpcomingEpisodesModel Upcoming();
List<Episode> Yesterday();
List<Episode> Today();
List<Episode> Week();
}
}

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Providers
{
public interface IXbmcProvider
{
void Notify(string header, string message);
void Update(int seriesId);
void Clean();
}
}

@ -9,7 +9,7 @@ using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Providers
{
public class PostProcessingProvider : IPostProcessingProvider
public class PostProcessingProvider
{
private readonly ISeriesProvider _seriesProvider;
private readonly IMediaFileProvider _mediaFileProvider;
@ -23,9 +23,9 @@ namespace NzbDrone.Core.Providers
_renameProvider = renameProvider;
}
#region IPostProcessingProvider Members
#region PostProcessingProvider Members
public void ProcessEpisode(string dir, string nzbName)
public virtual void ProcessEpisode(string dir, string nzbName)
{
var parsedSeries = Parser.ParseSeriesName(nzbName);
var series = _seriesProvider.FindSeries(parsedSeries);

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Providers
private readonly IMediaFileProvider _mediaFileProvider;
private readonly IDiskProvider _diskProvider;
private readonly IConfigProvider _configProvider;
private readonly IExtenalNotificationProvider _externalNotificationProvider;
private readonly ExternalNotificationProvider _externalNotificationProvider;
private Thread _renameThread;
private List<EpisodeRenameModel> _epsToRename = new List<EpisodeRenameModel>();
@ -30,7 +30,7 @@ namespace NzbDrone.Core.Providers
public RenameProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider,
IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
IDiskProvider diskProvider, IConfigProvider configProvider,
IExtenalNotificationProvider extenalNotificationProvider)
ExternalNotificationProvider extenalNotificationProvider)
{
_seriesProvider = seriesProvider;
_seasonProvider = seasonProvider;

@ -7,7 +7,7 @@ using SubSonic.Repository;
namespace NzbDrone.Core.Providers
{
public class RootDirProvider : IRootDirProvider
public class RootDirProvider
{
private readonly IRepository _sonioRepo;
@ -18,27 +18,27 @@ namespace NzbDrone.Core.Providers
#region IRootDirProvider
public List<RootDir> GetAll()
public virtual List<RootDir> GetAll()
{
return _sonioRepo.All<RootDir>().ToList();
}
public void Add(RootDir rootDir)
public virtual void Add(RootDir rootDir)
{
_sonioRepo.Add(rootDir);
}
public void Remove(int rootDirId)
public virtual void Remove(int rootDirId)
{
_sonioRepo.Delete<RootDir>(rootDirId);
}
public void Update(RootDir rootDir)
public virtual void Update(RootDir rootDir)
{
_sonioRepo.Update(rootDir);
}
public RootDir GetRootDir(int rootDirId)
public virtual RootDir GetRootDir(int rootDirId)
{
return _sonioRepo.Single<RootDir>(rootDirId);
}

@ -7,7 +7,7 @@ using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Providers
{
public class SabProvider : IDownloadProvider
public class SabProvider
{
private readonly IConfigProvider _config;
private readonly HttpProvider _http;
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Providers
#region IDownloadProvider Members
public bool AddByUrl(string url, string title)
public virtual bool AddByUrl(string url, string title)
{
const string mode = "addurl";
string cat = _config.GetValue("SabTvCategory", String.Empty, true);
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Providers
return false;
}
public bool IsInQueue(string title)
public virtual bool IsInQueue(string title)
{
const string action = "mode=queue&output=xml";
string request = GetSabRequest(action);
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Providers
return false; //Not in Queue
}
public bool AddById(string id, string title)
public virtual bool AddById(string id, string title)
{
//mode=addid&name=333333&pp=3&script=customscript.cmd&cat=Example&priority=-1

@ -8,7 +8,7 @@ using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Providers
{
public class TimerProvider : ITimerProvider
public class TimerProvider
{
private readonly IRssSyncProvider _rssSyncProvider;
private readonly ISeriesProvider _seriesProvider;
@ -33,15 +33,15 @@ namespace NzbDrone.Core.Providers
_minuteTimer = new Timer(60000);
}
#region ITimerProvider Members
#region TimerProvider Members
public void ResetRssSyncTimer()
public virtual void ResetRssSyncTimer()
{
double interval = _rssSyncTimer.Interval;
_rssSyncTimer.Interval = interval;
}
public void StartRssSyncTimer()
public virtual void StartRssSyncTimer()
{
if (_rssSyncTimer.Interval < 900000) //If Timer is less than 15 minutes, throw an error! This should also be handled when saving the config, though a user could by-pass it by editing the DB directly... TNO (Trust No One)
{
@ -53,35 +53,35 @@ namespace NzbDrone.Core.Providers
_rssSyncTimer.Start();
_rssSyncNextInterval = DateTime.Now.AddMilliseconds(_rssSyncTimer.Interval);
}
public void StopRssSyncTimer()
public virtual void StopRssSyncTimer()
{
_rssSyncTimer.Stop();
}
public void SetRssSyncTimer(int minutes)
public virtual void SetRssSyncTimer(int minutes)
{
long ms = minutes * 60 * 1000;
_rssSyncTimer.Interval = ms;
}
public TimeSpan RssSyncTimeLeft()
public virtual TimeSpan RssSyncTimeLeft()
{
return _rssSyncNextInterval.Subtract(DateTime.Now);
}
public DateTime NextRssSyncTime()
public virtual DateTime NextRssSyncTime()
{
return _rssSyncNextInterval;
}
public void StartMinuteTimer()
public virtual void StartMinuteTimer()
{
_minuteTimer.Elapsed += new ElapsedEventHandler(MinuteTimer_Elapsed);
_minuteTimer.Start();
}
public void StopMinuteTimer()
public virtual void StopMinuteTimer()
{
_minuteTimer.Stop();
}

@ -8,7 +8,7 @@ using SubSonic.Repository;
namespace NzbDrone.Core.Providers
{
public class UpcomingEpisodesProvider : IUpcomingEpisodesProvider
public class UpcomingEpisodesProvider
{
private IRepository _sonicRepo;
@ -17,9 +17,9 @@ namespace NzbDrone.Core.Providers
_sonicRepo = sonicRepo;
}
#region IUpcomingEpisodesProvider
#region UpcomingEpisodesProvider Members
public UpcomingEpisodesModel Upcoming()
public virtual UpcomingEpisodesModel Upcoming()
{
var allEps = _sonicRepo.All<Episode>().Where(e => e.AirDate >= DateTime.Today.AddDays(-1) && e.AirDate < DateTime.Today.AddDays(8));
@ -30,17 +30,17 @@ namespace NzbDrone.Core.Providers
return new UpcomingEpisodesModel {Yesterday = yesterday, Today = today, Week = week};
}
public List<Episode> Yesterday()
public virtual List<Episode> Yesterday()
{
return _sonicRepo.All<Episode>().Where(e => e.AirDate == DateTime.Today.AddDays(-1)).ToList();
}
public List<Episode> Today()
public virtual List<Episode> Today()
{
return _sonicRepo.All<Episode>().Where(e => e.AirDate == DateTime.Today).ToList();
}
public List<Episode> Week()
public virtual List<Episode> Week()
{
return _sonicRepo.All<Episode>().Where(e => e.AirDate > DateTime.Today && e.AirDate < DateTime.Today.AddDays(8)).ToList();
}

@ -10,7 +10,7 @@ using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Providers
{
public class XbmcProvider : IXbmcProvider
public class XbmcProvider
{
private readonly IConfigProvider _configProvider;
private readonly HttpProvider _httpProvider;
@ -23,9 +23,9 @@ namespace NzbDrone.Core.Providers
_httpProvider = httpProvider;
}
#region IXbmcProvider Members
#region XbmcProvider Members
public void Notify(string header, string message)
public virtual void Notify(string header, string message)
{
//Get time in seconds and convert to ms
var time = Convert.ToInt32(_configProvider.GetValue("XbmcDisplayTime", "3", true)) * 1000;
@ -47,7 +47,7 @@ namespace NzbDrone.Core.Providers
}
}
public void Update(int seriesId)
public virtual void Update(int seriesId)
{
foreach (var host in _configProvider.GetValue("XbmcHosts", "localhost:80", true).Split(','))
{
@ -68,7 +68,7 @@ namespace NzbDrone.Core.Providers
}
}
public void Clean()
public virtual void Clean()
{
foreach (var host in _configProvider.GetValue("XbmcHosts", "localhost:80", true).Split(','))
{

@ -14,13 +14,13 @@ namespace NzbDrone.Web.Controllers
{
public IConfigProvider ConfigProvider { get; set; }
private readonly ISyncProvider _syncProvider;
private readonly IRootDirProvider _rootFolderProvider;
private readonly RootDirProvider _rootFolderProvider;
private readonly IConfigProvider _configProvider;
private readonly QualityProvider _qualityProvider;
private readonly TvDbProvider _tvDbProvider;
private readonly ISeriesProvider _seriesProvider;
public AddSeriesController(ISyncProvider syncProvider, IRootDirProvider rootFolderProvider, IConfigProvider configProvider,
public AddSeriesController(ISyncProvider syncProvider, RootDirProvider rootFolderProvider, IConfigProvider configProvider,
QualityProvider qualityProvider, TvDbProvider tvDbProvider, ISeriesProvider seriesProvider)
{
ConfigProvider = configProvider;
@ -63,6 +63,12 @@ namespace NzbDrone.Web.Controllers
{
var unmappedList = new List<String>();
var profiles = _qualityProvider.GetAllProfiles();
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality);
ViewData["qualities"] = selectList;
foreach (var folder in _rootFolderProvider.GetAll())
{
unmappedList.AddRange(_syncProvider.GetUnmappedFolders(folder.Path));

@ -13,12 +13,12 @@ namespace NzbDrone.Web.Controllers
{
public class ApiController : Controller
{
private readonly IPostProcessingProvider _postProcessingProvider;
private readonly PostProcessingProvider _postProcessingProvider;
private readonly IConfigProvider _configProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public ApiController(IPostProcessingProvider postProcessingProvider, IConfigProvider configProvider)
public ApiController(PostProcessingProvider postProcessingProvider, IConfigProvider configProvider)
{
_postProcessingProvider = postProcessingProvider;
_configProvider = configProvider;

@ -28,7 +28,7 @@ namespace NzbDrone.Web.Controllers
private readonly QualityProvider _qualityProvider;
private readonly IMediaFileProvider _mediaFileProvider;
private readonly IRenameProvider _renameProvider;
private readonly IRootDirProvider _rootDirProvider;
private readonly RootDirProvider _rootDirProvider;
private readonly TvDbProvider _tvDbProvider;
//
// GET: /Series/
@ -36,7 +36,7 @@ namespace NzbDrone.Web.Controllers
public SeriesController(ISyncProvider syncProvider, ISeriesProvider seriesProvider,
IEpisodeProvider episodeProvider, IRssSyncProvider rssSyncProvider,
QualityProvider qualityProvider, IMediaFileProvider mediaFileProvider,
IRenameProvider renameProvider, IRootDirProvider rootDirProvider,
IRenameProvider renameProvider, RootDirProvider rootDirProvider,
TvDbProvider tvDbProvider)
{
_seriesProvider = seriesProvider;

@ -22,14 +22,14 @@ namespace NzbDrone.Web.Controllers
private IConfigProvider _configProvider;
private IIndexerProvider _indexerProvider;
private QualityProvider _qualityProvider;
private IRootDirProvider _rootDirProvider;
private RootDirProvider _rootDirProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private const string SETTINGS_SAVED = "Settings Saved.";
private const string SETTINGS_FAILED = "Error Saving Settings, please fix any errors";
public SettingsController(IConfigProvider configProvider, IIndexerProvider indexerProvider,
QualityProvider qualityProvider, IRootDirProvider rootDirProvider)
QualityProvider qualityProvider, RootDirProvider rootDirProvider)
{
_configProvider = configProvider;
_indexerProvider = indexerProvider;

@ -9,9 +9,9 @@ namespace NzbDrone.Web.Controllers
{
public class SharedController : Controller
{
private ITimerProvider _timerProvider;
private TimerProvider _timerProvider;
public SharedController(ITimerProvider timerProvider)
public SharedController(TimerProvider timerProvider)
{
_timerProvider = timerProvider;
}

@ -11,9 +11,9 @@ namespace NzbDrone.Web.Controllers
{
public class UpcomingController : Controller
{
private IUpcomingEpisodesProvider _upcomingEpisodesProvider;
private UpcomingEpisodesProvider _upcomingEpisodesProvider;
public UpcomingController(IUpcomingEpisodesProvider upcomingEpisodesProvider)
public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider)
{
_upcomingEpisodesProvider = upcomingEpisodesProvider;
}

@ -9,11 +9,36 @@
<%
if (Model.Count() == 0)
Html.DisplayText("No Series to Add");
%>
<%: Html.DropDownList("masterDropbox", (SelectList)ViewData["qualities"], new { style = "width: 100px;", id = "masterDropboxId" })%>
<%: @Html.Telerik().DropDownList().Name("tester").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes(new { style = "width: 100px", @class = "qualityDropbox" })%>
<%
foreach (var path in Model)
{
Html.RenderAction("RenderPartial", "AddSeries", new { path });
}
%>
</asp:Content>
<script type="text/javascript">
$("#masterDropboxId").change(function () {
var selectedQuality = $('#masterDropboxId').get(0).selectedIndex;
//$(".qualityDropbox").data("tComboBox").value(selectedQuality);
//$(".qualityDropbox").data("tDropDownList").val(selectedQuality);
var comboBox = $(".qualityDropbox").data("tDropDownList");
comboBox.select(selectedQuality);
});
</script>
</asp:Content>

@ -12,7 +12,7 @@
.HighlightFirstMatch(true)
.HtmlAttributes(new { style = "width: 300px;" })
.Render();}
@Html.Telerik().DropDownList().Name("qualityList_" + ViewData["guid"].ToString()).BindTo((SelectList)ViewData["quality"]).HtmlAttributes(new { style = "width: 100px;" }).SelectedIndex(0)
@Html.Telerik().DropDownList().Name("qualityList_" + ViewData["guid"].ToString()).BindTo((SelectList)ViewData["quality"]).HtmlAttributes(new { style = "width: 100px", @class = "qualityDropbox" })
<button class="listButton" onclick="addSeries('@ViewData["guid"]','@ViewData["javaPath"].ToString()' )">
Add</button>
</div>

Loading…
Cancel
Save