@ -79,7 +79,7 @@ namespace PlexRequests.UI.Modules
Get [ "movie/playing" ] = parameters = > CurrentlyPlayingMovies ( ) ;
Post [ "request/movie" ] = parameters = > RequestMovie ( ( int ) Request . Form . movieId ) ;
Post [ "request/tv" ] = parameters = > RequestTvShow ( ( int ) Request . Form . tvId , ( bool) Request . Form . latest ) ;
Post [ "request/tv" ] = parameters = > RequestTvShow ( ( int ) Request . Form . tvId , ( string) Request . Form . seasons ) ;
}
private TheMovieDbApi MovieApi { get ; }
private INotificationService NotificationService { get ; }
@ -263,7 +263,7 @@ namespace PlexRequests.UI.Modules
/// <param name="showId">The show identifier.</param>
/// <param name="latest">if set to <c>true</c> [latest].</param>
/// <returns></returns>
private Response RequestTvShow ( int showId , bool latest )
private Response RequestTvShow ( int showId , string seasons )
{
if ( RequestService . CheckRequest ( showId ) )
{
@ -289,7 +289,6 @@ namespace PlexRequests.UI.Modules
DateTime firstAir ;
DateTime . TryParse ( showInfo . premiered , out firstAir ) ;
var model = new RequestedModel
{
ProviderId = showInfo . externals ? . thetvdb ? ? 0 ,
@ -303,10 +302,21 @@ namespace PlexRequests.UI.Modules
Approved = false ,
RequestedBy = Session [ SessionKeys . UsernameKey ] . ToString ( ) ,
Issues = IssueState . None ,
LatestTv = latest ,
ImdbId = showInfo . externals ? . imdb ? ? string . Empty
ImdbId = showInfo . externals ? . imdb ? ? string . Empty ,
SeasonCount = showInfo . seasonCount
} ;
var seasonsList = new List < int > ( ) ;
switch ( seasons )
{
case "first" :
seasonsList . Add ( 1 ) ;
break ;
case "latest" :
seasonsList . Add ( model . SeasonCount ) ;
break ;
}
model . SeasonList = seasonsList . ToArray ( ) ;
var settings = PrService . GetSettings ( ) ;
if ( ! settings . RequireApproval )
@ -361,23 +371,23 @@ namespace PlexRequests.UI.Modules
return result ;
}
private Response SendToSickRage ( SickRageSettings sickRageSettings , RequestedModel model )
{
var result = SickrageApi . AddSeries ( model . ProviderId , model . LatestTv , sickRageSettings . QualityProfile ,
sickRageSettings . ApiKey , sickRageSettings . FullUri ) ;
//private Response SendToSickRage(SickRageSettings sickRageSettings, RequestedModel model )
// {
// var result = SickrageApi.AddSeries(model.ProviderId, model.SeasonCount, model.SeasonList, sickRageSettings.QualityProfile ,
// sickRageSettings.ApiKey, sickRageSettings.FullUri);
Log . Trace ( "SickRage Result: " ) ;
Log . Trace ( result . DumpJson ( ) ) ;
// Log.Trace("SickRage Result: ");
// Log.Trace(result.DumpJson());
if ( result ? . result = = "success" )
{
model . Approved = true ;
Log . Debug ( "Adding tv to database requests (No approval required & SickRage)" ) ;
RequestService . AddRequest ( model ) ;
// if (result?.result == "success")
// {
// model.Approved = true;
// Log.Debug("Adding tv to database requests (No approval required & SickRage)");
// RequestService.AddRequest(model);
return Response . AsJson ( new JsonResponseModel { Result = true } ) ;
}
return Response . AsJson ( new JsonResponseModel { Result = false , Message = "Something went wrong adding the movie to SickRage! Please check your settings." } ) ;
}
// return Response.AsJson(new JsonResponseModel { Result = true });
// }
// return Response.AsJson(new JsonResponseModel { Result = false, Message = "Something went wrong adding the movie to SickRage! Please check your settings." });
// }
}
}