Permalink
Browse files

Remove a lot of MAL stuff

  • Loading branch information...
da3dsoul committed Jun 14, 2018
1 parent 027fbfe commit 14a38d080847d77f052d00e9769db1495eab4041
Showing with 4 additions and 3,627 deletions.
  1. +1 −1 Shoko.Commons
  2. +0 −9 Shoko.Server/API/v1/Implementations/ShokoServiceImplementation/ShokoServiceImplementation.cs
  3. +0 −20 ...o.Server/API/v1/Implementations/ShokoServiceImplementation/ShokoServiceImplementation_Entities.cs
  4. +0 −136 ....Server/API/v1/Implementations/ShokoServiceImplementation/ShokoServiceImplementation_Providers.cs
  5. +0 −98 Shoko.Server/API/v2/Modules/Core.cs
  6. +0 −2 Shoko.Server/Commands/AniDB/CommandRequest_AddFileToMyList.cs
  7. +1 −9 Shoko.Server/Commands/AniDB/CommandRequest_VoteAnime.cs
  8. +0 −162 Shoko.Server/Commands/MAL/CommandRequest_MALDownloadStatusFromMAL.cs
  9. +0 −160 Shoko.Server/Commands/MAL/CommandRequest_MALSearchAnime.cs
  10. +0 −121 Shoko.Server/Commands/MAL/CommandRequest_MALUpdatedWatchedStatus.cs
  11. +0 −96 Shoko.Server/Commands/MAL/CommandRequest_MALUploadStatusToMAL.cs
  12. +0 −100 Shoko.Server/Commands/WebCache/CommandRequest_WebCacheDeleteXRefAniDBMAL.cs
  13. +0 −95 Shoko.Server/Commands/WebCache/CommandRequest_WebCacheSendXRefAniDBMAL.cs
  14. +0 −15 Shoko.Server/Extensions/ModelProviders.cs
  15. +0 −39 Shoko.Server/Import/Importer.cs
  16. +1 −18 Shoko.Server/Models/SVR_VideoLocal.cs
  17. +1 −74 Shoko.Server/Providers/Azure/AzureWebAPI.cs
  18. +0 −410 Shoko.Server/Providers/MyAnimeList/MALClasses/AnimeList.cs
  19. +0 −214 Shoko.Server/Providers/MyAnimeList/MALClasses/SearchResult.cs
  20. +0 −50 Shoko.Server/Providers/MyAnimeList/MALClasses/VerifyCredentials.cs
  21. +0 −835 Shoko.Server/Providers/MyAnimeList/MALHelper.cs
  22. +0 −50 Shoko.Server/Providers/MyAnimeList/XMLSchema/AnimeList.xsd
  23. +0 −29 Shoko.Server/Providers/MyAnimeList/XMLSchema/SearchResult.xsd
  24. +0 −13 Shoko.Server/Providers/MyAnimeList/XMLSchema/VerifyCredentials.xsd
  25. +0 −621 Shoko.Server/Providers/MyAnimeList/sample/AnimeList.xml
  26. +0 −20 Shoko.Server/Providers/MyAnimeList/sample/AnimeValues.xml
  27. +0 −125 Shoko.Server/Providers/MyAnimeList/sample/SearchResult.xml
  28. +0 −6 Shoko.Server/Providers/MyAnimeList/sample/VerifyCredentials.xml
  29. +0 −85 Shoko.Server/ServerSettings.cs
  30. +0 −10 Shoko.Server/Shoko.Server.csproj
  31. +0 −4 Shoko.Server/ShokoServer.cs
