Run plugin on playback fail
#1
Hey Guys

Looking for a little bit of assistance with a plugin I'm writing please.

In a nut shell:

I have a plugin which resolves a URL and then begins playback of the resolved link.

When the video file is there, this works fine, and everything is good in the world.

However, on occasions when the resolver is unsuccessful (video no longer available etc), I want to be able to run another script/plugin.

I've tried initiating this through an exception, but the problem I have is that even when the file does not exist, the resolver provides the player with a false, unplayable link, which it tries to unsuccessfully play.

Because the player attempts playback, the plugin believes the function to be successful and the exception is missed entirely.

Is there anyone out there more skilled, experienced and intelligent than me that could offer some advice?

Cheers
My fanart.tv & themoviedb.org accounts.

Image
Reply
#2
I've tried to come up with a hook to catch the playback failed prompt, but never had much success.

It shouldn't be hard to stop a function before the playback of a bad URL, but once playback begins there doesn't seem to be away around the prompt.

Can I see your code to get a better idea of what you are doing?
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#3
Hi Lunatixz

Thanks for the reply.

The script is very simple (I'm no coder - be kind Smile), and relies on a third party resolver.

Code:
url = "http://example.com/?ref=xxxxxxx"

res_url = urlresolver.resolve(url)

li = xbmcgui.ListItem()
li.setInfo(type='Video', infoLabels={ XXXXXXXXX })
li.setProperty('IsPlayable', 'true')

try:
    xbmc.Player().play(item=res_url, listitem=li)
    xbmcplugin.setResolvedUrl(int(sys.argv[ 1 ]),True,li)
except:
    xbmc.executebuiltin("RunPlugin(plugin://plugin.video.myplugin/?action=xxxxxx)")

Grateful for any assistance.
My fanart.tv & themoviedb.org accounts.

Image
Reply
#4
(2014-09-15, 19:57)Samu-rai Wrote: Hi Lunatixz

Thanks for the reply.

The script is very simple (I'm no coder - be kind Smile), and relies on a third party resolver.

Code:
url = "http://example.com/?ref=xxxxxxx"

res_url = urlresolver.resolve(url)

li = xbmcgui.ListItem()
li.setInfo(type='Video', infoLabels={ XXXXXXXXX })
li.setProperty('IsPlayable', 'true')

try:
    xbmc.Player().play(item=res_url, listitem=li)
    xbmcplugin.setResolvedUrl(int(sys.argv[ 1 ]),True,li)
except:
    xbmc.executebuiltin("RunPlugin(plugin://plugin.video.myplugin/?action=xxxxxx)")

Grateful for any assistance.

Didn't forget about you... Been busy.
I'll get back to you soon!
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#5
I am also very interested in this. Detecting a playback failure in my player subclass would be really helpful. Thank you.
Reply
#6
(2014-09-23, 18:00)jerimiah797 Wrote: I am also very interested in this. Detecting a playback failure in my player subclass would be really helpful. Thank you.

Its not possible, but detecting a failed url resolve might be possible. Two completely different things.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#7
Ahh yes, thanks. I see this is a different case than the OP.

-Jerimiah
Reply
#8
Hi Lunatixz

Sorry I haven't replied sooner. I somehow managed to unsubscribe to my own thread…

Any help you could offer would be appreciated.
My fanart.tv & themoviedb.org accounts.

Image
Reply
#9
Take a look here:

http://pythonadventures.wordpress.com/20...rl-exists/
Reply
#10
Check this one also: http://forum.xbmc.org/showthread.php?tid...pid1806212
Reply
#11
(2014-10-03, 01:35)enen92 Wrote: Check this one also: http://forum.xbmc.org/showthread.php?tid...pid1806212

Looks interesting, I currently use a similar technique.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply

Logout Mark Read Team Forum Stats Members Help
Run plugin on playback fail0