diff options
author | Arne Morten Kvarving <cptspiff@gmail.com> | 2016-06-15 23:11:02 +0200 |
---|---|---|
committer | notspiff <cptspiff@gmail.com> | 2017-01-06 12:21:34 +0100 |
commit | 415e128be218e2f54dcae0634d0fcbc55c9709e3 (patch) | |
tree | 532624d68469cb682a7733f0425f86d64d540b7a /addons/metadata.demo.tv | |
parent | 2764c1c78b9fe9f666d2c8ebbbfc2f134c3b0952 (diff) |
add example dummy scrapers
for debugging / documentation purposes only.
REMOVE THIS COMMIT
Diffstat (limited to 'addons/metadata.demo.tv')
-rw-r--r-- | addons/metadata.demo.tv/addon.xml | 17 | ||||
-rw-r--r-- | addons/metadata.demo.tv/demo.py | 202 |
2 files changed, 219 insertions, 0 deletions
diff --git a/addons/metadata.demo.tv/addon.xml b/addons/metadata.demo.tv/addon.xml new file mode 100644 index 0000000000..cebeb6be04 --- /dev/null +++ b/addons/metadata.demo.tv/addon.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<addon id="metadata.demo.tv" + name="Demo TV python scraper" + version="1.0.0" + provider-name="spiff"> + <requires> + <import addon="xbmc.metadata" version="2.1.0"/> + </requires> + <extension point="xbmc.metadata.scraper.tvshows" + library="demo.py"/> + <extension point="xbmc.addon.metadata"> + <summary lang="en">Demo TV shows python scraper</summary> + <description lang="en">Demo TV shows python scraper.</description> + <platform>all</platform> + <license>GPL v2.0</license> + </extension> +</addon> diff --git a/addons/metadata.demo.tv/demo.py b/addons/metadata.demo.tv/demo.py new file mode 100644 index 0000000000..0fd298198a --- /dev/null +++ b/addons/metadata.demo.tv/demo.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +import xbmcplugin,xbmcgui,xbmc,xbmcaddon +import os,sys,urllib + +def get_params(): + param=[] + paramstring=sys.argv[2] + if len(paramstring)>=2: + params=sys.argv[2] + cleanedparams=params.replace('?','') + if (params[len(params)-1]=='/'): + params=params[0:len(params)-2] + pairsofparams=cleanedparams.split('&') + param={} + for i in range(len(pairsofparams)): + splitparams={} + splitparams=pairsofparams[i].split('=') + if (len(splitparams))==2: + param[splitparams[0]]=splitparams[1] + + return param + + +params=get_params() + +action=urllib.unquote_plus(params["action"]) + +if action == 'find': + year = 0 + title=urllib.unquote_plus(params["title"]) + try: + year=int(urllib.unquote_plus(params["year"])) + except: + pass + + print 'Find TV show with title %s from year %i' %(title, int(year)) + liz=xbmcgui.ListItem('Demo show 1', thumbnailImage='DefaultVideo.png', offscreen=True) + liz.setProperty('relevance', '0.5') + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/show", listitem=liz, isFolder=True) + liz=xbmcgui.ListItem('Demo show 2', thumbnailImage='DefaultVideo.png', offscreen=True) + liz.setProperty('relevance', '0.3') + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/show2", listitem=liz, isFolder=True) +elif action == 'getdetails': + url=urllib.unquote_plus(params["url"]) + if url == '/path/to/show': + liz=xbmcgui.ListItem('Demo show 1', offscreen=True) + liz.setProperty('video.original_title', 'Demo shåvv 1') + liz.setProperty('video.sort_title', '2') + liz.setProperty('video.ratings', '1') + liz.setProperty('video.rating1.value', '5') + liz.setProperty('video.rating1.votes', '100') + liz.setProperty('video.user_rating', '5') + liz.setProperty('video.unique_id', '123') + liz.setProperty('video.plot_outline', 'Outline yo') + liz.setProperty('video.plot', 'Plot yo') + liz.setProperty('video.tag_line', 'Tag yo') + liz.setProperty('video.duration_minutes', '110') + liz.setProperty('video.mpaa', 'T') + liz.setProperty('video.premiere_year', '2007') + liz.setProperty('video.status', 'Cancelled') + liz.setProperty('video.first_aired', '2007-01-01') + liz.setProperty('video.trailer', '/home/akva/Videos/porn/bukkake.mkv') + liz.setProperty('video.thumbs', '2') + liz.setProperty('video.thumb1.url', 'DefaultBackFanart.png') + liz.setProperty('video.thumb1.aspect', '1.78') + liz.setProperty('video.thumb2.url', '/home/akva/Pictures/hawaii-shirt.png') + liz.setProperty('video.thumb2.aspect', '2.35') + liz.setProperty('video.genre','Action / Comedy') + liz.setProperty('video.country', 'Norway / Sweden / China') + liz.setProperty('video.writing_credits', 'None / Want / To Admit It') + liz.setProperty('video.director', 'spiff / spiff2') + liz.setProperty('video.seasons', '2') + liz.setProperty('video.season1.name', 'Horrible') + liz.setProperty('video.season2.name', 'Crap') + liz.setProperty('video.actors', '2') + liz.setProperty('video.actor1.name', 'spiff') + liz.setProperty('video.actor1.role', 'himself') + liz.setProperty('video.actor1.sort_order', '2') + liz.setProperty('video.actor1.thumb', '/home/akva/Pictures/fish.jpg') + liz.setProperty('video.actor1.thumb_aspect', '1.33') + liz.setProperty('video.actor2.name', 'monkey') + liz.setProperty('video.actor2.role', 'orange') + liz.setProperty('video.actor2.sort_order', '1') + liz.setProperty('video.actor1.thumb_aspect', '1.78') + liz.setProperty('video.actor2.thumb', '/home/akva/Pictures/coffee.jpg') + liz.setProperty('video.tag', 'Porn / Umomz') + liz.setProperty('video.studio', 'Studio1 / Studio2') + liz.setProperty('video.episode_guide_url', '/path/to/show/guide') + liz.setProperty('video.fanarts', '2') + liz.setProperty('video.fanart1.url', 'DefaultBackFanart.png') + liz.setProperty('video.fanart1.preview', 'DefaultBackFanart.png') + liz.setProperty('video.fanart1.dim', '720') + liz.setProperty('video.fanart2.url', '/home/akva/Pictures/hawaii-shirt.png') + liz.setProperty('video.fanart2.preview', '/home/akva/Pictures/hawaii-shirt.png') + liz.setProperty('video.fanart2.dim', '1080') + liz.setProperty('video.date_added', '2016-01-01') + xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz) +elif action == 'getepisodelist': + url=urllib.unquote_plus(params["url"]) + print 'in here yo ' + url + if url == '/path/to/show/guide': + liz=xbmcgui.ListItem('Demo Episode 1x1', offscreen=True) + liz.setProperty('video.episode', '1') + liz.setProperty('video.season', '1') + liz.setProperty('video.aired', '2015-01-01') + liz.setProperty('video.id', '1') + liz.setProperty('video.url', '/path/to/episode1') + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/episode1", listitem=liz, isFolder=False) + liz=xbmcgui.ListItem('Demo Episode 2x2', offscreen=True) + liz.setProperty('video.episode', '2') + #liz.setProperty('video.sub_episode', '1') + liz.setProperty('video.season', '2') + liz.setProperty('video.aired', '2014-01-01') + liz.setProperty('video.id', '2') + liz.setProperty('video.url', '/path/to/episode2') + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/episode2", listitem=liz, isFolder=False) +elif action == 'getepisodedetails': + url=urllib.unquote_plus(params["url"]) + if url == '/path/to/episode1': + liz=xbmcgui.ListItem('Demo Episode 1', offscreen=True) + liz.setProperty('video.original_title', 'Demo æpisod 1x1') + liz.setProperty('video.sort_title', '2') + liz.setProperty('video.episode', '1') + liz.setProperty('video.season', '1') + liz.setProperty('video.ratings', '1') + liz.setProperty('video.rating1.value', '5') + liz.setProperty('video.rating1.votes', '100') + liz.setProperty('video.user_rating', '5') + liz.setProperty('video.unique_id', '123') + liz.setProperty('video.plot_outline', 'Outline yo') + liz.setProperty('video.plot', 'Plot yo') + liz.setProperty('video.tag_line', 'Tag yo') + liz.setProperty('video.duration_minutes', '110') + liz.setProperty('video.mpaa', 'T') + liz.setProperty('video.first_aired', '2007-01-01') + liz.setProperty('video.thumbs', '2') + liz.setProperty('video.thumb1.url', 'DefaultBackFanart.png') + liz.setProperty('video.thumb1.aspect', '1.78') + liz.setProperty('video.thumb2.url', '/home/akva/Pictures/hawaii-shirt.png') + liz.setProperty('video.thumb2.aspect', '2.35') + liz.setProperty('video.genre','Action / Comedy') + liz.setProperty('video.country', 'Norway / Sweden / China') + liz.setProperty('video.writing_credits', 'None / Want / To Admit It') + liz.setProperty('video.director', 'spiff / spiff2') + liz.setProperty('video.actors', '2') + liz.setProperty('video.actor1.name', 'spiff') + liz.setProperty('video.actor1.role', 'himself') + liz.setProperty('video.actor1.sort_order', '2') + liz.setProperty('video.actor1.thumb', '/home/akva/Pictures/fish.jpg') + liz.setProperty('video.actor1.thumb_aspect', 'poster') + liz.setProperty('video.actor2.name', 'monkey') + liz.setProperty('video.actor2.role', 'orange') + liz.setProperty('video.actor2.sort_order', '1') + liz.setProperty('video.actor1.thumb_aspect', '1.78') + liz.setProperty('video.actor2.thumb', '/home/akva/Pictures/coffee.jpg') + liz.setProperty('video.date_added', '2016-01-01') + xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz) + elif url == '/path/to/episode2': + liz=xbmcgui.ListItem('Demo Episode 2', offscreen=True) + liz.setProperty('video.original_title', 'Demo æpisod 2x2') + liz.setProperty('video.sort_title', '1') + liz.setProperty('video.episode', '2') + liz.setProperty('video.season', '2') + liz.setProperty('video.ratings', '1') + liz.setProperty('video.rating1.value', '5') + liz.setProperty('video.rating1.votes', '100') + liz.setProperty('video.user_rating', '5') + liz.setProperty('video.unique_id', '123') + liz.setProperty('video.plot_outline', 'Outline yo') + liz.setProperty('video.plot', 'Plot yo') + liz.setProperty('video.tag_line', 'Tag yo') + liz.setProperty('video.duration_minutes', '110') + liz.setProperty('video.mpaa', 'T') + liz.setProperty('video.first_aired', '2007-01-01') + liz.setProperty('video.thumbs', '2') + liz.setProperty('video.thumb1.url', 'DefaultBackFanart.png') + liz.setProperty('video.thumb1.aspect', '1.78') + liz.setProperty('video.thumb2.url', '/home/akva/Pictures/hawaii-shirt.png') + liz.setProperty('video.thumb2.aspect', '2.35') + liz.setProperty('video.genre','Action / Comedy') + liz.setProperty('video.country', 'Norway / Sweden / China') + liz.setProperty('video.writing_credits', 'None / Want / To Admit It') + liz.setProperty('video.director', 'spiff / spiff2') + liz.setProperty('video.actors', '2') + liz.setProperty('video.actor1.name', 'spiff') + liz.setProperty('video.actor1.role', 'himself') + liz.setProperty('video.actor1.sort_order', '2') + liz.setProperty('video.actor1.thumb', '/home/akva/Pictures/fish.jpg') + liz.setProperty('video.actor1.thumb_aspect', 'poster') + liz.setProperty('video.actor2.name', 'monkey') + liz.setProperty('video.actor2.role', 'orange') + liz.setProperty('video.actor2.sort_order', '1') + liz.setProperty('video.actor1.thumb_aspect', '1.78') + liz.setProperty('video.actor2.thumb', '/home/akva/Pictures/coffee.jpg') + liz.setProperty('video.date_added', '2016-01-01') + xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz) + + + +xbmcplugin.endOfDirectory(int(sys.argv[1])) |