Kodi Community Forum
Install from zip (downloaded from Github) gets wrong folder name - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Install from zip (downloaded from Github) gets wrong folder name (/showthread.php?tid=215138)

Pages: 1 2


Install from zip (downloaded from Github) gets wrong folder name - el_Paraguayo - 2015-01-15

I'm running into a problem that I hope someone can help with. When people download my addon from Github, the branch is appended to the zip and folder name. This means that the service installs itself in a folder called service.bbclivefootballscores-master rather than service.bbclivefootballscores

This is important because the addon calls some extra scripts and so needs the correct folder name.

Is it possible to force github to stop adding the branch name?

Would this issue be resolved if I submitted the addon to the repo?


RE: Install from zip (downloaded from Github) gets wrong folder name - pkscout - 2015-01-16

I don't think there is any way to force github to change the naming convention of the zip. You could look into using the releases feature of github. I think with that you can download a zip of the branch, unzip it, rename the folder, rezip it, and then upload it to the specific release. But it would probably be easier to submit to the repo. Then you just send an email with some info when it needs to be updated and folks don't have to download and install a new one.


RE: Install from zip (downloaded from Github) gets wrong folder name - enen92 - 2015-01-16

That's the way it is intended to be I guess, downloading he zip master just zips the copy of your source. Github support releases and download links, probably a good idea to do something similar and point users to the releases tab. See xtorrent for example:

https://github.com/steeve/xbmctorrent/releases


RE: Install from zip (downloaded from Github) gets wrong folder name - el_Paraguayo - 2015-01-16

Thanks both. Looks like I've got some reading to do over the weekend.

Definitely need to do it as it's causing the same error for everyone who downloads it. A readme is probably a short-term fix...!


RE: Install from zip (downloaded from Github) gets wrong folder name - pkscout - 2015-01-18

The other thing you could look at is not to hardcode any name or path that relates to your addon.

At the begging of all my addons I have the following:
Code:
__addon__        = xbmcaddon.Addon()
__addonname__    = __addon__.getAddonInfo('id')
__addonversion__ = __addon__.getAddonInfo('version')
__addonpath__    = __addon__.getAddonInfo('path').decode('utf-8')
__addonicon__    = xbmc.translatePath('%s/icon.png' % __addonpath__ )

xbmcaddon.Addon().getAddonInfo('path') might be of particular interest to you.


RE: Install from zip (downloaded from Github) gets wrong folder name - el_Paraguayo - 2015-01-18

Thanks. The main problem is that there is an action setting in my settings.xml which triggers a script. It therefore needs the correct folder name.


RE: Install from zip (downloaded from Github) gets wrong folder name - Karnagious - 2015-01-18

Just make it relative to the current working directory.

Code:
action="RunScript($CWD/resources/lib/your_script.py, your_arguments)"



RE: Install from zip (downloaded from Github) gets wrong folder name - el_Paraguayo - 2015-01-18

That should work! Thanks.

However, there is still the issue of some scripts can be called directly from a keymap (if a user wants to edit this themselves). In that case the relative pagth won't work.

I've gone down the releases rod for now and will try to get the service into the official repo.

However, the help is much appreciated - always good to learn new things.


RE: Install from zip (downloaded from Github) gets wrong folder name - takoi - 2015-01-18

(2015-01-18, 11:45)Karnagious Wrote: Just make it relative to the current working directory.

Code:
action="RunScript($CWD/resources/lib/your_script.py, your_arguments)"
Don't. This is deprecated. (notice the warnings in the log?). It also means xbmcaddon.Addon() without passing id will not work.

Use "RunScript(your.addon.id, args)" and handle that argument in your main script instead. Use this in keymaps too, that way path names doesn't matter.


RE: Install from zip (downloaded from Github) gets wrong folder name - el_Paraguayo - 2015-01-18

But the problem is the script is a service so how do you pass args to a running service? Is it better to have a service and a separate "helper" add-on to handle these separate scripts (I think this is what xsqueeze did).


RE: Install from zip (downloaded from Github) gets wrong folder name - takoi - 2015-01-18

(2015-01-18, 12:41)el_Paraguayo Wrote: But the problem is the script is a service so how do you pass args to a running service? Is it better to have a service and a separate "helper" add-on to handle these separate scripts (I think this is what xsqueeze did).
I'm not sure what you mean, but you can add xbmc.python.library extension point to addon.xml to run a script separate from the service. You can't communicate directly with a service as it runs in a separate python process. If you really want to go down that path you need to go through a socket or other io.


RE: Install from zip (downloaded from Github) gets wrong folder name - el_Paraguayo - 2015-01-18

(2015-01-18, 14:00)takoi Wrote:
(2015-01-18, 12:41)el_Paraguayo Wrote: But the problem is the script is a service so how do you pass args to a running service? Is it better to have a service and a separate "helper" add-on to handle these separate scripts (I think this is what xsqueeze did).
I'm not sure what you mean, but you can add xbmc.python.library extension point to addon.xml to run a script separate from the service. You can't communicate directly with a service as it runs in a separate python process. If you really want to go down that path you need to go through a socket or other io.
Takoi, thanks.

I'll try to describe the main problem here:
- The service provides notification of live football scores.
- The leagues that are available is pulled from the BBC site and is not static
- Therefore, when selecting the leagues to follow, I need to make a request to the website. Hence the need to run a separate script from my addon settings page.
- The service checks the settings periodically and updates for any changes identified.
- There are also separate scripts bundled with the service that display league tables, detailed match info etc which are currently being called via RunScript.

The extension point is a good point (and one I'm already planning to use, albeit for a slightly different reason) but it does lead me to a question, where you've got multiple extension points with different scripts, which one is called when you run "RunScript(your.addon.id, args)"? If it runs the "xbmc.python.library" extension, rather than the service, then this could be made to solve everything as I can create a single script to do whatever I want based on the arguments passed to it. If it runs the service, then I don't think it quite does what I want.

I'm away from my machine for a few hours now, but I'm happy to test the extension point idea above later today.

Thanks again.


RE: Install from zip (downloaded from Github) gets wrong folder name - takoi - 2015-01-18

(2015-01-18, 14:10)el_Paraguayo Wrote: The extension point is a good point (and one I'm already planning to use, albeit for a slightly different reason) but it does lead me to a question, where you've got multiple extension points with different scripts, which one is called when you run "RunScript(your.addon.id, args)"? If it runs the "xbmc.python.library" extension, rather than the service, then this could be made to solve everything as I can create a single script to do whatever I want based on the arguments passed to it. If it runs the service, then I don't think it quite does what I want.
It will run 'xbmc.python.library'. RunScript runs the script (or "library") extension point. Only as a fallback if none of those exist will it run the service and print a warning (because that's an old behavior that's is now deprecated too).


RE: Install from zip (downloaded from Github) gets wrong folder name - el_Paraguayo - 2015-01-18

Fantastic. Then I know what I need to do.

Thank you so much for your help.

EDIT: Yes - tested, this should work just fine.


RE: Install from zip (downloaded from Github) gets wrong folder name - Karnagious - 2015-01-19

(2015-01-18, 12:36)takoi Wrote:
(2015-01-18, 11:45)Karnagious Wrote: Just make it relative to the current working directory.

Code:
action="RunScript($CWD/resources/lib/your_script.py, your_arguments)"
Don't. This is deprecated. (notice the warnings in the log?). It also means xbmcaddon.Addon() without passing id will not work.

Use "RunScript(your.addon.id, args)" and handle that argument in your main script instead. Use this in keymaps too, that way path names doesn't matter.

FYI, I took that from the wiki: http://kodi.wiki/view/Add-on_settings