2008-09-01, 15:00
I'm studying IMDB scraper for the 3rd chapter of "scraper for dummies", and I would like to know if some of my first conclusions regarding settings are right. I will later try them for real (right now I have no access to a XBMC installation), but if spiff or somebody could shed some light here it would be greatly appreciated.
The settings for a scraper have 2 parts, first, they need to be specified to XBMC so the user can modify them (and defaults can be set), second they need to be used in the actual scraper code.
For the first part, there is a new regexp, "getsettings" that need to generate a XML structure like this:
<settings>
<setting label=NAME type=TYPE id=ID default=DEFAULT></setting>
</settings>
where (all are quoted strings):
NAME = Name of setting, like "enable full cast credit"
TYPE = Type of setting one of ("bool"|"labelenum"|"sep"|"text")
ID = Identifier of setting (just any string? must a word?)
DEFAULT = Default value
Type bool can be "true" or "false"
Type labelenum is a list of strings separated by "|" symbol
Type sep is just a cosmetic function, simply displays a line to tidy up things
Type text allows entering an arbitrary string
- There can be as many <setting> as needed
- are there any other "type"s?
- ID is just a string to identify a setting latter in the code.
For the second part, using the settings in the code, you simply use $INFO[ID], for example, if one ID is "fanart", you can obtain the user-selected option by using $INFO[fanart] (do not use quotes in ID, just the name). $INFO[ID] returns a string with the corresponding value established for the source being scraped.
Are there any "built in" infos? for example, it would be really useful for some applications to have $INFO(source) to get the source where the movie file is, $INFO(filename), $INFO(path) etc
The settings for a scraper have 2 parts, first, they need to be specified to XBMC so the user can modify them (and defaults can be set), second they need to be used in the actual scraper code.
For the first part, there is a new regexp, "getsettings" that need to generate a XML structure like this:
<settings>
<setting label=NAME type=TYPE id=ID default=DEFAULT></setting>
</settings>
where (all are quoted strings):
NAME = Name of setting, like "enable full cast credit"
TYPE = Type of setting one of ("bool"|"labelenum"|"sep"|"text")
ID = Identifier of setting (just any string? must a word?)
DEFAULT = Default value
Type bool can be "true" or "false"
Type labelenum is a list of strings separated by "|" symbol
Type sep is just a cosmetic function, simply displays a line to tidy up things
Type text allows entering an arbitrary string
- There can be as many <setting> as needed
- are there any other "type"s?
- ID is just a string to identify a setting latter in the code.
For the second part, using the settings in the code, you simply use $INFO[ID], for example, if one ID is "fanart", you can obtain the user-selected option by using $INFO[fanart] (do not use quotes in ID, just the name). $INFO[ID] returns a string with the corresponding value established for the source being scraped.
Are there any "built in" infos? for example, it would be really useful for some applications to have $INFO(source) to get the source where the movie file is, $INFO(filename), $INFO(path) etc