2013-01-05, 19:52
Hi all,
I'm as new as they get . I'm trying to make a very simple add-on that lists popular images from Instagram using xbmcswift2. I *think* I have something that works, but I can't get the add-on to install. I tried just adding the folder to the add-on directory and that didn't work, so I zipped it up and tried to install it as a zip, which returned the error that the add-on didn't have the correct structure.
Here's my file structure and code. Any idea what mistake I'm making?
/plugin.image.fungrams
addon.py
addon.xml
changelog.txt
icon.png
LICENSE.txt
/resources
__init__.py
/language/English/strings.xml
/lib/__init__.py
/lib/resources/instagram
addon.py
addon.xml
I'm as new as they get . I'm trying to make a very simple add-on that lists popular images from Instagram using xbmcswift2. I *think* I have something that works, but I can't get the add-on to install. I tried just adding the folder to the add-on directory and that didn't work, so I zipped it up and tried to install it as a zip, which returned the error that the add-on didn't have the correct structure.
Here's my file structure and code. Any idea what mistake I'm making?
/plugin.image.fungrams
addon.py
addon.xml
changelog.txt
icon.png
LICENSE.txt
/resources
__init__.py
/language/English/strings.xml
/lib/__init__.py
/lib/resources/instagram
addon.py
Code:
from xbmcswift2 import Plugin
from resources.lib.instagram.client import InstagramAPI
__addon_id__ = 'plugin.image.fungrams'
__addon_name__ = 'Fungrams'
plugin = Plugin(__addon_name__, __addon_id__, __file__)
# Setup the Instagram API
CONFIG = {
'client_id': 'xxx',
'client_secret': 'xxx'
}
api = InstagramAPI(**CONFIG)
# Make the only menu option show popular photos, for now.
@plugin.route('/')
def show_menu():
item = {
'label': 'View Popular Photos',
'path': plugin.url_for('show_popular'),
}
return [item]
# Write plug-in route for popular photos
@plugin.route('/popular')
def show_popular():
items = [{
'label': photo.id,
'thumbnail': photo.images['standard_resolution'].url,
'path': photo.images['standard_resolution'].url,
'is_playable': True,
} for photo in api.media_popular(count=20)]
return plugin.finish(items)
if __name__ == '__main__':
plugin.run()
addon.xml
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.image.fungrams" name="Fungrams" version="0.1" provider-name="dicefordeath">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.xbmcswift2" version="1.1.1"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>image</provides>
</extension>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<language></language>
<summary>Instagram Add-on for XBMC</summary>
<description>View currently popular photos on Instagram</description>
</extension>
</addon>