Addon-Install options and background-scripts - Printable Version
+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Python Add-on Development (/forumdisplay.php?fid=26)
+--- Thread: Addon-Install options and background-scripts (/showthread.php?tid=81031)
Pages: 1 2
Addon-Install options and background-scripts - Raptor 2101 - 2010-09-13 18:45
i've created a podcast-addon. It can handle opml.files and organized it in a folder structure. Additional it tracks, which article was "readed"(listened) and which not.
Till now, everything works well. but know i need two things.
How can i tell, the plugin-installer, to prepare a defined folder-structure in the userdata/plugins/<plugin>/-folder. I need some initial (editable) files. Is there any standartized way, to do this? Or do i have do handle it, in my pyhton-script aka "if (firstrun) ..."?
Second: To display the user, which articels are new/unreaded, the script have to gather all xml-files, parse them and check against local stored files. This takes some time. My opml files list around 20 podcast and it takes 20 till 30 seconds to gather all information on the initial screen. I would prefer id, to install a script, who is runned (in background) at the start and rerunned after a well defined time (f.e: 30 minutes) to build a index, so the user-experience speed up.
- chippyash - 2010-09-13 21:24
Quote:i've created a podcast-addon.
Well done you. Be interesting to see what it turns out like. As it happens, I'm doing a similar thing but using Gpodder as the podcatching backend. Not sure it will help but take a look at the documentation I'm producing for Addon devs. You can find the current version at http://trac.xbmc.org/attachment/ticket/10107/. If you do find a neat way of achieving what you want, I'd like to include it in the docs.
- Raptor 2101 - 2010-09-14 22:46
you will find the needed files here... i will check you documentation as son as possible
- chippyash - 2010-09-14 23:48
If you check out the last appendix in the doc, there's a neat little class that you can use to determine what context your addon is running in. Then in your addon.xml file you put
Hope it helps
- chippyash - 2010-09-14 23:51
ha ha - see you found that hashlib isn't supported in Python 2.4 either. XBMC won't be on 2.6 or 2.7 for a long while yet. see http://forum.xbmc.org/showthread.php?tid=81047
- chippyash - 2010-09-15 00:03
Raptor 2101 Wrote:How can i tell, the plugin-installer, to prepare a defined folder-structure in the userdata/plugins/<plugin>/-folder. I need some initial (editable) files. Is there any standartized way, to do this? Or do i have do handle it, in my pyhton-script aka "if (firstrun) ..."?I had a think about it.
Put the template files into resources/data
In your resources/setings.xml, create a hidden setting that is set to False. Create a class that handles the data to be read/managed which always checks the state of that setting. If false, then copy files from resources/data to the user folder (Jonathan wrote a comment on my trac ticket for the docs that points the way to accessing the user data folder,) set the setting true and off you go.
- Raptor 2101 - 2010-10-02 20:49
i finaly rewrite the plug-in. I speed the whole thing up, while downloading the rss-feeds an store it locally and reload it after 30 minutes (if needed). So the user suffers an performance-impact at the "first read".
I solved the problem with the folder structure with initial checks and os.mkdir...
now i have to get the file in the official repository
- nchall - 2010-10-06 01:25
is there any way to make this a script or plugin as well? just requesting that so it will work with xbmc on xbox.
- Raptor 2101 - 2010-10-10 21:59
Cause i'am rely on the PVR-Testing-Branch i have no option to test a conversion, but there should be no problem to convert the source-code to the old plugin-style.
meanwhile i've done some performance-improvements and a backgroundscript who can be run from the os side (cronjob / task) same link like above.
- nchall - 2010-10-12 00:35
not sure how to convert it. what i used to do was delete addon.xml and keep plugin.xml, but i don't see plugin.xml in the zip.