The branch, eden has been updated
       via  b2cb2993024280b0190ef67c7c3ec59f15ee4606 (commit)
      from  a52b6136089c7c435425e618bf24a40d71f4edbc (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=b2cb2993024280b0190ef67c7c3ec59f15ee4606

commit b2cb2993024280b0190ef67c7c3ec59f15ee4606
Author: beenje <[email protected]>
Date:   Sat Mar 16 23:04:40 2013 +0100

    [plugin.image.iphoto] updated to version 2.0.4

diff --git a/plugin.image.iphoto/addon.xml b/plugin.image.iphoto/addon.xml
index aab132b..9187dbe 100644
--- a/plugin.image.iphoto/addon.xml
+++ b/plugin.image.iphoto/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.image.iphoto" name="iPhoto" version="2.0.3" 
provider-name="jingai">
+<addon id="plugin.image.iphoto" name="iPhoto" version="2.0.4" 
provider-name="jingai">
     <requires>
        <import addon="xbmc.python" version="2.0"/>
        <import addon="script.module.simplejson" version="2.0.10"/>
@@ -43,6 +43,7 @@
        <description lang="pt_BR">Importações biblioteca do iPhoto em 
Eventos, Álbuns, Rostos, Lugares, palavras-chave e categorias de ratings. [CR] 
[CR] Para mais informações, consulte o README 
no&#10;http://github.com/jingai/plugin.image.iphoto</description>
        <description lang="sk">Importuje iPhoto knižnicu do Udalostí, 
Albumov, Klúčových slov a Hodnotení v kategóriách.&#10;&#10;Pre via 
informácií si prečítajte README na 
http://github.com/jingai/plugin.image.iphoto</description>
        <description lang="sv">Importerar iPhoto biblioteket till händelser, 
album, ansikten, platser, nyckelord och betygs kategorier.[CR][CR]För mer 
information, läs README på 
http://github.com/jingai/plugin.image.iphoto</description>
+       <language></language>
        <platform>all</platform>
     </extension>
 </addon>
diff --git a/plugin.image.iphoto/changelog.txt 
b/plugin.image.iphoto/changelog.txt
index 0a517bd..5057290 100644
--- a/plugin.image.iphoto/changelog.txt
+++ b/plugin.image.iphoto/changelog.txt
@@ -1,3 +1,6 @@
+2.0.4 - 20130315
+- Fix Places support.
+
 2.0.3 - 20130108
 - Update language files from Transifex.
 
diff --git a/plugin.image.iphoto/resources/__init__.py 
b/plugin.image.iphoto/resources/__init__.py
index ee074ac..b93054b 100644
--- a/plugin.image.iphoto/resources/__init__.py
+++ b/plugin.image.iphoto/resources/__init__.py
@@ -1 +1 @@
-# Dummy file to make this directory a package.

+# Dummy file to make this directory a package.
diff --git a/plugin.image.iphoto/resources/lib/__init__.py 
b/plugin.image.iphoto/resources/lib/__init__.py
index ee074ac..b93054b 100644
--- a/plugin.image.iphoto/resources/lib/__init__.py
+++ b/plugin.image.iphoto/resources/lib/__init__.py
@@ -1 +1 @@
-# Dummy file to make this directory a package.

+# Dummy file to make this directory a package.
diff --git a/plugin.image.iphoto/resources/lib/geo.py 
b/plugin.image.iphoto/resources/lib/geo.py
index f977b85..3cf3f45 100644
--- a/plugin.image.iphoto/resources/lib/geo.py
+++ b/plugin.image.iphoto/resources/lib/geo.py
@@ -25,8 +25,7 @@ import xml.dom.minidom
 from xml.parsers.expat import ExpatError
 from traceback import print_exc
 
-GOOGLE_API_KEY = None
-GOOGLE_DOMAIN = "maps.google.com"
+GOOGLE_DOMAIN = "maps.googleapis.com"
 
 MAP_ZOOM_MIN = 1
 MAP_ZOOM_MAX = 21
@@ -65,26 +64,33 @@ class GeocoderError(Exception):
 class GeocoderResultError(GeocoderError):
     pass
 
-class GBadKeyError(GeocoderError):
-    pass
-
 class GQueryError(GeocoderResultError):
     pass
 
 class GTooManyQueriesError(GeocoderResultError):
     pass
 
+def check_status(status):
+    if status == 'ZERO_RESULTS':
+       raise GQueryError("Geocode was successful but returned no results.")
+    elif status == 'OVER_QUERY_LIMIT':
+       raise GTooManyQueriesError("The given key has gone over the requests 
limit in the 24 hour period or has submitted too many requests in too short a 
period of time.")
+    elif status == 'REQUEST_DENIED':
+       raise GQueryError("Request was denied, generally because of lack of a 
sensor parameter.")
+    elif status == 'INVALID_REQUEST':
+       raise GQueryError("Invalid request.  Probably missing address or 
latlng.")
+    else:
+       raise GeocoderResultError("Unknown error.")
+
 # forward geocode an address or reverse geocode a latitude/longitude pair.
 # input loc should not be pre-urlencoded (that is, use spaces, not plusses).
 #
 # returns all addresses found with their corresponding lat/lon pairs, unless
 # exactly_one is True, which returns just the first (probably best) match.
 def geocode(loc, exactly_one=True):
-    req_url = "http://%s/maps/geo"; % (GOOGLE_DOMAIN.strip('/'))
+    req_url = "http://%s/maps/api/geocode/json"; % (GOOGLE_DOMAIN.strip('/'))
     req_hdr = { 'User-Agent':HTTP_USER_AGENT }
-    req_par = { 'q':loc, 'output':'json' }
-    if GOOGLE_API_KEY:
-       req_par['key'] = GOOGLE_API_KEY
+    req_par = { 'latlng':loc, 'sensor':'false', 'output':'json' }
     req_dat = urlencode(req_par)
 
     req = Request(unquote(req_url + "?" + req_dat), None, req_hdr)
@@ -93,34 +99,16 @@ def geocode(loc, exactly_one=True):
        resp = decode_page(resp)
 
     doc = json.loads(resp)
-    places = doc.get('Placemark', [])
-
-    if len(places) == 0:
-       # Got empty result. Parse out the status code and raise an error if 
necessary.
-       status = doc.get("Status", [])
-       status_code = status["code"]
-       if status_code == 400:
-           raise GeocoderResultError("Bad request (Server returned status 
400)")
-       elif status_code == 500:
-           raise GeocoderResultError("Unkown error (Server returned status 
500)")
-       elif status_code == 601:
-           raise GQueryError("An empty lookup was performed")
-       elif status_code == 602:
-           raise GQueryError("No corresponding geographic location could be 
found for the specified location, possibly because the address is relatively 
new, or because it may be incorrect.")
-       elif status_code == 603:
-           raise GQueryError("The geocode for the given location could be 
returned due to legal or contractual reasons")
-       elif status_code == 610:
-           raise GBadKeyError("The api_key is either invalid or does not match 
the domain for which it was given.")
-       elif status_code == 620:
-           raise GTooManyQueriesError("The given key has gone over the 
requests limit in the 24 hour period or has submitted too many requests in too 
short a period of time.")
-       return None
+    places = doc.get('results', [])
 
-    if exactly_one and len(places) != 1:
-       raise ValueError("Didn't find exactly one placemark! (Found %d.)" % 
len(places))
+    if not places:
+       check_status(doc.get('status'))
+       return None
 
     def parse_place(place):
-       location = place.get('address')
-       longitude, latitude = place['Point']['coordinates'][:2]
+       location = place.get('formatted_address')
+       latitude = place['geometry']['location']['lat']
+       longitude = place['geometry']['location']['lng']
        return (location, (latitude, longitude))
 
     if exactly_one:
@@ -204,8 +192,6 @@ class staticmap:
                "maptype":"%s" % (self.maptype),
                "sensor":"false"
            }
-           if (GOOGLE_API_KEY):
-               req_par['key'] = GOOGLE_API_KEY
            if (self.showmarker == True):
                req_par['markers'] = self.marker
            else:
@@ -249,7 +235,7 @@ if (__name__ == "__main__"):
        sys.exit(1)
 
     try:
-       places = geocode("%s %s" % (lat, lon), False)
+       places = geocode("%s,%s" % (lat, lon), False)
        for p in places:
            print places
 
diff --git a/plugin.image.iphoto/resources/lib/iphoto_parser.py 
b/plugin.image.iphoto/resources/lib/iphoto_parser.py
index f4db631..726b717 100644
--- a/plugin.image.iphoto/resources/lib/iphoto_parser.py
+++ b/plugin.image.iphoto/resources/lib/iphoto_parser.py
@@ -835,7 +835,7 @@ class IPhotoDB:
                                break
                        if (addr is None):
                            updateProgress("Geocode: %s %s" % (lat, lon))
-                           addr = geocode("%s %s" % (lat, lon))[0]
+                           addr = geocode("%s,%s" % (lat, lon))[0]
                            updateProgress()
 
                            for i in self.placeList:
@@ -1078,30 +1078,35 @@ class IPhotoParser:
                    pass
 
            if (self.AlbumCallback and len(self.albumList) > 0):
+               print "iphoto.parser: Adding albums to database"
                for a in self.albumList:
                    self.AlbumCallback(a, self.albumIgn)
                    state.nphotos += 1
                    self.updateProgress()
 
            if (self.RollCallback and len(self.rollList) > 0):
+               print "iphoto.parser: Adding events to database"
                for a in self.rollList:
                    self.RollCallback(a)
                    state.nphotos += 1
                    self.updateProgress()
 
            if (self.FaceCallback and len(self.faceList) > 0):
+               print "iphoto.parser: Adding faces to database"
                for a in self.faceList:
                    self.FaceCallback(a)
                    state.nphotos += 1
                    self.updateProgress()
 
            if (self.KeywordCallback and len(self.keywordList) > 0):
+               print "iphoto.parser: Adding keywords to database"
                for a in self.keywordList:
                    self.KeywordCallback(a)
                    state.nphotos += 1
                    self.updateProgress()
 
            if (self.PhotoCallback and len(self.photoList) > 0):
+               print "iphoto.parser: Adding photos to database"
                for a in self.photoList:
                    self.PhotoCallback(a, self.imagePath, self.libraryPath, 
self.mastersPath, self.mastersRealPath, self.enablePlaces, self.mapAspect, 
self.updateProgress)
                    state.nphotos += 1

-----------------------------------------------------------------------

Summary of changes:
 plugin.image.iphoto/addon.xml                      |    3 +-
 plugin.image.iphoto/changelog.txt                  |    3 +
 plugin.image.iphoto/resources/__init__.py          |    2 +-
 plugin.image.iphoto/resources/lib/__init__.py      |    2 +-
 plugin.image.iphoto/resources/lib/geo.py           |   60 ++++++++------------
 plugin.image.iphoto/resources/lib/iphoto_parser.py |    7 ++-
 6 files changed, 36 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to