1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 09:47:39 +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)
{
_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);
}
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)
{
Logger.Debug("Scanning '{0}' for episodes", path);

View file

@ -21,6 +21,7 @@ namespace NzbDrone.Web.Controllers
private readonly TvDbProvider _tvDbProvider;
private readonly JobProvider _jobProvider;
private readonly SeasonProvider _seasonProvider;
private readonly MediaFileProvider _mediaFileProvider;
//
// GET: /Series/
@ -29,8 +30,9 @@ namespace NzbDrone.Web.Controllers
QualityProvider qualityProvider,
RenameProvider renameProvider,
TvDbProvider tvDbProvider,
JobProvider jobProvider,
SeasonProvider seasonProvider)
JobProvider jobProvider,
SeasonProvider seasonProvider,
MediaFileProvider mediaFileProvider)
{
_seriesProvider = seriesProvider;
_episodeProvider = episodeProvider;
@ -39,6 +41,7 @@ namespace NzbDrone.Web.Controllers
_tvDbProvider = tvDbProvider;
_jobProvider = jobProvider;
_seasonProvider = seasonProvider;
_mediaFileProvider = mediaFileProvider;
}
public ActionResult Index()
@ -135,16 +138,12 @@ namespace NzbDrone.Web.Controllers
public JsonResult GetEpisodeCount(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);
var count = _mediaFileProvider.GetEpisodeFilesCount(seriesId);
return Json(new
{
Episodes = episodes.Count(),
EpisodeTotal = episodeTotal.Count()
Episodes = count.Item1,
EpisodeTotal = count.Item2
}, 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.upload.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\gridLoad.js" />
<Content Include="Scripts\jquery-1.6.1-vsdoc.js" />

View file

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

View file

@ -169,7 +169,22 @@
success: function (data, textStatus, jqXHR) {
var episodes = data.Episodes;
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>
<script>
$(document).ready(function () {
<div id="progressbar2" class="progressbar">
<div class="progressText"></div>
<div class="progress">
<span class="progressText" style="width: 125px;"></span>
</div>
</div>
i = 0;
max = 50;
<script>
$(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 () {
if (i == max + 1) {
if (counter == max) {
return false;
}
$("#progressbar").episodeProgress(i, 100);
i++;
$("#" + elementName).episodeProgress(counter, episodeTotal);
counter++;
return true;
});
//$("#progressbar").episodeProgress(50, 100);
});
};
</script>