XBMC Community Forum  

Go Back   XBMC Community Forum > Development > Scraper Development

Scraper Development Developers forum for meta data scrapers. Scraper developers only!
Not for posting feature requests, bugs, or end-user support requests!

Reply
 
Thread Tools Search this Thread Display Modes
Old 2009-04-09, 22:54   #1
ababak
Junior Member
 
ababak's Avatar
 
Join Date: Apr 2009
Location: Kiev, Ukraine
Posts: 8
ababak is on a distinguished road
Send a message via Skype™ to ababak
Unhappy Scraper functions question

Hello!

I am trying to merge locally acquired movie thumb with function-returned data. It looks like I can't send just a plain text trough $$ buffers? Sending <thumbs><thumb>url</thumb></thumbs> works only when enclosed in <details></details> tags. Is there any way I can merge this returned data with local <thumb>url</thumb> tags? I am also wondering how is it merged with the documented <GetDetails> data already available in the <details></details> format when I am collecting it in some buffer using "4+"?

Thank you!
ababak is offline   Reply With Quote
Old 2009-04-09, 23:17   #2
spiff
Grumpy Bastard Developer
 
spiff's Avatar
 
Join Date: Nov 2003
Posts: 7,715
spiff is on a distinguished road
Default

have a look at how the allmusic scraper passes the thumb tags (i chose this one for clarity). the trick is the usage of the clearbuffers parameter on the functions. (if i understand your question correctly).

after every function we call the load() on the returned xml. this is an additive procedure, i.e. we keep what has been added before. but that does not mean that we can load several <thumbs> tags, hence the trick with clearbuffers
__________________
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Last edited by spiff; 2009-04-09 at 23:19.
spiff is offline   Reply With Quote
Old 2009-04-09, 23:57   #3
ababak
Junior Member
 
ababak's Avatar
 
Join Date: Apr 2009
Location: Kiev, Ukraine
Posts: 8
ababak is on a distinguished road
Send a message via Skype™ to ababak
Default

Hello spiff! Thank you for your reply.

Are you talking about bundled /Applications/Plex.app/Contents/Resources/Plex/system/scrapers/music/allmusic.xml ? I can't see any clearbuffers there...

Could you correct me whether arbitrary text can't be passed as a returned value from function?

How is <details></details> format retuned by custom function being merged with GetDetails <details></details>?
ababak is offline   Reply With Quote
Old 2009-04-10, 00:01   #4
spiff
Grumpy Bastard Developer
 
spiff's Avatar
 
Join Date: Nov 2003
Posts: 7,715
spiff is on a distinguished road
Default

plex? this is xbmc.. they apparently haven't updated the scrapers then.

http://xbmc.org/trac/browser/branche...c/allmusic.xml

Code:
<RegExp input="$$1" output="&lt;thumb&gt;http://image.allmusic.com/00/amg/pic200/dr\1\200/\1\2\3\4/\1\2\3\4\5.jpg&lt;/thumb&gt;" dest="7+">
                     <expression noclean="1" repeat="yes">&quot;([A-Z^])([0-9^])([0-9^])([0-9^])([^&quot;]*)&quot;</expression>
</RegExp>
this builds a list of the allmusic available artist thumbs in buffer 7. we want to add htbackdrop thumbs, and that requires another scrape, the GetThumbs function. now, we flag
GetArtistDetails with clearbuffers="no". this means that when that function is finished we do NOT clear the contents of the buffers. we then enter GetThumbs
Code:
<RegExp input="$$13" output="&lt;details&gt;&lt;thumbs&gt;\1$$7&lt;/thumbs&gt;&lt;/details&gt;"
note the usage of $$7 here - this is the list that was built prior in GetDetails. since we do not clear the buffers after the GetDetails function has run, this is still available.

hope that explains it.

no you cannot pass arbitrary data as the result of a function. once you see the allmusic code you'll get the point. as i already explained; after every function we call load() on the returned string (xml). this is an additive procedure, i.e. any new tags present will get loaded. if you return a tag that has been returned earlier, it's overridden. hence the need to do the clearbuffers trick
__________________
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Last edited by spiff; 2009-04-10 at 00:06.
spiff is offline   Reply With Quote
Old 2009-04-10, 00:06   #5
ababak
Junior Member
 
ababak's Avatar
 
Join Date: Apr 2009
Location: Kiev, Ukraine
Posts: 8
ababak is on a distinguished road
Send a message via Skype™ to ababak
Default

Ah, ok, sorry, I didn't realize the scrappers code-base isn't common between these projects. I'll have a look. Thank you very much!
ababak is offline   Reply With Quote
Old 2009-04-10, 09:03   #6
ababak
Junior Member
 
ababak's Avatar
 
Join Date: Apr 2009
Location: Kiev, Ukraine
Posts: 8
ababak is on a distinguished road
Send a message via Skype™ to ababak
Default

Thanks, spiff! That explained everything I asked!
ababak is offline   Reply With Quote
Old 2009-04-10, 09:36   #7
ababak
Junior Member
 
ababak's Avatar
 
Join Date: Apr 2009
Location: Kiev, Ukraine
Posts: 8
ababak is on a distinguished road
Send a message via Skype™ to ababak
Default

Two more questions.

1. What is an optimal way of replacing strings in the buffer? For example, I need to replace &nbsp; with spaces.
2. How to use "cache" parameter in the url tag (I've seen it in several scrapers but can't understand what it does and how it works)?

Last edited by ababak; 2009-04-10 at 09:49.
ababak is offline   Reply With Quote
Old 2009-04-12, 21:47   #8
spiff
Grumpy Bastard Developer
 
spiff's Avatar
 
Join Date: Nov 2003
Posts: 7,715
spiff is on a distinguished road
Default

1) optimality can be discussed but this works
Code:
<RegExp input="$$2" output="\1&amp;amp;\2" dest="3">
  expression noclean="1,2" repeat="yes">(.*?)&amp;(.+)</expression>
</RegExp>
2) cache is just a local file name. that way you can run several function on the same page without redownloading it.
__________________
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
spiff is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:03.


Protected by Akismet, We recommend WordPress blogs
Copyright © 2008, XBMC Project