How to detect if plugin is started from shortcut?
#1
My plugin starts with this

Code:
plugin_params     = urlparse.parse_qs((sys.argv[2])[1:])
content_type = params["content_type"][0]

if content_type == "video" :
....

if content_type == "audio" :
....

The problem is that shortcut doesn't send this parameters.
How can workaround this ?

I tried to print sys,argv

Code:
22:53:53 T:5628  NOTICE: ['plugin://plugin.video.jworg/', '231', '']

And this (a part the pid, a progressive id), is identical from video shortcut and from music shortcut
Reply
#2
You can't detect. A a workaround I would do it this way:
- Check for "content_type"-param
- If found, show videos or music
- Else, show a choice between video and music linking back to the root entry

Have a look how I do it:
root: https://github.com/dersphere/plugin.vide...don.py#L43
choice: https://github.com/dersphere/plugin.vide...don.py#L68
My GitHub. My Add-ons:
Image
Reply
#3
Thanks for reply.
Even I found only this solution, make user in condition to choose from audio, video and program and then point to the right plugin 'url'.

I read your source, and I found a very interesting way of 'real-life' usage for swift.
Good coding, of course.
Reply

Logout Mark Read Team Forum Stats Members Help
How to detect if plugin is started from shortcut?0