need help. ListItem.FolderPath from skin.estuary to plugin.video.urldownloader
#1
Hello. This is my first post. I don't get an answer in the German Kodi Forum. Maybe it's too difficult.Or they don't understand me.

I'm trying to tell the plugin (plugin.video.urldownloader) what I want to download. But only one step at a time.

First problem: 
Pass on variables from the skin.
My Skin is skin.estuary. I changed it in the DialogVideoInfo.xml:
<?xml version="1.0" encoding="UTF-8"?>
<window>
<settings>
<setting id="url3" value="hellohello" />
</settings>
<defaultcontrol alwa...

Is that correct? url3 is only for test. I know is not ListItem.FolderPath. But, I'm trying to transfer a value first. (hallohallo)


Second problem:
To get the value. I want to use the addon plugin.video.urldownloader. 
I changed default.py from the Addon.

...
import xbmcaddon
...
defaulturl = xbmcaddon.Addon('skin.estuary').getSetting('url3')
...
Is that correct?

But Kodi crashed
Log:
2020-04-23 15:03:32.726 T:11232 NOTICE: Running the application...
2020-04-23 15:03:32.727 T:15116 NOTICE: ES: Starting UDP Event server on port 9777
2020-04-23 15:03:32.727 T:15116 NOTICE: UDP: Listening on port 9777 (ipv6 : false)
2020-04-23 15:03:38.646 T:11232 ERROR: Control 54 in window 10025 has been asked to focus, but it can't

what am i doing wrong? Pleas help.
Reply
#2
my Kodi 18.5
Reply
#3
Thread moved to addon development
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#4
Hi, 
not quite sure i understand what you actually want to achieve. 

But if you want to do that with plugins you can't rely on Listitem infos since those might still point to a plugin path where the plugin still executes some logic and triggers the player by itself.
E.g. for twitch ListItem.FileNameAndPath is something like this 
plugin://plugin.video.twitch/?video_id=v601124150&mode=play

Jsonrpc Player.GetItem (and i guess xbmc.Player will do the same) with file as param tells you what the player is actually playing
http://localhost:8080/jsonrpc?request=%7...%3A%201%7D

but also that might not be direct video file but e.g. an m3u list.

What you could do is write an add on which uses xbmc.Player callbacks to than executeBuiltIn(RunPlugin(urldownloader path))

If you want to do it from the videoinfodialog add a control of type button and do something like this <onclick>RunPlugin(plugin://blablaurldownloader?url=$INFO[ListItem.FileNameAndPath]</onclick> however as mentionend this will most likely not work with plugins
Reply
#5
Thank you so much Takezo36 ! And to DarrenHill for  moved thread.

you:
 If you want to do it from the videoinfodialog add a control of type button and do something like this <onclick>RunPlugin(plugin://blablaurldownloader?url=$INFO[ListItem.FileNameAndPath]</onclick> however as mentionend this will most likely not work with plugins

Yes. That is what I am trying to do.
i try 
<param name="onclick_2" value="RunPlugin(plugin://plugin.video.urldownloader?url3==$INFO[ListItem.FileNameAndPath]"/>
and
<param name="onclick_2" value="ActivateWindow(10025,plugin://plugin.video.urldownloader/?url3=[ListItem.FileNameAndPath])"/>

The Button works, but the plugin crashes or nothing happens (the plugin runs). So, this is the reason why I first try to pass any variable.
I think the mistake is in the Plugin. How do I tell the plugin to take the variable "url3". 
like this?:
import xbmcaddon
...
defaulturl = xbmcaddon.Addon('skin.estuary').getSetting('url3')  -> Kodi crashed
...
also defaulturl = xbmcaddon.Addon().getSetting('url3') don't works. -> no change in the plugin 
also 
__settings__ = xbmcaddon.Addon('skin.estuary')
defaulturl = __settings__.getSetting('url3') -> Kodi crashed
Huh

This is the Plug in i try to rewrite from "mutulaki"  https://forum.kodi.tv/showthread.php?tid...pid1627410

i edit  default.py:
37: defaulturl = ''
defaulturl should be ListItem.FolderPath  or .FileNameAndPath  (url3)

Thank you for the effort.
Reply
#6
(2020-04-24, 23:35)Michael_ger_krauts Wrote: <param name="onclick_2" value="RunPlugin(plugin://plugin.video.urldownloader?url3=$INFO[ListItem.FileNameAndPath]"/>
one "=" too much. but also crashed
Reply
#7
Don't know about that plugin you want to fix but in general passing params with the ? parameter will be in the sys.argv
with this
python:
def parseArgs():
  params = {}
  args = sys.argv[2][1:]
  if args:
    for argPair in args.split("&"):
      temp = argPair.split("=")
      params[temp[0]] = urllib.unquote(temp[1])
  return params
if (__name__ == "__main__"):
  params = parseArgs()
you can do params['parametername'] to get the parameter.
to do http requests look at 
urllib https://docs.python.org/3/howto/urllib2.html
or requests
https://requests.readthedocs.io/en/master/
both are available as scripts in kodi and you can add them as import to your addon.xml
Reply
#8
Oh Holy poopoo. In Germany we say:  It was a difficult birth.  Laugh
I have read "requests" and "sys.argv".  I have noticed that they start Addons with RunScript.
I don't no why, but it's run.
RunPlugin works also, but the result is not the same. 
ActivateWindow don't work.

XML:
<include content="InfoDialogButton">
<param name="icon" value="icons/filemanager.png" />
<param name="label" value="Download" />
<param name="onclick_1" value="Dialog.Close(all,true)" />
<param name="onclick_2" value="RunScript(special://home/addons/plugin.video.urldownloader/default.py, $INFO[ListItem.FileNameAndPath])"/>
</include>

And then i have use "sys.argv" in python:

defaulturl = str(sys.argv)
 (sys.argv[2][1:]) don't works. I don't no why.

after this defaulturl looks like
['default.py', 'davs://server.to/movies/abc.mp4']
Why ['default.py', ' and '] ? I  I don't no.
i replaced it

defaulturl = defaulturl.replace("['default.py', 'davs://","https://")
defaulturl = defaulturl.replace("']", "")

And now it's perfect.

Thanks a lot Takezo36.  Big Grin



new question
Is it possible to start the download in the background? 
The Download now runs in the main screen.
Reply
#9
Found it. xbmcgui.DialogProgressBG() 
now it's realy perfect.
Reply
#10
Hi,
just to wrap this up.

RunScript runs directly a python script with arguments. So a proper path to python script is used and args are the second param. 
RunPlugin runs a plugin with the plugin:// syntax were ? params are args

the resulting argv is different because plugins also get a handle to change things in the UI. argv is a vector/list/array that's why if you treat as a string it looks like that. first arg is the script itself so default.py after that it's what you pass. 
What you did with the string replace works but is not really clean and error prone code. sys.argv[1].replace(... would be cleaner. 

Gut das deine geburt gelungen ist. Der unterschied zwischen Script, Addon und Plugin war mir auch ne weile eine Raetsel.
Reply

Logout Mark Read Team Forum Stats Members Help
need help. ListItem.FolderPath from skin.estuary to plugin.video.urldownloader0