1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-27 02:07:41 +00:00

Merge branch 'markus101'

This commit is contained in:
kay.one 2011-06-03 12:58:28 -07:00
commit 2ecd5ddb98
6 changed files with 59 additions and 24 deletions

View file

@ -168,8 +168,6 @@ namespace NzbDrone.Core.Providers
} }
} }
public virtual void Update(EpisodeFile episodeFile) public virtual void Update(EpisodeFile episodeFile)
{ {
_repository.Update(episodeFile); _repository.Update(episodeFile);
@ -195,6 +193,17 @@ namespace NzbDrone.Core.Providers
return _seriesProvider.GetSeries(seriesId).Episodes.Where(c => c.EpisodeFile != null).Select(c => c.EpisodeFile); return _seriesProvider.GetSeries(seriesId).Episodes.Where(c => c.EpisodeFile != null).Select(c => c.EpisodeFile);
} }
public virtual Tuple<int, int> GetEpisodeFilesCount(int seriesId)
{
var series = _seriesProvider.GetSeries(seriesId);
var monitoredSeasons = series.Seasons.Where(e => e.Monitored).Select(e => e.SeasonId);
var episodeTotal = series.Episodes.Where(e => monitoredSeasons.Contains(e.SeasonId) && e.AirDate <= DateTime.Today && e.AirDate > new DateTime(1899, 12, 31));
var episodes = episodeTotal.Where(e => e.EpisodeFileId > 0);
return new Tuple<int, int>(episodeTotal.Count(), episodes.Count());
}
private List<string> GetMediaFileList(string path) private List<string> GetMediaFileList(string path)
{ {
Logger.Debug("Scanning '{0}' for episodes", path); Logger.Debug("Scanning '{0}' for episodes", path);

View file

@ -21,6 +21,7 @@ namespace NzbDrone.Web.Controllers
private readonly TvDbProvider _tvDbProvider; private readonly TvDbProvider _tvDbProvider;
private readonly JobProvider _jobProvider; private readonly JobProvider _jobProvider;
private readonly SeasonProvider _seasonProvider; private readonly SeasonProvider _seasonProvider;
private readonly MediaFileProvider _mediaFileProvider;
// //
// GET: /Series/ // GET: /Series/
@ -29,8 +30,9 @@ namespace NzbDrone.Web.Controllers
QualityProvider qualityProvider, QualityProvider qualityProvider,
RenameProvider renameProvider, RenameProvider renameProvider,
TvDbProvider tvDbProvider, TvDbProvider tvDbProvider,
JobProvider jobProvider, JobProvider jobProvider,
SeasonProvider seasonProvider) SeasonProvider seasonProvider,
MediaFileProvider mediaFileProvider)
{ {
_seriesProvider = seriesProvider; _seriesProvider = seriesProvider;
_episodeProvider = episodeProvider; _episodeProvider = episodeProvider;
@ -39,6 +41,7 @@ namespace NzbDrone.Web.Controllers
_tvDbProvider = tvDbProvider; _tvDbProvider = tvDbProvider;
_jobProvider = jobProvider; _jobProvider = jobProvider;
_seasonProvider = seasonProvider; _seasonProvider = seasonProvider;
_mediaFileProvider = mediaFileProvider;
} }
public ActionResult Index() public ActionResult Index()
@ -135,16 +138,12 @@ namespace NzbDrone.Web.Controllers
public JsonResult GetEpisodeCount(int seriesId) public JsonResult GetEpisodeCount(int seriesId)
{ {
var series = _seriesProvider.GetSeries(seriesId); var count = _mediaFileProvider.GetEpisodeFilesCount(seriesId);
var monitoredSeasons = series.Seasons.Where(e => e.Monitored).Select(e => e.SeasonId);
var episodeTotal = series.Episodes.Where(e => monitoredSeasons.Contains(e.SeasonId) && e.AirDate <= DateTime.Today && e.AirDate > new DateTime(1899, 12, 31));
var episodes = episodeTotal.Where(e => e.EpisodeFileId > 0);
return Json(new return Json(new
{ {
Episodes = episodes.Count(), Episodes = count.Item1,
EpisodeTotal = episodeTotal.Count() EpisodeTotal = count.Item2
}, JsonRequestBehavior.AllowGet); }, JsonRequestBehavior.AllowGet);
} }

View file

@ -673,6 +673,7 @@
<Content Include="Scripts\2011.1.315\telerik.treeview.min.js" /> <Content Include="Scripts\2011.1.315\telerik.treeview.min.js" />
<Content Include="Scripts\2011.1.315\telerik.upload.min.js" /> <Content Include="Scripts\2011.1.315\telerik.upload.min.js" />
<Content Include="Scripts\2011.1.315\telerik.window.min.js" /> <Content Include="Scripts\2011.1.315\telerik.window.min.js" />
<Content Include="Scripts\doTimeout.js" />
<Content Include="Scripts\episodeSearch.js" /> <Content Include="Scripts\episodeSearch.js" />
<Content Include="Scripts\gridLoad.js" /> <Content Include="Scripts\gridLoad.js" />
<Content Include="Scripts\jquery-1.6.1-vsdoc.js" /> <Content Include="Scripts\jquery-1.6.1-vsdoc.js" />

View file

@ -131,10 +131,10 @@
var deleteRootDirUrl = '@Url.Action("DeleteRootDir", "AddSeries")'; var deleteRootDirUrl = '@Url.Action("DeleteRootDir", "AddSeries")';
function deleteRootDir(id) { function deleteRootDir(id) {
sendToServer(id); sendDeleteToServer(id);
} }
function sendToServer(id) { function sendDeleteToServer(id) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: deleteRootDirUrl, url: deleteRootDirUrl,

View file

@ -169,7 +169,22 @@
success: function (data, textStatus, jqXHR) { success: function (data, textStatus, jqXHR) {
var episodes = data.Episodes; var episodes = data.Episodes;
var episodeTotal = data.EpisodeTotal; var episodeTotal = data.EpisodeTotal;
$("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal);
var counter = 0;
var max = episodes + 1;
$.doTimeout(10, function () {
if (counter >= max) {
$("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal);
return false;
}
$("#progressbar_" + seriesId).episodeProgress(counter, episodeTotal);
counter += 5;
return true;
});
} }
}); });
} }

View file

@ -102,24 +102,35 @@
</div> </div>
</div> </div>
<script> <div id="progressbar2" class="progressbar">
$(document).ready(function () { <div class="progressText"></div>
<div class="progress">
<span class="progressText" style="width: 125px;"></span>
</div>
</div>
i = 0; <script>
max = 50; $(document).ready(function() {
progress(65, 100, 'progressbar');
progress(22, 25, 'progressbar2');
});
function progress(episodes, episodeTotal, elementName) {
var counter = 0;
var max = episodes + 1;
$.doTimeout(20, function () { $.doTimeout(20, function () {
if (i == max + 1) { if (counter == max) {
return false; return false;
} }
$("#progressbar").episodeProgress(i, 100); $("#" + elementName).episodeProgress(counter, episodeTotal);
i++; counter++;
return true; return true;
}); });
};
//$("#progressbar").episodeProgress(50, 100);
});
</script> </script>