mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 20:42:37 +01:00
Season monitor toggle added
This commit is contained in:
parent
b520554741
commit
2909498781
@ -25,6 +25,7 @@ public interface IEpisodeRepository : IBasicRepository<Episode>
|
|||||||
List<Episode> EpisodesWithFiles();
|
List<Episode> EpisodesWithFiles();
|
||||||
List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate);
|
List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate);
|
||||||
void SetMonitoredFlat(Episode episode, bool monitored);
|
void SetMonitoredFlat(Episode episode, bool monitored);
|
||||||
|
void SetMonitoredBySeason(int seriesId, int seasonNumber, bool monitored);
|
||||||
void SetFileId(int episodeId, int fileId);
|
void SetFileId(int episodeId, int fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +126,20 @@ public void SetMonitoredFlat(Episode episode, bool monitored)
|
|||||||
SetFields(episode, p => p.Monitored);
|
SetFields(episode, p => p.Monitored);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetMonitoredBySeason(int seriesId, int seasonNumber, bool monitored)
|
||||||
|
{
|
||||||
|
_dataMapper.AddParameter("seriesId", seriesId);
|
||||||
|
_dataMapper.AddParameter("seasonNumber", seasonNumber);
|
||||||
|
_dataMapper.AddParameter("monitored", monitored);
|
||||||
|
|
||||||
|
var sql = "UPDATE Episodes " +
|
||||||
|
"SET Monitored = @monitored " +
|
||||||
|
"WHERE SeriesId = @seriesId " +
|
||||||
|
"AND SeasonNumber = @seasonNumber";
|
||||||
|
|
||||||
|
_dataMapper.ExecuteNonQuery(sql);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetFileId(int episodeId, int fileId)
|
public void SetFileId(int episodeId, int fileId)
|
||||||
{
|
{
|
||||||
SetFields(new Episode { Id = episodeId, EpisodeFileId = fileId }, episode => episode.EpisodeFileId);
|
SetFields(new Episode { Id = episodeId, EpisodeFileId = fileId }, episode => episode.EpisodeFileId);
|
||||||
|
@ -111,8 +111,6 @@ public List<Episode> EpisodesWithFiles()
|
|||||||
return _episodeRepository.EpisodesWithFiles();
|
return _episodeRepository.EpisodesWithFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void UpdateEpisode(Episode episode)
|
public void UpdateEpisode(Episode episode)
|
||||||
{
|
{
|
||||||
_episodeRepository.Update(episode);
|
_episodeRepository.Update(episode);
|
||||||
@ -131,6 +129,11 @@ public void SetEpisodeMonitored(int episodeId, bool monitored)
|
|||||||
logger.Info("Monitored flag for Episode:{0} was set to {1}", episodeId, monitored);
|
logger.Info("Monitored flag for Episode:{0} was set to {1}", episodeId, monitored);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetEpisodeMonitoredBySeason(int seriesId, int seasonNumber, bool monitored)
|
||||||
|
{
|
||||||
|
_episodeRepository.SetMonitoredBySeason(seriesId, seasonNumber, monitored);
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsFirstOrLastEpisodeOfSeason(int episodeId)
|
public bool IsFirstOrLastEpisodeOfSeason(int episodeId)
|
||||||
{
|
{
|
||||||
var episode = GetEpisode(episodeId);
|
var episode = GetEpisode(episodeId);
|
||||||
|
Binary file not shown.
@ -14,11 +14,13 @@ define(
|
|||||||
template: 'Series/Details/SeasonLayoutTemplate',
|
template: 'Series/Details/SeasonLayoutTemplate',
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
seasonSearch: '.x-season-search'
|
seasonSearch : '.x-season-search',
|
||||||
|
seasonMonitored: '.x-season-monitored'
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-season-search': '_seasonSearch'
|
'click .x-season-search' : '_seasonSearch',
|
||||||
|
'click .x-season-monitored': '_seasonMonitored'
|
||||||
},
|
},
|
||||||
|
|
||||||
regions: {
|
regions: {
|
||||||
@ -72,12 +74,14 @@ define(
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function () {
|
onRender: function () {
|
||||||
this.episodeGrid.show(new Backgrid.Grid({
|
this.episodeGrid.show(new Backgrid.Grid({
|
||||||
columns : this.columns,
|
columns : this.columns,
|
||||||
collection: this.episodeCollection,
|
collection: this.episodeCollection,
|
||||||
className : 'table table-hover season-grid'
|
className : 'table table-hover season-grid'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this._setSeasonMonitoredState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_seasonSearch: function () {
|
_seasonSearch: function () {
|
||||||
@ -112,6 +116,39 @@ define(
|
|||||||
self.idle = true;
|
self.idle = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_seasonMonitored: function () {
|
||||||
|
var self = this;
|
||||||
|
var name = 'monitored';
|
||||||
|
this.model.set(name, !this.model.get(name));
|
||||||
|
|
||||||
|
this.ui.seasonMonitored.addClass('icon-spinner icon-spin');
|
||||||
|
|
||||||
|
var promise = this.model.save();
|
||||||
|
|
||||||
|
promise.always(function (){
|
||||||
|
_.each(self.episodeCollection.models, function (episode) {
|
||||||
|
episode.set({ monitored: !episode.get('monitored') });
|
||||||
|
});
|
||||||
|
|
||||||
|
self.render();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_setSeasonMonitoredState: function () {
|
||||||
|
var monitored = this.model.get('monitored');
|
||||||
|
|
||||||
|
this.ui.seasonMonitored.removeClass('icon-spinner icon-spin');
|
||||||
|
|
||||||
|
if (this.model.get('monitored')) {
|
||||||
|
this.ui.seasonMonitored.addClass('icon-bookmark');
|
||||||
|
this.ui.seasonMonitored.removeClass('icon-bookmark-empty');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.ui.seasonMonitored.addClass('icon-bookmark-empty');
|
||||||
|
this.ui.seasonMonitored.removeClass('icon-bookmark');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
<div class="series-season">
|
<div class="series-season">
|
||||||
<h2>{{seasonTitle}} <span class="season-actions pull-right"><i class="icon-search x-season-search" /></span></h2>
|
<h2>
|
||||||
|
{{seasonTitle}}
|
||||||
|
<span class="season-actions pull-right">
|
||||||
|
<i class="x-season-monitored" title="Toggle season monitored status" />
|
||||||
|
<i class="icon-search x-season-search" />
|
||||||
|
</span>
|
||||||
|
</h2>
|
||||||
<div id="x-episode-grid"/>
|
<div id="x-episode-grid"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -175,10 +175,17 @@
|
|||||||
width : 12px;
|
width : 12px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toggle-cell {
|
||||||
|
i {
|
||||||
|
.clickable;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.season-actions {
|
.season-actions {
|
||||||
font-size : 24px;
|
font-size : 24px;
|
||||||
|
text-transform: none;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
.clickable;
|
.clickable;
|
||||||
|
Loading…
Reference in New Issue
Block a user