The branch, dharma has been updated
via 63244f6dba0123a265101b01b39618672ea8bfd5 (commit)
from 6260f0b3d4d26b7c2702025a4e50fa55775ab5ac (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=63244f6dba0123a265101b01b39618672ea8bfd5
commit 63244f6dba0123a265101b01b39618672ea8bfd5
Author: spiff <[email protected]>
Date: Mon Jan 10 08:57:33 2011 +0100
[plugin.image.facebook] updated to version 0.9.4
diff --git a/plugin.image.facebook/addon.xml b/plugin.image.facebook/addon.xml
index 9f0defb..b94b6f9 100644
--- a/plugin.image.facebook/addon.xml
+++ b/plugin.image.facebook/addon.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.image.facebook"
name="facebook"
- version="0.9.3"
+ version="0.9.4"
provider-name="Rick Phillips (ruuk)">
<requires>
<import addon="xbmc.python" version="1.0"/>
<import addon="script.module.simplejson" version="2.0.9"/>
- <import addon="script.module.beautifulsoup" version="3.0.8.1"/>
+ <import addon="script.web.viewer" version="0.7.3"/>
</requires>
<extension point="xbmc.python.pluginsource"
@@ -17,6 +17,7 @@
<summary>Plugin to browse facebook photos</summary>
<description lang="en">Browse your facebook albums, photos of you, your
friends albums, and photos of your friends.</description>
<description lang="de">Browse deine Facebook Alben, deine Fotos, die
Alben und Fotos deiner Freunde</description>
+ <description lang="nl">Blader door uw Facebook albums en afbeeldingen
van u zelf of uw vrienden.</description>
<platform>all</platform>
</extension>
</addon>
diff --git a/plugin.image.facebook/changelog.txt
b/plugin.image.facebook/changelog.txt
index d0c43f0..5b72498 100644
--- a/plugin.image.facebook/changelog.txt
+++ b/plugin.image.facebook/changelog.txt
@@ -1,6 +1,16 @@
facebookPhotos-XBMC Changelog
-Current Version : 0.9.3
+Current Version : 0.9.4
+
+*** 0.9.4 ***
+
+Added Dutch language strings - thanks Michel de Bokx
+Fixed bug: Was rejecting auth tokens because of a bad length test
+Fixed bug: Log function was breaking on some characters on some os's
+Added paging so more than 25 photos can display ( Any empty next/previous is
facebook's fault =] )
+Fixed a bug with multi-line descriptions
+Speed enhancements
+Authorization now handled in XBMC!
*** 0.9.3 ***
diff --git a/plugin.image.facebook/default.py b/plugin.image.facebook/default.py
index 6034ad7..c394428 100644
--- a/plugin.image.facebook/default.py
+++ b/plugin.image.facebook/default.py
@@ -1,31 +1,27 @@
#!/usr/bin/python
import facebook
-import urllib, urlparse, sys, os, time, re
-from cgi import parse_qs
-import xbmc, xbmcgui, xbmcplugin, xbmcaddon
-
+import urllib, sys, os
+from addon import AddonHelper
__plugin__ = 'facebook'
__author__ = 'ruuk'
__url__ = 'http://code.google.com/p/facebookphotos-xbmc/'
__date__ = '10-10-2010'
-__version__ = '0.9.3'
-__settings__ = xbmcaddon.Addon(id='plugin.image.facebook')
-__language__ = __settings__.getLocalizedString
-
-IMAGES_PATH = xbmc.translatePath( os.path.join( os.getcwd(), 'resources',
'images' ) )
-
-CACHE_PATH =
xbmc.translatePath('special://profile/addon_data/plugin.image.facebook/cache/')
-if not os.path.exists(CACHE_PATH): os.makedirs(CACHE_PATH)
-
-TOKEN_PATH =
xbmc.translatePath('special://profile/addon_data/plugin.image.facebook/token')
+__version__ = '0.9.4'
+def LOG(msg):
+ try:
+ print 'FACEBOOKPHOTOS: ' +
msg.decode('utf-8','ignore').encode('ascii','replace')
+ except:
+ fb.xbmc().log('FACEBOOKPHOTOS: ' +
msg.decode('utf-8','ignore').encode('ascii','replace'))
+
class GraphWrapAuthError(Exception):
- def __init__(self, type, message):
- Exception.__init__(self, message)
- self.type = type
-
+ def __init__(self, type, message):
+ Exception.__init__(self, message)
+ self.type = type
+ self.message = message
+
class GraphWrap(facebook.GraphAPI):
def setLogin(self,email,passw):
self.login_email = email
@@ -75,7 +71,7 @@ class GraphWrap(facebook.GraphAPI):
fail = False
try:
return self.get_object(id, **args)
- except GraphAPIError,e:
+ except facebook.GraphAPIError,e:
if not e.type == 'OAuthException': raise
fail = True
@@ -86,7 +82,7 @@ class GraphWrap(facebook.GraphAPI):
return self.get_object(id, **args)
def getNewToken(self):
- import mechanize
+ from webviewer import mechanize #...@unresolvedimport
br = mechanize.Browser()
br.set_handle_robots(False)
scope = ''
@@ -95,8 +91,12 @@ class GraphWrap(facebook.GraphAPI):
'&redirect_uri='+self.redirect+\
'&type=user_agent&display=popup'+scope
print url
- res = br.open(url)
- html = res.read()
+ try:
+ res = br.open(url)
+ html = res.read()
+ except:
+ self.genericError()
+ return False
script = False
try:
@@ -104,6 +104,7 @@ class GraphWrap(facebook.GraphAPI):
br.select_form(nr=0)
print "HTML"
except:
+ self.genericError()
script = True
print "SCRIPT"
@@ -119,101 +120,132 @@ class GraphWrap(facebook.GraphAPI):
url = res.geturl()
print "FORM"
except:
+ self.genericError()
#somethings wrong, abort
print "FORM ERROR"
return False
script = False
- try:
- #we submitted the form, check the result url
for the access token
- token =
parse_qs(urlparse.urlparse(url)[4])['access_token']
- except:
- script = True
+ token = self.extractTokenFromURL(url)
+ if not token: script = True
if script:
+ print "SCRIPT TOKEN"
#no token in the url, let's try to parse it
from javascript on the page
html = res.read()
token = self.parseTokenFromScript(html)
+
+ if not self.tokenIsValid(token):
+ #if script: LOG("HTML:" + html)
+ return False
- if 'html' in token or len(token) > 100: raise
GraphWrapAuthError('RENEW_TOKEN_FAILURE','Failed to get new token')
self.access_token = token
self.saveToken()
return True
+ def extractTokenFromURL(self,url):
+ try:
+ #we submitted the form, check the result url for the
access token
+ from cgi import parse_qs
+ import urlparse
+ token =
parse_qs(urlparse.urlparse(url.replace('#','?',1))[4])['access_token'][0]
+ print "URL TOKEN: %s" % token
+ return token
+ except:
+ self.genericError()
+ return None
+
+ def tokenIsValid(self,token):
+ if not token: return False
+ if 'login_form' in token and 'standard_explanation' in token:
+ reason =
self.re().findall('id="standard_explanation">(?:<p>)?([^<]*)<',token)
+ if reason: print reason[0]
+ LOG("TOKEN: " + token)
+ raise GraphWrapAuthError('LOGIN_FAILURE',reason)
+ return False
+ if 'html' in token or 'script' in token or len(token) > 160:
+ LOG("TOKEN: " + token)
+ raise GraphWrapAuthError('RENEW_TOKEN_FAILURE','Failed
to get new token')
+ return False
+ return True
+
+ def genericError(self):
+ print 'ERROR: %s::%s (%d) - %s' % (self.__class__.__name__
+ ,
sys.exc_info()[2].tb_frame.f_code.co_name, sys.exc_info()[2].tb_lineno,
sys.exc_info()[1])
+
def parseTokenFromScript(self,html):
return
urllib.unquote_plus(html.split("#access_token=")[-1].split("&expires")[0])
- def saveToken(self):
- f = open(TOKEN_PATH,'w')
+ def saveToken(self,token=None):
+ if token: self.access_token = token
+ f = open(fb.TOKEN_PATH,'w')
f.write(self.access_token)
f.close()
-class facebookSession:
+class facebookSession(AddonHelper):
def __init__(self):
- self.get_friends_photos =
(__settings__.getSetting('get_friends_photos') == "true")
- self.get_album_photos =
(__settings__.getSetting('get_album_photos') == "true")
+ AddonHelper.__init__(self,'plugin.image.facebook')
+
+ self.IMAGES_PATH = self.addonPath('resources/images')
+
+ self.CACHE_PATH = self.dataPath('cache')
+ if not os.path.exists(self.CACHE_PATH):
os.makedirs(self.CACHE_PATH)
+
+ self.TOKEN_PATH = self.dataPath('token')
+
+ self.get_friends_photos =
(self.getSetting('get_friends_photos') == "true")
+ self.get_album_photos = (self.getSetting('get_album_photos') ==
"true")
self.loadToken()
self.graph = GraphWrap(self.token)
self.setLoginData()
self.graph.setAppData('150505371652086',scope='user_photos,friends_photos,user_photo_video_tags,friends_photo_video_tags')
-
+ self.urlprx = None
+ self.proxy = None
+
def getToken(self):
if self.graph.getNewToken():
self.token = self.graph.access_token
def setLoginData(self):
- login_email = __settings__.getSetting('login_email')
- login_pass = __settings__.getSetting('login_pass')
+ login_email = self.getSetting('login_email')
+ login_pass = self.getSetting('login_pass')
self.graph.setLogin(login_email,login_pass)
self.hasLoginData = True
if not (login_email and login_pass): self.hasLoginData = False
def loadToken(self):
self.token = ''
- if os.path.exists(TOKEN_PATH):
- f = open(TOKEN_PATH,'r')
+ if os.path.exists(self.TOKEN_PATH):
+ f = open(self.TOKEN_PATH,'r')
self.token = f.read()
f.close()
-
- def addLink(self,name,url,iconimage,tot=0):
- ok=True
-
#u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&name="+urllib.quote_plus(name)
- liz=xbmcgui.ListItem(self.removeCRLF(name),
iconImage="DefaultImage.png", thumbnailImage=iconimage)
- liz.setInfo( type="image", infoLabels={ "Title": name } )
- #if contextMenu: liz.addContextMenuItems(contextMenu)
- return
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz,isFolder=False,totalItems=tot)
-
- def addDir(self,name,url,mode,iconimage,page=1,tot=0):
- name = self.removeCRLF(name)
-
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&page="+str(page)+"&name="+urllib.quote_plus(self.makeAscii(name))
- ok=True
- liz=xbmcgui.ListItem(name,
'test',iconImage="DefaultFolder.png", thumbnailImage=iconimage)
- liz.setInfo( type="image", infoLabels={"Title": name} )
- return
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True,totalItems=tot)
def CATEGORIES(self):
-
self.addDir(__language__(30004),'me',1,os.path.join(IMAGES_PATH,'albums.png'))
-
self.addDir(__language__(30010),'me',3,os.path.join(IMAGES_PATH,'videos.png'))
-
self.addDir(__language__(30005),'friends',2,os.path.join(IMAGES_PATH,'friends.png'))
-
self.addDir(__language__(30006),'me',101,os.path.join(IMAGES_PATH,'photosofme.png'))
-
self.addDir(__language__(30011),'me',102,os.path.join(IMAGES_PATH,'videosofme.png'))
+
self.addDir(self.lang(30004),os.path.join(self.IMAGES_PATH,'albums.png'),url='me',mode=1)
+
self.addDir(self.lang(30010),os.path.join(self.IMAGES_PATH,'videos.png'),url='me',mode=3)
+
self.addDir(self.lang(30005),os.path.join(self.IMAGES_PATH,'friends.png'),url='friends',mode=2)
+
self.addDir(self.lang(30006),os.path.join(self.IMAGES_PATH,'photosofme.png'),url='me',mode=101)
+
self.addDir(self.lang(30011),os.path.join(self.IMAGES_PATH,'videosofme.png'),url='me',mode=102)
def ALBUMS(self,uid='me',name=''):
albums = self.graph.getConnections(uid,'albums')
tot = len(albums['data'])
for a in albums['data']:
aid = a.get('id','')
- fn = os.path.join(CACHE_PATH,aid + '.jpg') #still works
even if image is not jpg - doesn't work without the extension
+ fn = os.path.join(self.CACHE_PATH,aid + '.jpg') #still
works even if image is not jpg - doesn't work without the extension
tn =
"https://graph.facebook.com/"+aid+"/picture?access_token=" +
self.graph.access_token
if not os.path.exists(fn):
- if self.get_album_photos: fn,ignore =
urllib.urlretrieve(tn,fn)
+ if self.get_album_photos: fn =
self.getFile(tn,fn)
else: fn = ''
- if not
self.addDir(a.get('name',''),aid,101,fn,tot=tot): break
+ if not
self.addDir(a.get('name',''),fn,url=aid,mode=101,tot=tot): break
if uid != 'me':
-
self.addDir(__language__(30012).replace('@REPLACE@',name),uid,3,os.path.join(IMAGES_PATH,'videos.png'))
-
self.addDir(__language__(30007).replace('@REPLACE@',name),uid,101,os.path.join(IMAGES_PATH,'photosofme.png'))
-
self.addDir(__language__(30013).replace('@REPLACE@',name),uid,102,os.path.join(IMAGES_PATH,'videosofme.png'))
+ self.addDir(
self.lang(30012).replace('@REPLACE@',name),
+
os.path.join(self.IMAGES_PATH,'videos.png'),
+ url=uid,
+ mode=3)
+
self.addDir(self.lang(30007).replace('@REPLACE@',name),os.path.join(self.IMAGES_PATH,'photosofme.png'),url=uid,mode=101)
+
self.addDir(self.lang(30013).replace('@REPLACE@',name),os.path.join(self.IMAGES_PATH,'videosofme.png'),url=uid,mode=102)
def FRIENDS(self):
@@ -229,37 +261,126 @@ class facebookSession:
tot = len(srt)
for s in srt:
uid = show[s].get('id','')
- fn = os.path.join(CACHE_PATH,uid + '.jpg') #still works
even if image is not jpg - doesn't work without the extension
+ fn = os.path.join(self.CACHE_PATH,uid + '.jpg') #still
works even if image is not jpg - doesn't work without the extension
tn =
"https://graph.facebook.com/"+uid+"/picture?type=large&access_token=" +
self.graph.access_token
if not os.path.exists(fn):
- if self.get_friends_photos: fn,ignore =
urllib.urlretrieve(tn,fn)
- else: fn = ''
+ if self.get_friends_photos:
+ try:
+ fn = self.getFile(tn,fn)
+ except:
+ fn = ''
+ else:
+ fn = ''
#fn =
"https://graph.facebook.com/"+uid+"/picture?access_token=" +
self.graph.access_token + "&nonsense=image.jpg" #<-- crashes XBMC
- if not
self.addDir(show[s].get('name',''),uid,1,fn,tot=tot): break
+ name = show[s].get('name','')
+ if not
self.addDir(name,fn,url=uid,mode=1,tot=tot,name=name): break
- def PHOTOS(self,aid):
- photos = self.graph.getConnections(aid,'photos')
+ def PHOTOS(self,aid,isPaging=False):
+ if isPaging:
+ photos = self.graph.request(aid)
+ else:
+ photos = self.graph.getConnections(aid,'photos')
tot = len(photos['data'])
+ paging = photos.get('paging')
+ next = None
+ if paging:
+ next = paging.get('next')
+ prev = paging.get('previous')
+ if self.areAlmostTheSame(prev,next):
+ prev = None
+ next = None
+ if prev:
+ if not self.addDir('<- %s' %
self.lang(30014),os.path.join(self.IMAGES_PATH,'previous.png'),url=prev,mode=201):
return
for p in photos['data']:
- tn = p.get('picture','') + '?fix=' + str(time.time())
#why does this work? I have no idea. Why did I try it. I have no idea :)
+ tn = p.get('picture','') + '?fix=' +
str(self.time().time()) #why does this work? I have no idea. Why did I try it.
I have no idea :)
#print "BEFORE: " + tn
- tn =
re.sub('/hphotos-\w+-\w+/\w+\.\w+/','/hphotos-ak-snc1/hs255.snc1/',tn) # this
seems to get better results then using the random server
+ tn =
self.re().sub('/hphotos-\w+-\w+/\w+\.\w+/','/hphotos-ak-snc1/hs255.snc1/',tn) #
this seems to get better results then using the random server
#print "-AFTER: " + tn
- if not
self.addLink(p.get('name',p.get('id','None')),p.get('source',''),tn,tot): break
+ if not
self.addLink(self.removeCRLF(p.get('name',p.get('id','None'))),p.get('source',''),tn,tot):
return
+ if next:
+ if not self.addDir('%s ->' %
self.lang(30015),os.path.join(self.IMAGES_PATH,'next.png'),url=next,mode=201):
return
- def VIDEOS(self,uid,uploaded=False):
- if uploaded: videos =
self.graph.getConnections(uid,'videos/uploaded')
- else: videos = self.graph.getConnections(uid,'videos')
+ def VIDEOS(self,uid,uploaded=False,isPaging=False):
+ if isPaging:
+ videos = self.graph.request(uid)
+ else:
+ if uploaded: videos =
self.graph.getConnections(uid,'videos/uploaded')
+ else: videos = self.graph.getConnections(uid,'videos')
tot = len(videos['data'])
+ paging = videos.get('paging')
+ next = None
+ if paging:
+ next = paging.get('next')
+ prev = paging.get('previous')
+ if self.areAlmostTheSame(prev,next):
+ prev = None
+ next = None
+ if prev:
+ if not self.addDir('<- %s' %
self.lang(30014),os.path.join(self.IMAGES_PATH,'previous.png'),url=prev,mode=202):
return
for v in videos['data']:
- tn = v.get('picture','') + '?fix=' + str(time.time())
#why does this work? I have no idea. Why did I try it. I have no idea :)
- if not
self.addLink(v.get('name',v.get('id','None')),v.get('source',''),tn,tot): break
+ tn = v.get('picture','') + '?fix=' +
str(self.time().time()) #why does this work? I have no idea. Why did I try it.
I have no idea :)
+ if not
self.addLink(self.removeCRLF(v.get('name',v.get('id','None'))),v.get('source',''),tn,tot):
return
+ if next:
+ if not self.addDir('%s ->' %
self.lang(30015),os.path.join(self.IMAGES_PATH,'next.png'),url=next,mode=202):
return
+ def areAlmostTheSame(self,first,second):
+ if not first or not second: return False
+ first =
self.re().sub('(\d{4}-\d{2}-\d{2}T\d{2}%3A\d{2}%3A\d)\d(%2B\d{4})',r'\1x\2',first)
+ second =
self.re().sub('(\d{4}-\d{2}-\d{2}T\d{2}%3A\d{2}%3A\d)\d(%2B\d{4})',r'\1x\2',second)
+ return first == second
+
def removeCRLF(self,text):
return " ".join(text.split())
def makeAscii(self,name):
return name.encode('ascii','replace')
+
+ def doPlugin(self):
+ mode = self.getParamInt('mode',None)
+ url = self.getParamString('url',None)
+ name = self.getParamString('name',None)
+
+ update_dir = False
+ success = True
+ cache = True
+
+ if not self.hasLoginData:
+ self.openSettings()
+ self.setLoginData()
+
+ if not self.token:
+
self.xbmcgui().Dialog().ok(self.lang(30101),self.lang(30102),self.lang(30103),self.lang(30104))
+
self.xbmcplugin().endOfDirectory(int(sys.argv[1]),succeeded=success,updateListing=update_dir,cacheToDisc=cache)
+ token = getAuth()
+ if not token: self.getToken()
+ return
+
+ if not self.hasLoginData:
+
self.xbmcgui().Dialog().ok(self.lang(30105),self.lang(30106),self.lang(30107))
+ success = False
+ elif not self.token:
+
self.xbmcgui().Dialog().ok(self.lang(30108),self.lang(30109),self.lang(30110))
+ success = False
+ elif mode==None or url==None or len(url)<1:
+ self.CATEGORIES()
+ elif mode==1:
+ self.ALBUMS(url,name)
+ elif mode==2:
+ self.FRIENDS()
+ elif mode==3:
+ self.VIDEOS(url,uploaded=True)
+ elif mode==101:
+ self.PHOTOS(url)
+ elif mode==102:
+ self.VIDEOS(url)
+ elif mode==201:
+ self.PHOTOS(url,isPaging=True)
+ update_dir=True
+ elif mode==202:
+ self.VIDEOS(url,isPaging=True)
+ update_dir=True
+
+
self.xbmcplugin().endOfDirectory(int(sys.argv[1]),succeeded=success,updateListing=update_dir,cacheToDisc=cache)
## XBMC Plugin stuff starts here
--------------------------------------------------------
def get_params():
@@ -279,68 +400,35 @@ def get_params():
param[splitparams[0]]=splitparams[1]
return param
-
-
-### Do plugin stuff
--------------------------------------------------------------------------
-def doPlugin():
- params=get_params()
- url=None
- name=None
- mode=None
-
- try:
- url=urllib.unquote_plus(params["url"])
- except:
- pass
- try:
- name=urllib.unquote_plus(params["name"])
- except:
- pass
- try:
- mode=int(params["mode"])
- except:
- pass
-
- print "Mode: "+str(mode)
- print "URL: "+str(url)
- print "Name: "+str(name)
+def getAuth():
+ redirect =
urllib.quote('http://2ndmind.com/facebookphotos/complete.html')
+ scope =
urllib.quote('user_photos,friends_photos,user_photo_video_tags,friends_photo_video_tags,user_videos,friends_videos')
+ url =
'https://graph.facebook.com/oauth/authorize?client_id=150505371652086&redirect_uri=%s&type=user_agent&scope=%s'
% (redirect,scope)
+ import xbmcplugin #...@unresolvedimport
+ xbmcplugin.endOfDirectory(int(sys.argv[1]),succeeded=False)
+ from webviewer import webviewer #...@unresolvedimport
+ url,html =
webviewer.getWebResult(url,autoForms=[{'action':'login.php'},{'action':'uiserver.php'}])
#...@unusedvariable
+ token = fb.graph.extractTokenFromURL(url)
+ if fb.graph.tokenIsValid(token):
+ fb.graph.saveToken(token)
+ return token
+ return None
+
- update_dir = False
- success = True
- cache = True
+### Do plugin stuff
--------------------------------------------------------------------------
- fb = facebookSession()
-
- if not fb.hasLoginData:
- __settings__.openSettings()
- fb.setLoginData()
-
- if not fb.token:
-
xbmcgui.Dialog().ok(__language__(30101),__language__(30102).replace('@REPLACE@','http://2ndmind.com/facebookphotos'),__language__(30103),__language__(30104))
- fb.getToken()
-
- if not fb.hasLoginData:
-
xbmcgui.Dialog().ok(__language__(30105),__language__(30106),__language__(30107))
- success = False
- elif not fb.token:
-
xbmcgui.Dialog().ok(__language__(30108),__language__(30109),__language__(30110))
- success = False
- elif mode==None or url==None or len(url)<1:
- fb.CATEGORIES()
- elif mode==1:
- fb.ALBUMS(url,name)
- elif mode==2:
- fb.FRIENDS()
- elif mode==3:
- fb.VIDEOS(url,uploaded=True)
- elif mode==101:
- fb.PHOTOS(url)
- elif mode==102:
- fb.VIDEOS(url)
-
-
xbmcplugin.endOfDirectory(int(sys.argv[1]),succeeded=success,updateListing=update_dir,cacheToDisc=cache)
try:
- doPlugin()
+ fb = facebookSession()
+ fb.doPlugin()
except GraphWrapAuthError,e:
-
xbmcgui.Dialog().ok(__language__(30111),__language__(30112),__language__(30113).replace('@REPLACE@','http://2ndmind.com/facebookphotos'),__language__(30114))
+ import xbmcgui,xbmcaddon #...@unresolvedimport
+ __addon__ = xbmcaddon.Addon(id='plugin.image.facebook')
+ __language__ = __addon__.getLocalizedString
+
+ if e.type == 'LOGIN_FAILURE':
+
xbmcgui.Dialog().ok(__language__(30115),__language__(30116),e.message)
+ else:
+
xbmcgui.Dialog().ok(__language__(30111),__language__(30112),__language__(30113),__language__(30114))
+ token = getAuth()
+ if not token: facebookSession().getToken()
diff --git a/plugin.image.facebook/facebook.py
b/plugin.image.facebook/facebook.py
index ee97da8..0400f46 100644
--- a/plugin.image.facebook/facebook.py
+++ b/plugin.image.facebook/facebook.py
@@ -169,8 +169,12 @@ class GraphAPI(object):
args["access_token"] = self.access_token
if post_args is None: post_data = None
else: urllib.urlencode(post_args)
- fileob = urllib.urlopen("https://graph.facebook.com/" + path + "?" +
- urllib.urlencode(args), post_data)
+ pre = "https://graph.facebook.com/"
+ args = "?" + urllib.urlencode(args)
+ if path.startswith('http'):
+ pre = ''
+ args = ''
+ fileob = urllib.urlopen(pre + path + args, post_data)
try:
response = _parse_json(fileob.read())
finally:
diff --git a/plugin.image.facebook/resources/language/English/strings.xml
b/plugin.image.facebook/resources/language/English/strings.xml
index e5fcea4..9cce724 100644
--- a/plugin.image.facebook/resources/language/English/strings.xml
+++ b/plugin.image.facebook/resources/language/English/strings.xml
@@ -13,12 +13,14 @@
<string id="30011">Videos Of Me</string>
<string id="30012">@REPLACE@'s Videos</string>
<string id="30013">Videos Of @REPLACE@</string>
+ <string id="30014">Previous</string>
+ <string id="30015">Next</string>
- <!---Dialogs--->
+ <!-- Dialogs -->
<string id="30101">Authorization</string>
- <string id="30102">Go to @REPLACE@</string>
- <string id="30103">Authorize the plugin.</string>
- <string id="30104">Click OK when done.</string>
+ <string id="30102">Please sign in and authorize the add-on,</string>
+ <string id="30103">then re-start the plugin.</string>
+ <string id="30104">Click OK to open the browser.</string>
<string id="30105">Login</string>
<string id="30106">Missing login info.</string>
@@ -30,6 +32,9 @@
<string id="30111">Authorization Error</string>
<string id="30112">Error authorizing with facebook.</string>
- <string id="30113">Re-authorize at @REPLACE@</string>
- <string id="30114">Then try again.</string>
+ <string id="30113">Click ok to open a browser.</string>
+ <string id="30114">Re-authorize, then try again.</string>
+
+ <string id="30115">Login Failure</string>
+ <string id="30116">Facebook Message: </string>
</strings>
-----------------------------------------------------------------------
Summary of changes:
.../addon.py | 45 +-
plugin.image.facebook/addon.xml | 5 +-
plugin.image.facebook/changelog.txt | 12 +-
plugin.image.facebook/default.py | 366 ++-
plugin.image.facebook/facebook.py | 8 +-
plugin.image.facebook/mechanize/__init__.py | 211 --
plugin.image.facebook/mechanize/_auth.py | 68 -
plugin.image.facebook/mechanize/_clientcookie.py | 1700 ----------
plugin.image.facebook/mechanize/_debug.py | 28 -
.../mechanize/_firefox3cookiejar.py | 248 --
plugin.image.facebook/mechanize/_form.py | 3277 --------------------
plugin.image.facebook/mechanize/_gzip.py | 105 -
plugin.image.facebook/mechanize/_headersutil.py | 232 --
plugin.image.facebook/mechanize/_html.py | 624 ----
plugin.image.facebook/mechanize/_http.py | 447 ---
plugin.image.facebook/mechanize/_lwpcookiejar.py | 185 --
plugin.image.facebook/mechanize/_markupbase.py | 393 ---
plugin.image.facebook/mechanize/_mechanize.py | 669 ----
.../mechanize/_mozillacookiejar.py | 161 -
plugin.image.facebook/mechanize/_msiecookiejar.py | 388 ---
plugin.image.facebook/mechanize/_opener.py | 442 ---
plugin.image.facebook/mechanize/_pullparser.py | 391 ---
plugin.image.facebook/mechanize/_request.py | 40 -
plugin.image.facebook/mechanize/_response.py | 525 ----
plugin.image.facebook/mechanize/_rfc3986.py | 245 --
plugin.image.facebook/mechanize/_sgmllib_copy.py | 559 ----
plugin.image.facebook/mechanize/_sockettimeout.py | 6 -
plugin.image.facebook/mechanize/_testcase.py | 162 -
plugin.image.facebook/mechanize/_urllib2.py | 50 -
plugin.image.facebook/mechanize/_urllib2_fork.py | 1414 ---------
plugin.image.facebook/mechanize/_useragent.py | 367 ---
plugin.image.facebook/mechanize/_util.py | 305 --
plugin.image.facebook/mechanize/_version.py | 2 -
.../resources/images/next.png | Bin 19006 -> 19006 bytes
.../resources/images/previous.png | Bin 19199 -> 19199 bytes
.../resources/language/Dutch/strings.xml | 36 +
.../resources/language/English/strings.xml | 17 +-
37 files changed, 324 insertions(+), 13409 deletions(-)
copy {plugin.image.picasa => plugin.image.facebook}/addon.py (80%)
delete mode 100644 plugin.image.facebook/mechanize/__init__.py
delete mode 100644 plugin.image.facebook/mechanize/_auth.py
delete mode 100644 plugin.image.facebook/mechanize/_clientcookie.py
delete mode 100644 plugin.image.facebook/mechanize/_debug.py
delete mode 100644 plugin.image.facebook/mechanize/_firefox3cookiejar.py
delete mode 100644 plugin.image.facebook/mechanize/_form.py
delete mode 100644 plugin.image.facebook/mechanize/_gzip.py
delete mode 100644 plugin.image.facebook/mechanize/_headersutil.py
delete mode 100644 plugin.image.facebook/mechanize/_html.py
delete mode 100644 plugin.image.facebook/mechanize/_http.py
delete mode 100644 plugin.image.facebook/mechanize/_lwpcookiejar.py
delete mode 100644 plugin.image.facebook/mechanize/_markupbase.py
delete mode 100644 plugin.image.facebook/mechanize/_mechanize.py
delete mode 100644 plugin.image.facebook/mechanize/_mozillacookiejar.py
delete mode 100644 plugin.image.facebook/mechanize/_msiecookiejar.py
delete mode 100644 plugin.image.facebook/mechanize/_opener.py
delete mode 100644 plugin.image.facebook/mechanize/_pullparser.py
delete mode 100644 plugin.image.facebook/mechanize/_request.py
delete mode 100644 plugin.image.facebook/mechanize/_response.py
delete mode 100644 plugin.image.facebook/mechanize/_rfc3986.py
delete mode 100644 plugin.image.facebook/mechanize/_sgmllib_copy.py
delete mode 100644 plugin.image.facebook/mechanize/_sockettimeout.py
delete mode 100644 plugin.image.facebook/mechanize/_testcase.py
delete mode 100644 plugin.image.facebook/mechanize/_urllib2.py
delete mode 100644 plugin.image.facebook/mechanize/_urllib2_fork.py
delete mode 100644 plugin.image.facebook/mechanize/_useragent.py
delete mode 100644 plugin.image.facebook/mechanize/_util.py
delete mode 100644 plugin.image.facebook/mechanize/_version.py
copy {plugin.image.flickr => plugin.image.facebook}/resources/images/next.png
(100%)
copy {plugin.image.flickr =>
plugin.image.facebook}/resources/images/previous.png (100%)
create mode 100644 plugin.image.facebook/resources/language/Dutch/strings.xml
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons