Skip to content
Permalink
Browse files

Fix Episodes with No Titles at Startup (using cache only)

  • Loading branch information...
da3dsoul committed Oct 1, 2019
1 parent 81dd03b commit 39be2003ca99a26e7c5d39498d00e724f02ee4c5
@@ -342,14 +342,6 @@ public static List<Raw_AniDB_ResourceLink> ProcessResources(XmlDocument docAnime
return result;
}

public static List<Raw_AniDB_Episode> GetEpisodes(int animeID)
{
XmlDocument docAnime = GetAnimeXMLFromAPI(animeID);
if (docAnime == null)
return null;
return ProcessEpisodes(docAnime, animeID);
}

public static List<Raw_AniDB_Tag> ProcessTags(XmlDocument docAnime, int animeID)
{
List<Raw_AniDB_Tag> tags = new List<Raw_AniDB_Tag>();
@@ -312,7 +312,8 @@ public static void RegenTvDBMatches()

public static void FixAniDB_EpisodesWithMissingTitles()
{
var specials = RepoFactory.AniDB_Episode.GetAll().Where(a => string.IsNullOrEmpty(a.GetEnglishTitle()))
var specials = RepoFactory.AniDB_Episode.GetAll()
.Where(a => !RepoFactory.AniDB_Episode_Title.GetByEpisodeID(a.EpisodeID).Any())
.Select(a => a.AnimeID).Distinct().OrderBy(a => a).ToList();
int count = 0;
foreach (int animeID in specials)
@@ -0,0 +1,2 @@
This is where the direct models with all possible info from AniDB is stored.
It has no concern for our system's setup. It should mimic what AniDB gives us, in a...less stupid fashion, hopefully.
@@ -0,0 +1,3 @@
This is where the new system for AniDB will be held.
This should have test driven development in mind wherever possible.
It's fine to have reused code in here, but reused code should be organized and redocumented for the future.
@@ -10,6 +10,7 @@
using NutzCode.InMemoryIndex;
using Shoko.Commons.Extensions;
using Shoko.Models.Enums;
using Shoko.Server.Databases;
using Shoko.Server.Models;

namespace Shoko.Server.Repositories
@@ -46,6 +47,7 @@ protected override int SelectKey(AniDB_Episode entity)

public override void RegenerateDb()
{
DatabaseFixes.FixAniDB_EpisodesWithMissingTitles();
}


@@ -23,8 +23,8 @@ public static class RepoFactory
public static CloudAccountRepository CloudAccount { get; } = CloudAccountRepository.Create();
public static ImportFolderRepository ImportFolder { get; } = ImportFolderRepository.Create();
public static AniDB_AnimeRepository AniDB_Anime { get; } = AniDB_AnimeRepository.Create();
public static AniDB_EpisodeRepository AniDB_Episode { get; } = AniDB_EpisodeRepository.Create();
public static AniDB_Episode_TitleRepository AniDB_Episode_Title { get; } = AniDB_Episode_TitleRepository.Create();
public static AniDB_EpisodeRepository AniDB_Episode { get; } = AniDB_EpisodeRepository.Create();
public static AniDB_FileRepository AniDB_File { get; } = AniDB_FileRepository.Create();
public static AniDB_Anime_TitleRepository AniDB_Anime_Title { get; } = AniDB_Anime_TitleRepository.Create();
public static AniDB_Anime_TagRepository AniDB_Anime_Tag { get; } = AniDB_Anime_TagRepository.Create();
@@ -1737,6 +1737,8 @@
<ItemGroup>
<Resource Include="API\readme.txt" />
<Content Include="API\v3\README.md" />
<Content Include="Providers\AniDB\Models\Readme.md" />
<Content Include="Providers\AniDB\Readme.md" />
<Content Include="webui\index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

0 comments on commit 39be200

Please sign in to comment.
You can’t perform that action at this time.