[Approved] - [German] OFDB.de (2008-08-22) | Page 18

Discussion in 'Submit: Movie Info Grabbers' started by FlipGer, November 17, 2007.

  1. MasterMarc

    MasterMarc Portal Pro

    Joined:
    June 21, 2007
    Messages:
    158
    Likes Received:
    139
    Occupation:
    Student at RUB, Support-staff-member at G DATA
    Location:
    Bochum & Gelsenkirchen
    Ratings:
    +139 / 0
    Home Country:
    Germany Germany
    Das Problem liegt an der Quelle, da die XML-Datenstruktur geändert wurde und somit MP einige Punkte vergebens sucht. Leider bin ich in der Programmierung mit dem Auslesen von XML-Daten nicht bewandert...

    MfG Marc


     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Godspeed

    Godspeed Portal Pro

    Joined:
    September 5, 2008
    Messages:
    272
    Likes Received:
    3
    Gender:
    Male
    Ratings:
    +14 / 0
    Home Country:
    Germany Germany
    Show System Specs
    Dasselbe Problem habe ich auch. :(
     
  4. justinteract

    justinteract New Member

    Joined:
    November 8, 2007
    Messages:
    95
    Likes Received:
    13
    Location:
    Hamburg
    Ratings:
    +13 / 0
    Home Country:
    Germany Germany
    Wie sollen denn Suchanfragen mit Umlauten funktionieren (z.B. "Conan - Der Zerstörer") ?
    Im code des scripts gibt es keine Sonderbehandlung für Umlaute und per Browser bekomme ich auch keine Abfrage hin.
    Welche encodierung will denn OFDBGW sehen?
    habe die üblichen ausprobiert... immer kein Ergebnis

    Nach kurzer Rücksprache mit Björn von OFDBGW (danke für die schnelle Antwort) hat sich ergeben das nicht die Umlaute schuld sind, sondern das - Zeichen in "Conan - Der Zerstörer".
    Daher liefert
    http://xml.n4rf.net/ofdbgw/search/Conan Der Zerstörer
    kein Ergebnis aber
    http://xml.n4rf.net/ofdbgw/search/Conan - Der Zerstörer
    funktioniert.

    Laut Björn liegt das an dem Such/Index Algorithmus von OFDB der das - mit in den Titel aufnimmt.

    Vorschlag: im Grabber "script" könnte man dieses berücksichtigen indem man eine zweite Abfrage mit - ausführt (also ohne Replace('-','?') und vielleicht auch ohne .Replace(':','?').Replace('.','?'))

    Wer ist für das scripts zuständig ?
     
  5. rbo

    rbo Portal Pro

    Joined:
    May 1, 2007
    Messages:
    359
    Likes Received:
    10
    Location:
    Ludwigsburg
    Ratings:
    +21 / 1
    Home Country:
    Germany Germany
    Show System Specs
    Habe exakt das gleiche Problem wie Heffernan.
     
  6. Der_Bub
    • Premium Supporter

    Der_Bub MP Donator

    Joined:
    June 17, 2008
    Messages:
    829
    Likes Received:
    52
    Location:
    Cologne
    Ratings:
    +60 / 2
    Home Country:
    Germany Germany
    Show System Specs
  7. MasterMarc

    MasterMarc Portal Pro

    Joined:
    June 21, 2007
    Messages:
    158
    Likes Received:
    139
    Occupation:
    Student at RUB, Support-staff-member at G DATA
    Location:
    Bochum & Gelsenkirchen
    Ratings:
    +139 / 0
    Home Country:
    Germany Germany
    nein, es ist leider nicht kompatibel, da movingpictures eine andere such-engine hat.
    marc
     
  8. Froschkönig

    Froschkönig Portal Member

    Joined:
    January 20, 2008
    Messages:
    11
    Likes Received:
    1
    Ratings:
    +1 / 0
    Hallo
    Ich habe mich mal an dem Script versucht und für mich funktioniert es jetzt wieder.
    Da ich nicht weiss, wie man hier Dateien hochladen kann, hänge ich das geänderte Skript einfach in Textform an.
    Also ab hier


    //css_reference "core.dll";
    //css_reference "Databases.dll";
    //css_reference "utils.dll";

    /* Written by Johannes Stelzer */

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Net;
    using System.Collections;
    using System.Web;
    using System.Xml;
    using System.Text.RegularExpressions;
    using MediaPortal.Util;

    class Grabber : MediaPortal.Video.Database.IIMDBScriptGrabber
    {
    private const string findUrl = "http://xml.n4rf.net/ofdbgw/search/";
    private const string detailUrl = "http://xml.n4rf.net/ofdbgw/movie/";

    public Grabber() {}

    void MediaPortal.Video.Database.IIMDBScriptGrabber.FindFilm(string strSearch, int iLimit, ArrayList elements)
    {
    Uri searchUrl = new Uri(findUrl + clearSigns(clearArticles(strSearch.Trim())));

    MediaPortal.GUI.Library.Log.Info("searching... " + searchUrl.ToString());

    if (iLimit <= 0)
    return;

    ArrayList idList = new ArrayList(iLimit);

    try
    {
    XmlTextReader reader = new XmlTextReader(searchUrl.ToString());
    string lastElement = "";
    string title = "";
    string id = "";


    while (reader.Read() && (elements.Count < iLimit) )
    {
    switch (reader.NodeType)
    {
    case XmlNodeType.Element:
    lastElement = reader.Name.ToLower();
    switch ( lastElement )
    {
    case "eintrag":
    title = "";
    id = "";

    break;

    default:
    break;
    }
    break;

    case XmlNodeType.EndElement:
    switch ( reader.Name.ToLower() )
    {
    case "eintrag":
    MediaPortal.Video.Database.IMDB.IMDBUrl url =
    new MediaPortal.Video.Database.IMDB.IMDBUrl(detailUrl + id, title, "ofdb_xml");
    if (! idList.Contains(id)) {
    elements.Add(url);
    idList.Add(id);
    }
    break;

    default:
    break;
    }
    break;

    case XmlNodeType.Text:
    switch ( lastElement )
    {
    case "count":
    if (reader.Value == "0")
    return;
    break;

    case "titel":
    title = reader.Value;
    break;

    case "id":
    id = reader.Value;
    break;


    default:
    break;
    }
    break;

    default:
    break;
    }
    }
    }
    catch (XmlException e)
    {
    MediaPortal.GUI.Library.Log.Error("error occured: " + e.Message);
    }
    }


    bool MediaPortal.Video.Database.IIMDBScriptGrabber.GetDetails(MediaPortal.Video.Database.IMDB.IMDBUrl url, ref MediaPortal.Video.Database.IMDBMovie movieDetails)
    {
    try
    {
    XmlTextReader reader = new XmlTextReader(url.URL);
    string lastElement = "";
    string lastElementParent = "";

    while (reader.Read())
    {
    switch (reader.NodeType)
    {
    case XmlNodeType.Element:
    lastElement = reader.Name.ToLower();
    switch ( lastElement )
    {
    case "besetzung":
    lastElementParent = lastElement;
    break;

    case "regie":
    lastElementParent = lastElement;
    break;

    case "genre":
    lastElementParent = lastElement;
    break;

    case "resultat":
    movieDetails.Genre = String.Empty;
    movieDetails.Cast = String.Empty;
    movieDetails.Director = String.Empty;
    movieDetails.Plot = String.Empty;
    lastElementParent = lastElement;
    break;





    default:
    break;
    }
    break;

    case XmlNodeType.EndElement:
    switch ( reader.Name.ToLower() )
    {
    case "besetzung":
    lastElementParent = "";
    break;

    case "regie":
    lastElementParent = "";
    break;

    case "genre":
    lastElementParent = "";
    break;

    case "resultat":
    break;

    default:
    break;
    }
    break;

    case XmlNodeType.Text:
    switch ( lastElement )
    {
    case "titel":
    switch (lastElementParent)
    {
    case "resultat":
    movieDetails.Title = reader.Value;
    break;

    case "genre":
    if ( movieDetails.Genre != String.Empty )
    movieDetails.Genre = movieDetails.Genre +" / "+reader.Value;
    else
    {
    movieDetails.Genre = reader.Value;
    movieDetails.SingleGenre = reader.Value;
    }
    break;

    default:
    break;
    }
    break;

    case "bild":
    movieDetails.ThumbURL = reader.Value;
    break;

    case "jahr":
    try {
    movieDetails.Year = System.Int32.Parse(reader.Value);
    }
    catch (FormatException)
    {
    movieDetails.Year = 1900;
    }
    break;

    case "note":
    try {
    movieDetails.Rating = System.Single.Parse(reader.Value.Replace(".", ","));
    }
    catch (FormatException)
    {
    movieDetails.Rating = 0;
    }

    break;

    case "stimmen":
    movieDetails.Votes = reader.Value;
    break;

    case "platz":
    try {
    movieDetails.Top250 = System.Int32.Parse(reader.Value);
    } catch (FormatException)
    {
    movieDetails.Top250 = 0;
    }
    break;

    case "kurzbeschreibung":
    movieDetails.PlotOutline = reader.Value;
    break;

    case "beschreibung":
    movieDetails.Plot = reader.Value;
    break;

    case "name":
    switch (lastElementParent)
    {
    case "besetzung":
    if ( movieDetails.Cast != String.Empty )
    movieDetails.Cast = movieDetails.Cast +", "+reader.Value;
    else
    movieDetails.Cast = reader.Value;
    break;

    case "regie":
    if ( movieDetails.Director != String.Empty )
    movieDetails.Director = movieDetails.Director +", "+reader.Value;
    else
    movieDetails.Director = reader.Value;
    break;

    default:
    break;
    }
    break;

    default:
    break;
    }
    break;

    default:
    break;
    }
    }
    }
    catch (XmlException e)
    {
    MediaPortal.GUI.Library.Log.Error("error occured: " + e.Message);
    return false;
    }

    if (movieDetails.Plot == String.Empty)
    movieDetails.Plot = movieDetails.PlotOutline;

    return true;
    }

    string MediaPortal.Video.Database.IIMDBScriptGrabber.GetName()
    {
    return "OFDB_XML grabber";
    }

    string MediaPortal.Video.Database.IIMDBScriptGrabber.GetLanguage()
    {
    return "DE";
    }

    string clearSigns(string str) {
    return str.Replace('.','?').Replace('-','?').Replace(':','?').Replace('.','?');
    }

    string clearArticles(string str) {
    int pos = str.IndexOf("Die+", StringComparison.CurrentCultureIgnoreCase);
    if (pos == 0)
    return str.Remove(0,4);

    pos = str.IndexOf("Der+", StringComparison.CurrentCultureIgnoreCase);
    if (pos == 0)
    return str.Remove(0,4);

    pos = str.IndexOf("Das+", StringComparison.CurrentCultureIgnoreCase);
    if (pos == 0)
    return str.Remove(0,4);

    pos = str.IndexOf("The+", StringComparison.CurrentCultureIgnoreCase);
    if (pos == 0)
    return str.Remove(0,4);

    return str;
    }
    }



    bis hier als "ofdb_xml.csscript" speichern.

    Ich hoffe es funktioniert!
     
    • Like Like x 1
  9. MasterMarc

    MasterMarc Portal Pro

    Joined:
    June 21, 2007
    Messages:
    158
    Likes Received:
    139
    Occupation:
    Student at RUB, Support-staff-member at G DATA
    Location:
    Bochum &amp; Gelsenkirchen
    Ratings:
    +139 / 0
    Home Country:
    Germany Germany
    ich werds mal probieren, baue es dann ggf. direkt in meine kombi-engine aus ofdb und imdb ein (die auch laufzeit und sonstige infos grabbt, sowie die bessere suche der imdb nutzt)

    --> habe es in meiner kombi eingebaut und es funzt ;) danke!
     
  10. rbo

    rbo Portal Pro

    Joined:
    May 1, 2007
    Messages:
    359
    Likes Received:
    10
    Location:
    Ludwigsburg
    Ratings:
    +21 / 1
    Home Country:
    Germany Germany
    Show System Specs
    Wo wird denn das Script eingebaut bzw. hinkopiert?
     
  11. MasterMarc

    MasterMarc Portal Pro

    Joined:
    June 21, 2007
    Messages:
    158
    Likes Received:
    139
    Occupation:
    Student at RUB, Support-staff-member at G DATA
    Location:
    Bochum &amp; Gelsenkirchen
    Ratings:
    +139 / 0
    Home Country:
    Germany Germany
    Unter Vista: C:\ProgramData\Team MediaPortal\MediaPortal\scripts\MovieInfo
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!