Addon-Install options and background-scripts

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Raptor 2101 Offline
Senior Member
Posts: 242
Joined: Sep 2010
Reputation: 1
Post: #1
Hello Community.

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.
find quote
chippyash Offline
Senior Member
Posts: 130
Joined: Jan 2010
Reputation: 0
Location: Northants, UK
Post: #2
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.

Cheers

System info: Asrock ION330HT-BD (Intel Atom 330 4 core i686) connected to Sony KDL-Z5800 TV using hdmi via Onkyo TX-SR507 AV Amp. [Old Config Ubuntu 12.04. (Linux 3.2.0-32-generic-pae ) XBMCBuntu (Eden 11.0 Git:unknown Compiled Mar 24 2012). OpenGL 3.3.0 NVIDIA 280.13] New Config unknown - no working XBMC at moment!
find quote
Raptor 2101 Offline
Senior Member
Posts: 242
Joined: Sep 2010
Reputation: 1
Post: #3
you will find the needed files here... i will check you documentation as son as possible

http://blog.raptor2101.de/wp-content/upl...ackage.zip
find quote
chippyash Offline
Senior Member
Posts: 130
Joined: Jan 2010
Reputation: 0
Location: Northants, UK
Post: #4
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
Code:
<extension point="xbmc.python.pluginsource" library="default.py">
<provides>audio video</provides>
</extension>
and then deliver video podcasts under Video and audio Podcasts under Music.

Hope it helps

System info: Asrock ION330HT-BD (Intel Atom 330 4 core i686) connected to Sony KDL-Z5800 TV using hdmi via Onkyo TX-SR507 AV Amp. [Old Config Ubuntu 12.04. (Linux 3.2.0-32-generic-pae ) XBMCBuntu (Eden 11.0 Git:unknown Compiled Mar 24 2012). OpenGL 3.3.0 NVIDIA 280.13] New Config unknown - no working XBMC at moment!
(This post was last modified: 2010-09-14 23:55 by chippyash.)
find quote
chippyash Offline
Senior Member
Posts: 130
Joined: Jan 2010
Reputation: 0
Location: Northants, UK
Post: #5
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

System info: Asrock ION330HT-BD (Intel Atom 330 4 core i686) connected to Sony KDL-Z5800 TV using hdmi via Onkyo TX-SR507 AV Amp. [Old Config Ubuntu 12.04. (Linux 3.2.0-32-generic-pae ) XBMCBuntu (Eden 11.0 Git:unknown Compiled Mar 24 2012). OpenGL 3.3.0 NVIDIA 280.13] New Config unknown - no working XBMC at moment!
find quote
chippyash Offline
Senior Member
Posts: 130
Joined: Jan 2010
Reputation: 0
Location: Northants, UK
Post: #6
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.

System info: Asrock ION330HT-BD (Intel Atom 330 4 core i686) connected to Sony KDL-Z5800 TV using hdmi via Onkyo TX-SR507 AV Amp. [Old Config Ubuntu 12.04. (Linux 3.2.0-32-generic-pae ) XBMCBuntu (Eden 11.0 Git:unknown Compiled Mar 24 2012). OpenGL 3.3.0 NVIDIA 280.13] New Config unknown - no working XBMC at moment!
find quote
Raptor 2101 Offline
Senior Member
Posts: 242
Joined: Sep 2010
Reputation: 1
Post: #7
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 Wink

preview-download: http://blog.raptor2101.de/wp-content/upl...atcher.zip
find quote
nchall Offline
Senior Member
Posts: 152
Joined: Sep 2007
Reputation: 2
Post: #8
is there any way to make this a script or plugin as well? just requesting that so it will work with xbmc on xbox.
find quote
Raptor 2101 Offline
Senior Member
Posts: 242
Joined: Sep 2010
Reputation: 1
Post: #9
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.
find quote
nchall Offline
Senior Member
Posts: 152
Joined: Sep 2007
Reputation: 2
Post: #10
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.
find quote
Raptor 2101 Offline
Senior Member
Posts: 242
Joined: Sep 2010
Reputation: 1
Post: #11
nchall Wrote: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.

Thats cause i never create one Wink As i mentioned before, i use the PVR Testing Branche / Dharma release, so i had no need to carry about "plugins" instead of "addons". I just take the ListenLiveEu addon and apply the "Copy/Paste/Modify"-Modify process thats all... Do it the same way. Take an plugin, make comparisons to my code, and apply you changes the most parts are XBMC-Version independent so you just have to take care of the imported xbmc-api-calls. And for the xml apply the same -> copy-paste-modify.

This works since Mr. Turings Wink
find quote