#27 added TV Search to the notification

pull/193/head
tidusjar 9 years ago
parent d07f544099
commit 4c59e9d19c

@ -78,9 +78,12 @@ $(function () {
if (seasons === "1") {
// Send over the first season
data = data + "&seasons=first";
}
var $notify = $('#notifyUser').is(':checked');
data = data + "&notify=" + $notify;
var type = $form.prop('method');
var url = $form.prop('action');

@ -98,7 +98,7 @@ namespace PlexRequests.UI.Modules
Get["movie/playing"] = parameters => CurrentlyPlayingMovies();
Post["request/movie"] = parameters => RequestMovie((int)Request.Form.movieId, (bool)Request.Form.notify);
Post["request/tv"] = parameters => RequestTvShow((int)Request.Form.tvId, (string)Request.Form.seasons);
Post["request/tv"] = parameters => RequestTvShow((int)Request.Form.tvId, (string)Request.Form.seasons, (bool)Request.Form.notify);
Post["request/album"] = parameters => RequestAlbum((string)Request.Form.albumId);
}
private IPlexApi PlexApi { get; }
@ -568,8 +568,9 @@ namespace PlexRequests.UI.Modules
/// </summary>
/// <param name="showId">The show identifier.</param>
/// <param name="seasons">The seasons.</param>
/// <param name="notify">if set to <c>true</c> [notify].</param>
/// <returns></returns>
private Response RequestTvShow(int showId, string seasons)
private Response RequestTvShow(int showId, string seasons, bool notify)
{
var tvApi = new TvMazeApi();
@ -589,6 +590,10 @@ namespace PlexRequests.UI.Modules
// check if the current user is already marked as a requester for this show, if not, add them
if (!existingRequest.UserHasRequested(Username))
{
if (notify)
{
existingRequest.AddUserToNotification(Username);
}
existingRequest.RequestedUsers.Add(Username);
RequestService.UpdateRequest(existingRequest);
}
@ -626,6 +631,10 @@ namespace PlexRequests.UI.Modules
ImdbId = showInfo.externals?.imdb ?? string.Empty,
SeasonCount = showInfo.seasonCount
};
if (notify)
{
model.AddUserToNotification(Username);
}
var seasonsList = new List<int>();
switch (seasons)
{

Loading…
Cancel
Save