Scraper support of backdrop loading (1 Viewer)

mitiok2008

Portal Pro
February 1, 2009
115
1
hi developers,
I went for long holiday and came back with wish to get something useful for the team. Thank for the great plug in.

The question. If there is any progress in 0.7.3 with backdrop loading from scarper engine? If yes, could you provide me with sintax for the part

<action name="get_backdrop">

</action>

Thank in advance,
Mitiok.
 

mitiok2008

Portal Pro
February 1, 2009
115
1
one more times. :(

Hi developers,
I just don't understand, what's going on. I really would like to help to make the great plug-in even better, by adding in russian-scraper posibility to load backdrops from russian movie's resource. All I need - the sintax for it. As far as I know, such posibility was presented in MP 0.7.3. If it doesn't work so far - just tell me. If it works - just send couple of words about sintax.

If my request or English just too stupid - tell me about it.:sorry:

Thank you all in advance. :D
 

marvenius

Portal Pro
September 3, 2008
523
47
Belgium
Home Country
Netherlands Netherlands
Perhaps you would like to have a look here:
moving-pictures - Google Code
I doubt though if backdrop scrapers are implemented yet. Currently, as far as my recollection goes, only thetvdb provides backdrops and is not available as scraper script, but as C# source code.
 

mitiok2008

Portal Pro
February 1, 2009
115
1
Thank for the link. I found there the following code (file ScriptableProvider.cs)
Code:
        public bool GetBackdrop(DBMovieInfo movie) {
            if (scraper == null)
                return false;


            Dictionary<string, string> paramList = new Dictionary<string, string>();
            Dictionary<string, string> results;


            // if we already have a backdrop move on for now
            if (movie.BackdropFullPath.Trim().Length > 0)
                return true;


            // try to load the id for the movie for this script
            DBSourceMovieInfo idObj = movie.GetSourceMovieInfo(ScriptID);
            if (idObj != null && idObj.Identifier != null)
                paramList["movie.site_id"] = idObj.Identifier;


            // load params for scraper
            foreach (DBField currField in DBField.GetFieldList(typeof(DBMovieInfo)))
                if (currField.GetValue(movie) != null)
                    paramList["movie." + currField.FieldName] = currField.GetValue(movie).ToString().Trim();


            // run the scraper
            results = scraper.Execute("get_backdrop", paramList);
            if (results == null) {
                logger.Error(Name + " scraper script failed to execute \"get_backdrop\" node.");
                return false;
            }


            int count = 0;
            string backdropURL = string.Empty;


            // Loop through all the results until a valid backdrop is found
            // todo: support multiple backdrops
            while (results.ContainsKey("backdrop[" + count + "].url")) {
                backdropURL = results["backdrop[" + count + "].url"]; 
                if (backdropURL.Trim().Length > 0)
                    if (movie.AddBackdropFromURL(backdropURL) == ArtworkLoadStatus.SUCCESS)
                            return true;


                count++;
            }
            
            // no valid backdrop found
            return false;
        }

Does it mean that I can load backdrops from a script?
 

mitiok2008

Portal Pro
February 1, 2009
115
1
I test it finally by myself. I put some code inside get_backdrop action node.
Code:
<action name="get_backdrop">

	<set name="rx_poster_link">
		<![CDATA[
		/images/kadr/sm_(?<posterID>[\d]+)
		]]>
	</set>

        <!-- Action to retrieve backdrop from kinopoisk.ru -->
		<!-- We need to find the link to the posters page from the details page -->
        <if test="${movie.site_id}!=">
				<!-- Try to get backdrop page from movie's shots page -->
                <retrieve name="backdrop_page" url="http://www.kinopoisk.ru/level/13/film/${movie.site_id}" retries="10" timeout="10000" timeout_increment="4000"/>
                <parse name="posterLink" input="${backdrop_page}" regex="${rx_poster_link}"/>
                <!-- If link found, continue -->
                <if test="${posterLink[0][0]}!=">
                        <!-- set name="posterPage" value="${posterLink[0][0]}" /-->
                        <!-- retrieve name="cover_page" url="${posterPage}" allow_unsafe_header="true" /-->
                        <!-- parse name="posterLinks" input="${cover_page}" regex="${rx_covers}"/-->
                        <loop name='cover_url' on='posterLink'>
                                <set name='backdrop[${count}].url' value='http://www.kinopoisk.ru/images/kadr/${cover_url[0]}.jpg'/>
                        </loop>
                </if>
        </if>  
</action>

It's loaded. No errors during loading - it's good! But I can't check if it works or not, because there is no posibility to set up kinopoisk.xml as default backdrop loading engine into configuration page. there are only local media and themoviedb.org. I hope it will be fixed soon.
 

fforde

Community Plugin Dev
June 7, 2007
2,667
1,702
42
Texas
Home Country
United States of America United States of America
Sorry for the lack of response mitiok, don't know how we overlooked this thread so long. :( Yes the code for writing backdrop scrapers is ready to go for 0.8. If you script is not being listed as a backdrop scraper be sure to include "MovieBackdropFetcher" in the <type> node. This is most likely your problem. If you have any further trouble let me know.
 

mitiok2008

Portal Pro
February 1, 2009
115
1
Sorry for the lack of response mitiok, don't know how we overlooked this thread so long. :( Yes the code for writing backdrop scrapers is ready to go for 0.8. If you script is not being listed as a backdrop scraper be sure to include "MovieBackdropFetcher" in the <type> node. This is most likely your problem. If you have any further trouble let me know.

I just tried to create scraper section for backdrop loading (see attachment). The backdrop part is visible from the MovingPicture interface, but nothing is happend... I have MP 0.7.5 - may be this is a problem?
 

Attachments

  • Kinopoisk 1.2.8 (backdrop edition).zip
    30.7 KB

armandp

Retired Team Member
  • Premium Supporter
  • April 6, 2008
    990
    620
    Zoetermeer
    Home Country
    Netherlands Netherlands
    it's will be functional in 0.8 but not in 0.7.5.
     

    mitiok2008

    Portal Pro
    February 1, 2009
    115
    1
    it's will be functional in 0.8 but not in 0.7.5.
    ok. if anyone could send me alpha release of 0.8? I could test backdrop loading in advance and send you complite scraper. And it will integrated into 0.8.

    I know, that I could load sources form the developer's site, but I really don't want to stragle with it. If this part of the code is already implemented - please send new version to me.
     

    Users who are viewing this thread

    Top Bottom