2013-09-21, 15:48
What is the goal of the method "setResolvedUrl" ?
Wha'ts a way to utilize when developing audio or video plugin ?
Wha'ts a way to utilize when developing audio or video plugin ?
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name , "Plot" : detail } )
liz.setProperty('IsPlayable', 'true')
liz.addContextMenuItems([('Add to My Favorite','xbmc.RunPlugin(%s?mode=12&name=%s&url=%s&iconimage=%s)'%(sys.argv[0],name,url,iconimage))])
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz)
(2013-10-04, 11:14)realtebo Wrote: Do you have an example to a classic listitem and enddirectory ?
for mp4 in json["files"][language_code]["MP4"]:
url = mp4["file"]["url"]
res = mp4["label"]
mp4_title_cleaned = jw_common.cleanUpText (mp4["title"])
title = "[" + res + "] - " + mp4_title_cleaned
listItem = xbmcgui.ListItem(
label = title,
thumbnailImage = thumb
)
listItem.setInfo(
type = 'Video',
infoLabels = {'Title': mp4_title_cleaned}
)
xbmcplugin.addDirectoryItem(
handle = jw_config.pluginPid,
url = url,
listitem = listItem,
isFolder = False
)
xbmcplugin.endOfDirectory(handle=jw_config.pluginPid)
for mp4 in json["files"][language_code]["MP4"]:
url = mp4["file"]["url"]
res = mp4["label"]
mp4_title_cleaned = jw_common.cleanUpText (mp4["title"])
title = "[" + res + "] - " + mp4_title_cleaned
listItem = xbmcgui.ListItem(
label = title,
thumbnailImage = thumb
)
listItem.setInfo(
type = 'Video',
infoLabels = {'Title': mp4_title_cleaned}
)
listItem.setProperty("IsPlayable","true")
"""
xbmcplugin.addDirectoryItem(
handle = jw_config.pluginPid,
url = url,
listitem = listItem,
isFolder = False
)
"""
xbmcplugin.setResolvedUrl( handle=jw_config.pluginPid, succeeded=True, listitem=listItem)
xbmcplugin.endOfDirectory(handle=jw_config.pluginPid)
Quote:NOTICE: ['plugin://plugin.video.jworg/', '29', '?content_type=video&json_url=%2fapps%2fTRGCHlZRQVNYVrXF%3fdocid%3d502013390%26output%3djson%26fileformat%3dmp4%26alllangs%3d1%26track%3d1%26langwritten%3dI%26txtCMSLang%3dI&mode=open_json_video&thumb=http%3a%2f%2fassets.jw.org%2fassets%2fm%2fijw14nw%2f502013390%2fijw14nw_id-502013390.art%2f502013390_univ_sqr_md.jpg']
WARNING: Attempt to use invalid handle 29
WARNING: Previous line repeats 3 times.
NOTICE: Thread Background Loader start, auto delete: false
(2013-10-07, 16:41)learningit Wrote: Try casting the jw_config.pluginPid to int, ie int(jw_config.pluginPid) wherever you're using it. It looks like a str to me. I'm assuming that jw_config.pluginPid is a global storing sys.argv[1] from the initial addon call.
(2013-12-09, 23:15)o2ri Wrote: i have read all the posts in this thread few times
i think that i am missing something:
1- most of the popular addons i see dont use it
2- it seems like something very important , but i cant understand it yet !
right now i am using folder=false but the addon DONOT scrap each url , so what is the diference?
i really need a simple explanation.
(2013-12-10, 00:31)learningit Wrote:(2013-12-09, 23:15)o2ri Wrote: i have read all the posts in this thread few times
i think that i am missing something:
1- most of the popular addons i see dont use it
2- it seems like something very important , but i cant understand it yet !
right now i am using folder=false but the addon DONOT scrap each url , so what is the diference?
i really need a simple explanation.
I think what hasn't been specifically said in this thread is that there is a difference between an addon script and an addon plugin. I may get this wrong (and someone correct me if I am), but a plugin is really just an lightweight event processor that handles directory items and doesn't have to concern itself with window processing etc. It is called (loaded) each time a user-defined event occurs to handle reasonable high level activities. There is a single thread which represents the plugin. The final call to xbmcplugin.endOfDirectory is something akin to DefaultWinProc in that it handles all the nitty-gritty common processing details. setResolvedUrl simply sets up that processing for playing a directory item that isn't directly marked as playable when added to the directory.
There are a few reasons for doing it this way, but the most common I've seen is either when you have an index page that you've scrapped which contains urls or video ids to the pages which have the actual playable urls. Another reason is when a token has to be created to play the url. Rather than read each individual pointed to page to resolve the url as you build the index directory, you can put enough info from the index page into the url stored in the index directory item (as playable=false and folder=false) to allow a routine resolve the actual playable url and create a playable directory item for it. It allows you to postpone some the work until the user clicks on the link.
An addon script loads and remains resident, can manage multiple threads and a richer set of events such as input, timers, window components, etc. I think many of the addons that you see directly calling the player, rather than setresolvedUrl are addon scripts, not plugins.