The branch, frodo has been updated
via 0301f5e24a280b9387090e534ffcc7a0894d2088 (commit)
from 5c27e7a7fbf38937c4f8c487a20f9684865c9e61 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=0301f5e24a280b9387090e534ffcc7a0894d2088
commit 0301f5e24a280b9387090e534ffcc7a0894d2088
Author: ronie <[email protected]>
Date: Wed Jun 19 14:08:02 2013 +0200
[plugin.image.500px] -v0.2.0
diff --git a/plugin.image.500px/README b/plugin.image.500px/README
index db465d0..1afd61f 100644
--- a/plugin.image.500px/README
+++ b/plugin.image.500px/README
@@ -1 +1,2 @@
-XBMC added that displays photos from http://500px.com
+XBMC addon to view photos from http://500px.com. In the addon settings you can
change the quantity of photos per page to view 20 (default), 40, 60, 80, 100.
This addon was created by Patrick L Archibald at http://pla1.net. The source
for this addon can be found at https://github.com/pla1/plugin.image.500px.
+
diff --git a/plugin.image.500px/addon.xml b/plugin.image.500px/addon.xml
index 1dbee89..32730ec 100644
--- a/plugin.image.500px/addon.xml
+++ b/plugin.image.500px/addon.xml
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.image.500px" name="500px" version="0.1.3"
- provider-name="Patrick L Archibald [[email protected]]">
+<addon id="plugin.image.500px" name="500px" version="0.2.0"
+ provider-name="Patrick L Archibald [[email protected]],
Clément MATHIEU [[email protected]]">
<requires>
<import addon="script.module.simplejson" version="2.0.10"/>
+ <import addon="xbmc.python" version="2.1.0"/>
</requires>
<extension point="xbmc.python.pluginsource" library="default.py">
<provides>image</provides>
</extension>
+ <extension point="xbmc.python.module" library="resources/lib"/>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<summary lang="en">View photos from http://500px.com.</summary>
<description>
- View photos from http://500px.com. In the addon settings you can change
what photo group (feature)
- you want to pull from. The values are Popular (default), Upcoming,
Editors' Choice, Fresh Today, Fresh Yesterday, and Fresh This Week.
- You can also change the quantity of photos to view 20 (default), 40, 60,
80, 100. This addon was created
- by Patrick L Archibald at http://pla1.net. The source for this addon can
be found at https://github.com/pla1/plugin.image.500px.
+ View photos from http://500px.com. In the addon settings you can change
the quantity of photos per page to
+ view 20 (default), 40, 60, 80, 100. This addon was created by Patrick L
Archibald at http://pla1.net.
+ The source for this addon can be found at
https://github.com/pla1/plugin.image.500px.
</description>
<license>GPL 2.0</license>
</extension>
diff --git a/plugin.image.500px/changelog.txt b/plugin.image.500px/changelog.txt
index d4befb7..983c4ba 100644
--- a/plugin.image.500px/changelog.txt
+++ b/plugin.image.500px/changelog.txt
@@ -1,3 +1,11 @@
+Version 0.2.0 -
+- Export features as directory rather than as a addon setting
+- Added python-500px dependency
+- Faster image list loading
+- Added paginated view ("Next page")
+- Added search mode
+Version 0.1.3 - March 4, 2012
+- Reorganized GitHub repository. Submitted and accepted in the official XBMC
repository for version 11 (Eden).
Version 0.1.2 - March 3, 2012
- Dropped requires elements from addon.xml
Version 0.1.0 - February 26, 2012
diff --git a/plugin.image.500px/default.py b/plugin.image.500px/default.py
index ed70bc0..979d4a3 100644
--- a/plugin.image.500px/default.py
+++ b/plugin.image.500px/default.py
@@ -1,39 +1,147 @@
-import urllib2
-import simplejson as json
+import utils
+import utils.xbmc
+
+import xbmc
import xbmcgui
import xbmcplugin
-baseFeedUrl =
"https://api.500px.com/v1/photos?feature={feature}&page={page}&consumer_key=LvUFQHMQgSlaWe3aRQot6Ct5ZC2pdTMyTLS0GMfF"
-basePhotoUrl = "
https://api.500px.com/v1/photos/{photoid}?image_size=4&consumer_key=LvUFQHMQgSlaWe3aRQot6Ct5ZC2pdTMyTLS0GMfF"
-thisPlugin = int(sys.argv [1])
-featureNames = ['popular', 'upcoming', 'editors', 'fresh_today',
'fresh_yesterday', 'fresh_week']
-index = int(xbmcplugin.getSetting(thisPlugin, 'feature'))
-featureName = featureNames[index]
-PHOTOS_PER_PAGE = 20
-def createListing():
- global featureName
- global thisPlugin
- quantityIndex = int(xbmcplugin.getSetting(thisPlugin, 'quantity')) + 1
- quantity = quantityIndex * PHOTOS_PER_PAGE
- print '**** quantity: ' + str(quantity)
- pageNumber = 1
- while pageNumber <= quantityIndex:
- feedUrl = baseFeedUrl.format(feature=featureName, page=pageNumber)
- print '**** FEED URL:' + feedUrl
- pageNumber = pageNumber + 1
- feedData = urllib2.urlopen(feedUrl)
- feedJson = json.load(feedData)
- photos = feedJson['photos']
- for photoFromFeed in photos:
- id = photoFromFeed['id']
- photoData = urllib2.urlopen(basePhotoUrl.format(photoid=id))
- photoJson = json.load(photoData)
- photoDetails = photoJson['photo']
- listItem = xbmcgui.ListItem(photoDetails['name'], '', '', '', '')
- xbmcplugin.addDirectoryItem(thisPlugin, photoDetails['image_url'],
listItem, False, quantity)
- xbmcplugin.endOfDirectory(handle=thisPlugin, succeeded=True,
updateListing=False, cacheToDisc=True)
-createListing()
+from fivehundredpx.client import FiveHundredPXAPI
+
+_CONSUMER_KEY = 'LvUFQHMQgSlaWe3aRQot6Ct5ZC2pdTMyTLS0GMfF'
+_RPP = int(xbmcplugin.getSetting(utils.xbmc.addon_handle, 'rpp'))
+API = FiveHundredPXAPI()
+
+
+class Image(object):
+ def __init__(self, photo_json):
+ self.name= photo_json['name']
+ self.thumb_url = photo_json['images'][0]['url']
+ self.url = photo_json['images'][1]['url']
+
+ def __repr__(self):
+ return str(self.__dict__)
+
+
+def feature():
+ params = utils.xbmc.addon_params
+ feature = params['feature']
+ category = params.get('category', None)
+ page = int(params.get('page', 1))
+
+ resp = API.photos(feature=feature, only=category, rpp=_RPP,
consumer_key=_CONSUMER_KEY, image_size=[2, 4], page=page)
+
+ for image in map(Image, resp['photos']):
+ utils.xbmc.add_image(image)
+
+ if resp['current_page'] != resp['total_pages']:
+ next_page = page + 1
+ url = utils.xbmc.encode_child_url('feature', feature=feature,
category=category, page=next_page)
+ utils.xbmc.add_dir('Next page', url)
+
+ utils.xbmc.end_of_directory()
+
+
+def search():
+ def getTerm():
+ kb = xbmc.Keyboard(heading='Search 500px')
+ kb.doModal()
+ return kb.getText()
+
+ params = utils.xbmc.addon_params
+
+ if 'term' not in params:
+ term = getTerm()
+ page = 1
+ else:
+ term = params['term']
+ page = int(params['page'])
+
+ resp = API.photos_search(term=term, rpp=_RPP, consumer_key=_CONSUMER_KEY,
image_size=[2, 4], page=page)
+ for image in map(Image, resp['photos']):
+ utils.xbmc.add_image(image)
+
+ if resp['current_page'] != resp['total_pages']:
+ next_page = page + 1
+ url = utils.xbmc.encode_child_url('search', term=term, page=next_page)
+ utils.xbmc.add_dir('Next page', url)
+
+ utils.xbmc.end_of_directory()
+
+
+def features():
+ features = (
+ "editors",
+ "popular",
+ "upcoming",
+ "fresh_today",
+ "fresh_yesterday"
+ )
+
+ for feature in features:
+ url = utils.xbmc.encode_child_url('categories', feature=feature)
+ utils.xbmc.add_dir(feature, url)
+
+ url = utils.xbmc.encode_child_url('search')
+ utils.xbmc.add_dir('Search', url)
+
+ utils.xbmc.end_of_directory()
+
+
+def categories():
+ categories = {
+ 'Uncategorized': 0,
+ 'Abstract': 10,
+ 'Animals': 11,
+ 'Black and White': 5,
+ 'Celebrities': 1,
+ 'City': 9,
+ 'Commercial': 15,
+ 'Concert': 16,
+ 'Family': 20,
+ 'Fashion': 14,
+ 'Film': 2,
+ 'Fine Art': 24,
+ 'Food': 23,
+ 'Journalism': 3,
+ 'Landscapes': 8,
+ 'Macro': 12,
+ 'Nature': 18,
+ 'Nude': 4,
+ 'People': 7,
+ 'Performing Arts': 19,
+ 'Sport': 17,
+ 'Still Life': 6,
+ 'Street': 21,
+ 'Transportation': 26,
+ 'Travel': 13,
+ 'Underwater': 22,
+ 'Urban': 27,
+ 'Wedding': 25,
+ }
+
+ params = utils.xbmc.addon_params
+ feature = params['feature']
+
+ url = utils.xbmc.encode_child_url('feature', feature=feature)
+ utils.xbmc.add_dir('All', url)
+
+ for category in sorted(categories):
+ url = utils.xbmc.encode_child_url('feature', feature=feature,
category=category)
+ utils.xbmc.add_dir(category, url)
+
+ utils.xbmc.end_of_directory()
+try:
+ modes = {
+ 'feature': feature,
+ 'categories': categories,
+ 'search': search,
+ }
+ params = utils.xbmc.addon_params
+ mode_name = params['mode']
+ modes[mode_name]()
+except KeyError:
+ features()
diff --git a/plugin.image.500px/resources/settings.xml
b/plugin.image.500px/resources/settings.xml
index 8547b7d..ede3e4e 100644
--- a/plugin.image.500px/resources/settings.xml
+++ b/plugin.image.500px/resources/settings.xml
@@ -1,7 +1,6 @@
<?xml version ="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30000">
- <setting id="feature" type="enum" label="30001"
lvalues="30002|30003|30004|30005|30006|30007" default="0"/>
- <setting id="quantity" type="enum" label="30008" values="20|40|60|80|100"
default="0"/>
+ <setting id="rpp" type="labelenum" label="30008" values="20|40|60|80|100"
default="40"/>
</category>
</settings>
-----------------------------------------------------------------------
Summary of changes:
plugin.image.500px/README | 3 +-
plugin.image.500px/addon.xml | 13 +-
plugin.image.500px/changelog.txt | 8 +
plugin.image.500px/default.py | 172 +++++-
.../resources/lib/fivehundredpx/__init__.py | 11 +
.../resources/lib/fivehundredpx/auth.py | 91 +++
.../resources/lib/fivehundredpx/bind.py | 112 ++++
.../resources/lib/fivehundredpx/client.py | 75 +++
.../resources/lib/fivehundredpx/errors.py | 8 +
.../resources/lib/fivehundredpx/oauth.py | 655 ++++++++++++++++++++
.../resources/lib/fivehundredpx/settings.py | 6 +
.../resources/lib/fivehundredpx/utils.py | 64 ++
plugin.image.500px/resources/lib/utils/__init__.py | 9 +
plugin.image.500px/resources/lib/utils/xbmc.py | 40 ++
plugin.image.500px/resources/settings.xml | 3 +-
15 files changed, 1229 insertions(+), 41 deletions(-)
create mode 100644 plugin.image.500px/resources/lib/fivehundredpx/__init__.py
create mode 100644 plugin.image.500px/resources/lib/fivehundredpx/auth.py
create mode 100644 plugin.image.500px/resources/lib/fivehundredpx/bind.py
create mode 100644 plugin.image.500px/resources/lib/fivehundredpx/client.py
create mode 100644 plugin.image.500px/resources/lib/fivehundredpx/errors.py
create mode 100644 plugin.image.500px/resources/lib/fivehundredpx/oauth.py
create mode 100644 plugin.image.500px/resources/lib/fivehundredpx/settings.py
create mode 100644 plugin.image.500px/resources/lib/fivehundredpx/utils.py
create mode 100644 plugin.image.500px/resources/lib/utils/__init__.py
create mode 100644 plugin.image.500px/resources/lib/utils/xbmc.py
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons