mirror of
https://github.com/jellyfin/jellyfin-plugin-trakt.git
synced 2024-11-27 07:40:26 +00:00
Clean up unused functions and other minor style fixes
This commit is contained in:
parent
e04179a7a4
commit
4c5b47e5a1
@ -7,9 +7,6 @@ using Trakt.Helpers;
|
||||
|
||||
namespace Trakt.Api
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Route("/Trakt/Users/{UserId}/Authorize", "POST")]
|
||||
public class DeviceAuthorization
|
||||
{
|
||||
@ -23,10 +20,7 @@ namespace Trakt.Api
|
||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||
public string UserId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
[Route("/Trakt/Users/{UserId}/Items/{Id}/Rate", "POST")]
|
||||
public class RateItem
|
||||
{
|
||||
@ -41,35 +35,6 @@ namespace Trakt.Api
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Route("/Trakt/Users/{UserId}/Items/{Id}/Comment", "POST")]
|
||||
public class CommentItem
|
||||
{
|
||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[ApiMember(Name = "Comment", Description = "Text for the comment", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||
public string Comment { get; set; }
|
||||
|
||||
[ApiMember(Name = "Spoiler", Description = "Set to true to indicate the comment contains spoilers. Defaults to false", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "POST")]
|
||||
public bool Spoiler { get; set; }
|
||||
|
||||
[ApiMember(Name = "Review", Description = "Set to true to indicate the comment is a 200+ word review. Defaults to false", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "POST")]
|
||||
public bool Review { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Route("/Trakt/Users/{UserId}/RecommendedMovies", "POST")]
|
||||
public class RecommendedMovies
|
||||
{
|
||||
@ -92,11 +57,6 @@ namespace Trakt.Api
|
||||
public bool HideWatchlisted { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Route("/Trakt/Users/{UserId}/RecommendedShows", "POST")]
|
||||
public class RecommendedShows
|
||||
{
|
||||
@ -197,25 +157,6 @@ namespace Trakt.Api
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public object Post(CommentItem request)
|
||||
{
|
||||
_logger.LogInformation("CommentItem request received");
|
||||
|
||||
var currentItem = _libraryManager.GetItemById(request.Id);
|
||||
|
||||
return _traktApi.SendItemComment(currentItem, request.Comment, request.Spoiler,
|
||||
UserHelper.GetTraktUser(request.UserId), request.Review).Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -226,8 +167,6 @@ namespace Trakt.Api
|
||||
return _traktApi.SendMovieRecommendationsRequest(UserHelper.GetTraktUser(request.UserId)).Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -266,7 +266,6 @@ namespace Trakt.Api
|
||||
};
|
||||
if (traktUser.ExportMediaInfo)
|
||||
{
|
||||
//traktMovieCollected.Is3D = m.Is3D;
|
||||
traktMovieCollected.audio_channels = audioStream.GetAudioChannels();
|
||||
traktMovieCollected.audio = audioStream.GetCodecRepresetation();
|
||||
traktMovieCollected.resolution = m.GetDefaultVideoStream().GetResolution();
|
||||
@ -291,8 +290,6 @@ namespace Trakt.Api
|
||||
return responses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add or remove a list of Episodes to/from the users trakt.tv library
|
||||
/// </summary>
|
||||
@ -592,85 +589,6 @@ namespace Trakt.Api
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="comment"></param>
|
||||
/// <param name="containsSpoilers"></param>
|
||||
/// <param name="traktUser"></param>
|
||||
/// <param name="isReview"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> SendItemComment(BaseItem item, string comment, bool containsSpoilers, TraktUser traktUser, bool isReview = false)
|
||||
{
|
||||
return null;
|
||||
//TODO: This functionallity is not available yet
|
||||
// string url;
|
||||
// var data = new Dictionary<string, string>
|
||||
// {
|
||||
// {"username", traktUser.UserName},
|
||||
// {"password", traktUser.Password}
|
||||
// };
|
||||
//
|
||||
// if (item is Movie)
|
||||
// {
|
||||
// if (item.ProviderIds != null && item.ProviderIds.ContainsKey("Imdb"))
|
||||
// data.Add("imdb_id", item.ProviderIds["Imdb"]);
|
||||
//
|
||||
// data.Add("title", item.Name);
|
||||
// data.Add("year", item.ProductionYear != null ? item.ProductionYear.ToString() : "");
|
||||
// url = TraktUris.CommentMovie;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var episode = item as Episode;
|
||||
// if (episode != null)
|
||||
// {
|
||||
// if (episode.Series.ProviderIds != null)
|
||||
// {
|
||||
// if (episode.Series.ProviderIds.ContainsKey("Imdb"))
|
||||
// data.Add("imdb_id", episode.Series.ProviderIds["Imdb"]);
|
||||
//
|
||||
// if (episode.Series.ProviderIds.ContainsKey("Tvdb"))
|
||||
// data.Add("tvdb_id", episode.Series.ProviderIds["Tvdb"]);
|
||||
// }
|
||||
//
|
||||
// data.Add("season", episode.AiredSeasonNumber.ToString());
|
||||
// data.Add("episode", episode.IndexNumber.ToString());
|
||||
// url = TraktUris.CommentEpisode;
|
||||
// }
|
||||
// else // It's a Series
|
||||
// {
|
||||
// data.Add("title", item.Name);
|
||||
// data.Add("year", item.ProductionYear != null ? item.ProductionYear.ToString() : "");
|
||||
//
|
||||
// if (item.ProviderIds != null)
|
||||
// {
|
||||
// if (item.ProviderIds.ContainsKey("Imdb"))
|
||||
// data.Add("imdb_id", item.ProviderIds["Imdb"]);
|
||||
//
|
||||
// if (item.ProviderIds.ContainsKey("Tvdb"))
|
||||
// data.Add("tvdb_id", item.ProviderIds["Tvdb"]);
|
||||
// }
|
||||
//
|
||||
// url = TraktUris.CommentShow;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// data.Add("comment", comment);
|
||||
// data.Add("spoiler", containsSpoilers.ToString());
|
||||
// data.Add("review", isReview.ToString());
|
||||
//
|
||||
// Stream response =
|
||||
// await
|
||||
// _httpClient.Post(url, data, Plugin.Instance.TraktResourcePool,
|
||||
// CancellationToken.None).ConfigureAwait(false);
|
||||
//
|
||||
// return _jsonSerializer.DeserializeFromStream<TraktResponseDataContract>(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -684,8 +602,6 @@ namespace Trakt.Api
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -699,8 +615,6 @@ namespace Trakt.Api
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -755,8 +669,7 @@ namespace Trakt.Api
|
||||
|
||||
private int? ParseId(string value)
|
||||
{
|
||||
int parsed;
|
||||
if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out parsed))
|
||||
if (int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsed))
|
||||
{
|
||||
return parsed;
|
||||
}
|
||||
@ -798,7 +711,7 @@ namespace Trakt.Api
|
||||
: ParseId(m.GetProviderId(MetadataProviders.Tmdb))
|
||||
},
|
||||
year = m.ProductionYear,
|
||||
watched_at = lastPlayedDate.HasValue ? lastPlayedDate.Value.ToISO8601() : null
|
||||
watched_at = lastPlayedDate?.ToISO8601()
|
||||
};
|
||||
}).ToList();
|
||||
var chunks = moviesPayload.ToChunks(100).ToList();
|
||||
@ -821,8 +734,6 @@ namespace Trakt.Api
|
||||
return traktResponses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a list of episodes to trakt.tv that have been marked watched or unwatched
|
||||
/// </summary>
|
||||
@ -854,7 +765,6 @@ namespace Trakt.Api
|
||||
return traktResponses;
|
||||
}
|
||||
|
||||
|
||||
private async Task<TraktSyncResponse> SendEpisodePlaystateUpdatesInternalAsync(IEnumerable<Episode> episodeChunk, TraktUser traktUser, bool seen, CancellationToken cancellationToken)
|
||||
{
|
||||
var data = new TraktSyncWatched { episodes = new List<TraktEpisodeWatched>(), shows = new List<TraktShowWatched>() };
|
||||
|
Loading…
Reference in New Issue
Block a user