IMDBFetcher (1 Viewer)

toertchn

Portal Member
January 5, 2008
23
4
Home Country
Germany Germany
Hi,

for me I had some videos with covers in the folders like:

Movie.avi
Movie.jpg

Another Movie.avi
Another Movie.jpg

When I start ImdbSearch and the Grabber returns no ThumbURL you search impawards.com. Before this and download a valid ThumbURL the function IMDBFetcher._fetchDetails() should look if there is any local coverArt and use this instead of Online Images.

Thx
 

toertchn

Portal Member
January 5, 2008
23
4
Home Country
Germany Germany
This code works for me. Not sure if runs anytime...anywhere.

Code:
private void _fetchDetails()
{
    try
    {
        disableCancel = false;
        if (movieDetails == null)
        {
            movieDetails = new IMDBMovie();
        }
        if (url == null)
        {
            return;
        }
        if (_imdb.GetDetails(this.url, ref movieDetails))
        {
            string line1;

            // try get local artwork
            string strImageURL = Util.Utils.GetCoverArt(movieDetails.Path, Path.GetFileNameWithoutExtension(movieDetails.File));

            if (!String.IsNullOrEmpty(strImageURL))
            {
                string largeCoverArt = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, movieDetails.Title);
                string coverArt = Util.Utils.GetCoverArtName(Thumbs.MovieTitle, movieDetails.Title);
                Util.Utils.FileDelete(largeCoverArt);
                Util.Utils.FileDelete(coverArt);
                line1 = "Import local Artwork";
                OnProgress(line1, movieDetails.Title, string.Empty, -1);
                //Only get actors if we really want to.
                if (getActors)
                {
                    _fetchActorsInMovie();
                }
                OnDisableCancel(this);

                if (Util.Picture.CreateThumbnail(strImageURL, largeCoverArt, (int)Thumbs.ThumbLargeResolution,
                                                     (int)Thumbs.ThumbLargeResolution, 0, Thumbs.SpeedThumbsSmall))
                {
                    Util.Picture.CreateThumbnail(strImageURL, coverArt, (int)Thumbs.ThumbResolution,
                                                 (int)Thumbs.ThumbResolution, 0, Thumbs.SpeedThumbsLarge);
                }
                VideoDatabase.SetMovieInfoById(movieDetails.ID, ref movieDetails);
                VideoDatabase.SetThumbURL(movieDetails.ID, strImageURL);
            }
            else
            {
                if (movieDetails.ThumbURL == string.Empty)
                {
                    line1 = GUILocalizeStrings.Get(928) + ":IMP Awards";
                    OnProgress(line1, movieDetails.Title, string.Empty, -1);
                    IMPawardsSearch impSearch = new IMPawardsSearch();
                    impSearch.Search(movieDetails.Title);
                    if ((impSearch.Count > 0) && (impSearch[0] != string.Empty))
                    {
                        movieDetails.ThumbURL = impSearch[0];
                    }
                    else
                    {
                        line1 = GUILocalizeStrings.Get(928) + ":Amazon";
                        OnProgress(line1, movieDetails.Title, string.Empty, -1);
                        AmazonImageSearch search = new AmazonImageSearch();
                        search.Search(movieDetails.Title);
                        if (search.Count > 0)
                        {
                            movieDetails.ThumbURL = search[0];
                        }
                    }
                }

                string largeCoverArt = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, movieDetails.Title);
                string coverArt = Util.Utils.GetCoverArtName(Thumbs.MovieTitle, movieDetails.Title);
                Util.Utils.FileDelete(largeCoverArt);
                Util.Utils.FileDelete(coverArt);
                line1 = GUILocalizeStrings.Get(1009);
                OnProgress(line1, movieDetails.Title, string.Empty, -1);
                //Only get actors if we really want to.
                if (getActors)
                {
                    _fetchActorsInMovie();
                }
                OnDisableCancel(this);
                DownloadCoverArt(Thumbs.MovieTitle, movieDetails.ThumbURL, movieDetails.Title);
                VideoDatabase.SetMovieInfoById(movieDetails.ID, ref movieDetails);
            }
        }
        else
        {
            movieDetails = null;
        }
    }
    catch (ThreadAbortException)
    {
    }
    finally
    {
        OnDetailsEnd(this);
        disableCancel = false;
        //Log.Info("Ending Thread for Fetching movie details:{0}", detailsThread.ManagedThreadId);
        detailsThread = null;
    }
}

Yet another sugestion. In IMDB.Find(string strMovie) you should leave the strMovie as it.

Also remove the UrlEncode of because you can't know if the Grabber use it in URL Format or not.

Its ugly to convert it back to original string in Grabber.
 

Users who are viewing this thread

Top Bottom