Jump to content

AniSearch Moved to Separate Plugin


Luke

Recommended Posts

And out of the Anime plugin, which has gotten too big and difficult to understand.

So just an FYI for Anime users.

Link to comment
Share on other sites

  • 9 months later...

Wow super ich habe Ewig auf das Anisearch Plugin gewaret. Für mich als Animefan ein must have.

Jedoch wenn ich mir den Code anschaue muss ich feststellen das es zu einem grossen Teil unnütz und unfertig ist. Und so gar nichts nutzt!

Ich empfehle das Plugin zu überarbeiten.
Ich verstehe gerade nicht warum man das überhaupt released hat? ,Weil im grossen und ganzen macht es nichts.

AniSearchEpisodenProvider.cs

Bericht über den unvollständigen Code und was noch fehlt:

Innerhalb der Methode GetMetadata gibt es eine Schleife, die Informationen über alle Episoden im Bereich zwischen EpisodeNumber und EpisodeNumberEnd sammelt. Obwohl die Schleife die Episodennamen mithilfe eines regulären Ausdrucks extrahiert, werden diese Informationen nicht weiter verarbeitet, da die if- und else-Anweisungen innerhalb der Schleife leer sind.

Empfehlung:  Implementieren der Logik zur Verarbeitung der gesammelten Episodennamen. Dies kann beinhalten, dass Sie die Episodennamen den Episode-Objekten zuweisen und sie zur Ergebnisliste hinzufügen.

 In der Methode GetSearchResults gibt es einen auskommentierten Block von Code, der anscheinend dazu verwendet werden sollte, die AnidbEpisodeIdentity und die AnidbTvdbEpisodeConverter-Klassen zu verwenden, falls keine AniSearch-ID gefunden wird. Diese Logik ist jedoch nicht implementiert.

Empfehlung: Implementieren der Logik, um die auskommentierten Klassen (AnidbEpisodeIdentityProvider und AnidbTvdbEpisodeConverter) zu verwenden, falls keine AniSearch-ID gefunden wird. Dies kann dazu beitragen, die Abdeckung der Episode-Metadaten zu verbessern, indem alternative Quellen verwendet werden.

Die Methode GetImageResponse ist noch nicht implementiert und wirft eine NotImplementedException, wenn sie aufgerufen wird.

Empfehlung:

  • Implementieren der GetImageResponse-Methode, um die Bildinformationen von AniSearch oder einer alternativen Quelle abzurufen.

  • Für die erste Staffel und Filme: Verwenden als Bildquelle seiten wie TheTVDB/Moviedb.

  • Für Typen wie Bonus, OVA, TV-Special, Web und ONA: Verwenden einer alternative Bildquellen, um qualitativ hochwertigere Bilder bereitzustellen. Nutzen des Bild von AniSearch, um ähnliche Bilder in besserer Auflösung auf anderen Plattformen zu suchen, ohne das Originalbild direkt zu verwenden.

AniSearchSeriesProvider.cs

AniSearch Serie Metadata Crawler

Funktionalität: Der aktuelle Code ist in der Lage, Titel und Episodeninformationen aus AniSearch zu extrahieren. Allerdings fehlt die Funktionalität, um die folgenden Informationen zu crawlen:

  •     Die Beschreibung der Serie. Finde gerade das muss ein Musst funkionlaität sein
  •     Haupttitel zusammen mit dem Erscheinungsjahr
  •     Das Erscheinungsjahr separat.
  •     Alle Namen der Serie in verschiedenen Sprachen.
  •     Typ: und Anzahl der Folgen. --> Bei allen Typen ausser Serie und Film muss als Spezial in Emby eingetragen werden mit der Typsesierung
  •     Genres, Studios und Synonyme.
  •     Hauptgenres, Nebengenres und Tags.
  •     Relationen zu anderen Animes, die in Bezug auf die aktuelle Serie stehen, mit Verweisen auf ihre AnimesIDs.