@@ -527,8 +527,6 @@ public CL_Response SaveServerSettings(CL_ServerSettings contractIn)
ServerSettings.WebCache_TvDB_Send = contractIn.WebCache_TvDB_Send;
ServerSettings.WebCache_Trakt_Get = contractIn.WebCache_Trakt_Get;
ServerSettings.WebCache_Trakt_Send = contractIn.WebCache_Trakt_Send;
ServerSettings.WebCache_MAL_Get = contractIn.WebCache_MAL_Get;
ServerSettings.WebCache_MAL_Send = contractIn.WebCache_MAL_Send;
ServerSettings.WebCache_UserInfo = contractIn.WebCache_UserInfo;
// TvDB
@@ -578,13 +576,6 @@ public CL_Response SaveServerSettings(CL_ServerSettings contractIn)
ServerSettings.Trakt_UpdateFrequency = (ScheduledUpdateFrequency) contractIn.Trakt_UpdateFrequency;
ServerSettings.Trakt_SyncFrequency = (ScheduledUpdateFrequency) contractIn.Trakt_SyncFrequency;
// MAL
ServerSettings.MAL_AutoLink = contractIn.MAL_AutoLink;
ServerSettings.MAL_Username = contractIn.MAL_Username;
ServerSettings.MAL_Password = contractIn.MAL_Password;
ServerSettings.MAL_UpdateFrequency = (ScheduledUpdateFrequency) contractIn.MAL_UpdateFrequency;
ServerSettings.MAL_NeverDecreaseWatchedNums = contractIn.MAL_NeverDecreaseWatchedNums;
//Plex
ServerSettings.Plex_Server = contractIn.Plex_ServerHost;
ServerSettings.Plex_Libraries = contractIn.Plex_Sections.Length > 0
@@ -1,39 +1,19 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel;
using System.Threading;
using AniDBAPI;
using AniDBAPI.Commands;
using Shoko.Models;
using Shoko.Models.Azure;
using Shoko.Models.Server;
using Shoko.Commons.Extensions;
using Shoko.Models.Enums;
using Shoko.Models.Client;
using Shoko.Models.Interfaces;
using NLog;
using NutzCode.CloudFileSystem;
using Pri.LongPath;
using Shoko.Server.Commands;
using Shoko.Server.Commands.AniDB;
using Shoko.Server.Commands.MAL;
using Shoko.Server.Commands.TvDB;
using Shoko.Server.Databases;
using Shoko.Server.Models;
using Shoko.Server.Providers.Azure;
using Shoko.Server.Providers.MovieDB;
using Shoko.Server.Providers.MyAnimeList;
using Shoko.Server.Providers.TraktTV;
using Shoko.Server.Repositories;
using Shoko.Models.TvDB;
using Shoko.Server.Commands.Plex;
using Shoko.Server.Extensions;
using Shoko.Server.Repositories.NHibernate;
using Shoko.Server.Repositories.Cached;
using Shoko.Server.Providers.TraktTV.Contracts;
using Shoko.Server.Tasks;
namespace Shoko.Server
@@ -9,19 +9,16 @@
using Shoko.Models.Server;
using Shoko.Models.TvDB;
using Shoko.Server.Commands;
using Shoko.Server.Commands.MAL;
using Shoko.Server.Commands.TvDB;
using Shoko.Server.Databases;
using Shoko.Server.Extensions;
using Shoko.Server.Models;
using Shoko.Server.Providers.Azure;
using Shoko.Server.Providers.MovieDB;
using Shoko.Server.Providers.MyAnimeList;
using Shoko.Server.Providers.TraktTV;
using Shoko.Server.Providers.TraktTV.Contracts;
using Shoko.Server.Providers.TvDB;
using Shoko.Server.Repositories;
using TvDbSharper.Dto;
namespace Shoko.Server
{
@@ -1197,139 +1194,6 @@ public CL_TraktDeviceCode GetTraktDeviceCode()
#endregion
#region MAL
public CL_CrossRef_AniDB_MAL_Response GetMALCrossRefWebCache(int animeID)
{
try
{
return AzureWebAPI.Get_CrossRefAniDBMAL(animeID);
}
catch (Exception ex)
{
logger.Error(ex, ex.ToString());
return null;
}
}
public List<CL_MALAnime_Response> SearchMAL(string criteria)
{
List<CL_MALAnime_Response> results = new List<CL_MALAnime_Response>();
try
{
anime malResults = MALHelper.SearchAnimesByTitle(criteria);
foreach (animeEntry res in malResults.entry)
results.Add(res.ToContract());
return results;
}
catch (Exception ex)
{
logger.Error(ex, ex.ToString());
return results;
}
}
public string LinkAniDBMAL(int animeID, int malID, string malTitle, int epType, int epNumber)
{
try
{
CrossRef_AniDB_MAL xrefTemp = RepoFactory.CrossRef_AniDB_MAL.GetByMALID(malID);
if (xrefTemp != null)
{
string animeName = string.Empty;
try
{
SVR_AniDB_Anime anime = RepoFactory.AniDB_Anime.GetByAnimeID(xrefTemp.AnimeID);
if (anime != null) animeName = anime.MainTitle;
}
catch
{
}
return
$"Not using MAL link as this MAL ID ({malID}) is already in use by {xrefTemp.AnimeID} ({animeName})";
}
MALHelper.LinkAniDBMAL(animeID, malID, malTitle, epType, epNumber, false);
return string.Empty;
}
catch (Exception ex)
{
logger.Error(ex, ex.ToString());
return ex.Message;
}
}
public string LinkAniDBMALUpdated(int animeID, int malID, string malTitle, int oldEpType, int oldEpNumber,
int newEpType, int newEpNumber)
{
try
{
CrossRef_AniDB_MAL xrefTemp = RepoFactory.CrossRef_AniDB_MAL
.GetByAnimeConstraint(animeID, oldEpType, oldEpNumber).FirstOrDefault(a => a.MALID == malID);
if (xrefTemp == null)
return $"Could not find MAL link ({animeID}/{oldEpType}/{oldEpNumber})";
RepoFactory.CrossRef_AniDB_MAL.Delete(xrefTemp);
return LinkAniDBMAL(animeID, malID, malTitle, newEpType, newEpNumber);
}
catch (Exception ex)
{
logger.Error(ex, ex.ToString());
return ex.Message;
}
}
public string RemoveLinkAniDBMAL(int animeID, int malID, int epType, int epNumber)
{
try
{
MALHelper.RemoveLinkAniDBMAL(animeID, malID, epType, epNumber);
return string.Empty;
}
catch (Exception ex)
{
logger.Error(ex, ex.ToString());
return ex.Message;
}
}
public string TestMALLogin()
{
try
{
if (MALHelper.VerifyCredentials())
return string.Empty;
return "Login is not valid";
}
catch (Exception ex)
{
logger.Error(ex, "Error in TestMALLogin: " + ex.ToString());
return ex.Message;
}
}
public void SyncMALUpload()
{
CommandRequest_MALUploadStatusToMAL cmd = new CommandRequest_MALUploadStatusToMAL();
cmd.Save();
}
public void SyncMALDownload()
{
CommandRequest_MALDownloadStatusFromMAL cmd = new CommandRequest_MALDownloadStatusFromMAL();
cmd.Save();
}
#endregion
#region Other Cross Refs
public CL_CrossRef_AniDB_Other_Response GetOtherAnimeCrossRefWebCache(int animeID, int crossRefType)
@@ -9,24 +9,17 @@
using System.Threading;
using System.Threading.Tasks;
using AniDBAPI;
using FluentNHibernate.MappingModel;
using Nancy;
using Nancy.ModelBinding;
using Nancy.Security;
using NLog;
using Shoko.Commons.Extensions;
using Shoko.Commons.Utils;
using Shoko.Models.Client;
using Shoko.Models.Enums;
using Shoko.Models.Server;
using Shoko.Server.API.v2.Models.core;
using Shoko.Server.Commands;
using Shoko.Server.Commands.MAL;
using Shoko.Server.Extensions;
using Shoko.Server.Models;
using Shoko.Server.PlexAndKodi;
using Shoko.Server.Providers.MyAnimeList;
using Shoko.Server.Providers.TraktTV;
using Shoko.Server.Repositories;
using Shoko.Server.Utilities;
@@ -66,18 +59,6 @@ public Core() : base("/api")
#endregion
#region 03.MyAnimeList
Post["/mal/set", true] = async (x,ct) => await Task.Factory.StartNew(SetMAL, ct);
Get["/mal/get", true] = async (x,ct) => await Task.Factory.StartNew(GetMAL, ct);
Get["/mal/test", true] = async (x,ct) => await Task.Factory.StartNew(TestMAL, ct);
Get["/mal/update", true] = async (x,ct) => await Task.Factory.StartNew(ScanMAL, ct);
Get["/mal/download", true] = async (x,ct) => await Task.Factory.StartNew(DownloadFromMAL, ct);
Get["/mal/upload", true] = async (x,ct) => await Task.Factory.StartNew(UploadToMAL, ct);
//Get["/mal/votes/sync", true] = async (x,ct) => await Task.Factory.StartNew(SyncMALVotes, ct); <-- not implemented as CommandRequest
#endregion
#region 04.Trakt
Post["/trakt/set"] = x => APIStatus.NotImplemented();
@@ -506,85 +487,6 @@ private object UpdateMissingAniDBXML()
#endregion
#region 03.MyAnimeList
/// <summary>
/// Set MAL account with login, password
/// </summary>
/// <returns></returns>
private object SetMAL()
{
Credentials cred = this.Bind();
if (!String.IsNullOrEmpty(cred.login) && cred.login != string.Empty && !String.IsNullOrEmpty(cred.password) &&
cred.password != string.Empty)
{
ServerSettings.MAL_Username = cred.login;
ServerSettings.MAL_Password = cred.password;
return APIStatus.OK();
}
return new APIMessage(400, "Login and Password missing");
}
/// <summary>
/// Return current used MAL Creditentials
/// </summary>
/// <returns></returns>
private object GetMAL()
{
Credentials cred = new Credentials
{
login = ServerSettings.MAL_Username,
password = ServerSettings.MAL_Password
};
return cred;
}
/// <summary>
/// Test MAL Creditionals against MAL
/// </summary>
/// <returns></returns>
private object TestMAL()
{
return MALHelper.VerifyCredentials()
? APIStatus.OK()
: APIStatus.Unauthorized();
}
/// <summary>
/// Scan MAL
/// </summary>
/// <returns></returns>
private object ScanMAL()
{
Importer.RunImport_ScanMAL();
return APIStatus.OK();
}
/// <summary>
/// Download Watched States from MAL
/// </summary>
/// <returns></returns>
private object DownloadFromMAL()
{
CommandRequest_MALDownloadStatusFromMAL cmd = new CommandRequest_MALDownloadStatusFromMAL();
cmd.Save();
return APIStatus.OK();
}
/// <summary>
/// Upload Watched States to MAL
/// </summary>
/// <returns></returns>
private object UploadToMAL()
{
CommandRequest_MALUploadStatusToMAL cmd = new CommandRequest_MALUploadStatusToMAL();
cmd.Save();
return APIStatus.OK();
}
#endregion
#region 04.Trakt
/// <summary>
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Xml;
using AniDBAPI;
using Shoko.Commons.Queue;
using Shoko.Models.Enums;
using Shoko.Models.Queue;
using Shoko.Models.Server;
using Shoko.Server.Commands.MAL;
using Shoko.Server.Extensions;
using Shoko.Server.Models;
using Shoko.Server.Repositories;
@@ -5,7 +5,6 @@
using Shoko.Models.Enums;
using Shoko.Models.Queue;
using Shoko.Models.Server;
using Shoko.Server.Commands.MAL;
namespace Shoko.Server.Commands
{
@@ -47,13 +46,6 @@ public override void ProcessCommand()
try
{
ShokoService.AnidbProcessor.VoteAnime(AnimeID, VoteValue, (AniDBVoteType) VoteType);
if (!string.IsNullOrEmpty(ServerSettings.MAL_Username) &&
!string.IsNullOrEmpty(ServerSettings.MAL_Password))
{
CommandRequest_MALUpdatedWatchedStatus cmdMAL = new CommandRequest_MALUpdatedWatchedStatus(AnimeID);
cmdMAL.Save();
}
}
catch (Exception ex)
{
@@ -112,4 +104,4 @@ public override CommandRequest ToDatabaseObject()
return cq;
}
}
}
}
Oops, something went wrong.

0 comments on commit 14a38d0

Please sign in to comment.