Empfehlung: Um die fehlende Funktionalität zu implementieren, sollten man denentsprechenden Crawler entwickeln, die die oben genannten Informationen aus der AniSearch-Webseite extrahieren.

Link to comment
Share on other sites

Hi, all I really did was move the code out of the Anime plugin and into it's own plugin. I'm not that familiar with AniSearch. Do you want to make some changes and submit a pull request?

Link to comment
Share on other sites

On 4/14/2023 at 8:19 PM, Luke said:

Hi, all I really did was move the code out of the Anime plugin and into it's own plugin. I'm not that familiar with AniSearch. Do you want to make some changes and submit a pull request?

I see, who is the developer? It would make more sense to work with the person who programmed the plugin?
Also, I don't know how to debug this in Emby, and this is c# i am not familier.

E.g. an example with Javascript node.js

As i said i am not a top dog with c# and while node js has perfect bibliotkenes i am not happy with the htmlpharser

 

const axios = require('axios');
const cheerio = require('cheerio');

async function getAnimeDescription(anisearchId) {
  try {
    const url = `https://www.anisearch.de/anime/${anisearchId}`;
    const response = await axios.get(url);
    const $ = cheerio.load(response.data);

    const description = $('meta[name="description"]').attr('content');

    return description;
  } catch (error) {
    console.error('Error fetching anime description:', error);
    return null;
  }
}

(async () => {
  const anisearchId = 5170; // 07-Ghost anime ID
  const description = await getAnimeDescription(anisearchId);
  console.log('Anime Description:', description);
})();

we use cheerio library for web scraping

In this code example, we use axios to retrieve the web page and cheerio to parse and extract the description from the HTML. The getAnimeDescription function takes the anisearch ID of the anime as an argument and returns the description of the anime.

But in c#

Since the original code, written in C# imust integrate the extraction of the description in C# using HttpClient and HtmlAgilityPack . First, you need to add HtmlAgilityPack to the project as a NuGet package.

using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using HtmlAgilityPack;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Providers;

namespace Emby.Plugins.AniSearch
{
    public class AniSearchEpisodeProvider : IRemoteMetadataProvider<Episode, EpisodeInfo>
    {
        private readonly IServerConfigurationManager _configurationManager;
        private readonly IHttpClient _httpClient;

        public AniSearchEpisodeProvider(IServerConfigurationManager configurationManager, IHttpClient httpClient)
        {
            _configurationManager = configurationManager;
            _httpClient = httpClient;
        }

        public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo info, CancellationToken cancellationToken)
        {
            // Existing code...

            string url = "https://www.anisearch.de/anime/" + id + "/episodes";
            string web_content = await api.WebRequestAPI(url);
            
            // Extract the description
            string description = await GetAnimeDescription(url);

            // Existing code...
        }

        // New method for extracting the description
        public async Task<string> GetAnimeDescription(string url)
        {
            var httpClient = new HttpClient();
            var html = await httpClient.GetStringAsync(url);
            var htmlDoc = new HtmlDocument();
            htmlDoc.LoadHtml(html);

            var descriptionNode = htmlDoc.DocumentNode.SelectSingleNode("//meta[@name='description']");
            if (descriptionNode != null)
            {
                return descriptionNode.GetAttributeValue("content", string.Empty);
            }

            return string.Empty;
        }

        // Other existing methods...
    }
}

In this code, I added a new method called GetAnimeDescription that accepts the URL of the anime and extracts the description. Then I integrated this method with the GetMetadata method to get the description.

There is only one example, because I don't understand how the communication with Emby works and how to debug it

Edited by D1sk
Link to comment
Share on other sites

  • 4 weeks later...
On 4/17/2023 at 8:26 PM, Luke said:

The Emby Community :)

Another reason why it is worth developing the ANisearch plugin is the description of the content. The description at anisearch is more thoughtful, wordy and in-depth than Thetvdb and IMDB.
Compare Code Geass
Demons Slayer
Stein;gate
Anisearch has besides the English also the German description. Personally, I am focused on the German. However, the English corresponds to what is written in German.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...