The branch, dharma has been updated
via 52df04630e8d168e84ae990a4891cd87aa86733e (commit)
via 47cab2dc024062b7c62e37ab7e03111abb52cd78 (commit)
from 7930fa697de274c14b423e066076391cbebf57f4 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=52df04630e8d168e84ae990a4891cd87aa86733e
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=47cab2dc024062b7c62e37ab7e03111abb52cd78
commit 47cab2dc024062b7c62e37ab7e03111abb52cd78
Author: spiff <[email protected]>
Date: Mon Apr 4 18:08:45 2011 +0200
[plugin.image.iphoto] updated to version 1.4.3
diff --git a/plugin.image.iphoto/addon.py b/plugin.image.iphoto/addon.py
index 87b5bc5..9090b6f 100644
--- a/plugin.image.iphoto/addon.py
+++ b/plugin.image.iphoto/addon.py
@@ -27,6 +27,7 @@ import xbmcaddon
# copyfile = xbmcvfs.copy
addon = xbmcaddon.Addon(id="plugin.image.iphoto")
+ALBUM_DATA_XML = "AlbumData.xml"
BASE_URL = "%s" % (sys.argv[0])
PLUGIN_PATH = addon.getAddonInfo("path")
RESOURCE_PATH = os.path.join(PLUGIN_PATH, "resources")
@@ -40,6 +41,8 @@ db = IPhotoDB(db_file)
apple_epoch = 978307200
+view_mode = 0
+
# ignore empty albums if configured to do so
album_ign_empty = addon.getSetting('album_ignore_empty')
if (album_ign_empty == ""):
@@ -63,6 +66,8 @@ else:
def render_media(media):
+ global view_mode
+
# default view in Confluence
view_mode = addon.getSetting('view_mode')
if (view_mode == ""):
@@ -100,8 +105,6 @@ def render_media(media):
if sort_date == True:
plugin.addSortMethod(int(sys.argv[1]), plugin.SORT_METHOD_DATE)
- if view_mode > 0:
- xbmc.executebuiltin("Container.SetViewMode(%d)" % (view_mode + 509))
return n
def list_photos_in_album(params):
@@ -281,7 +284,7 @@ def list_places(params):
else:
item = gui.ListItem(address, latlon)
- item.addContextMenuItems([(addon.getLocalizedString(30215),
"XBMC.PlayMedia(\""+BASE_URL+"?action=rm_caches\")",)])
+ item.addContextMenuItems([(addon.getLocalizedString(30215),
"XBMC.RunPlugin(\""+BASE_URL+"?action=rm_caches\")",)])
if (thumbpath):
item.setThumbnailImage(thumbpath)
@@ -331,7 +334,7 @@ def list_keywords(params):
continue
item = gui.ListItem(name)
- item.addContextMenuItems([(addon.getLocalizedString(30214),
"XBMC.PlayMedia(\""+BASE_URL+"?action=hidekeyword&keyword=%s\")" % (name),)])
+ item.addContextMenuItems([(addon.getLocalizedString(30214),
"XBMC.RunPlugin(\""+BASE_URL+"?action=hidekeyword&keyword=%s\")" % (name),)])
if (count):
item.setInfo(type="pictures", infoLabels={ "count": count })
plugin.addDirectoryItem(handle = int(sys.argv[1]),
url=BASE_URL+"?action=keywords&keywordid=%s" % (keywordid), listitem = item,
isFolder = True)
@@ -465,18 +468,24 @@ def get_params(paramstring):
return params
def add_import_lib_context_item(item):
- item.addContextMenuItems([(addon.getLocalizedString(30213),
"XBMC.PlayMedia(\""+BASE_URL+"?action=rescan\")",)])
+ item.addContextMenuItems([(addon.getLocalizedString(30213),
"XBMC.RunPlugin(\""+BASE_URL+"?action=rescan\")",)])
if (__name__ == "__main__"):
- xmlfile = addon.getSetting('albumdata_xml_path')
- if (xmlfile == ""):
+ xmlpath = addon.getSetting('albumdata_xml_path')
+ if (xmlpath == ""):
try:
- xmlfile = os.getenv("HOME") + "/Pictures/iPhoto
Library/AlbumData.xml"
- addon.setSetting('albumdata_xml_path', xmlfile)
+ xmlpath = os.getenv("HOME") + "/Pictures/iPhoto Library/"
+ addon.setSetting('albumdata_xml_path', xmlpath)
except:
pass
- xmlpath = os.path.dirname(xmlfile)
- origxml = xmlfile
+
+ # we used to store the file path to the XML instead of the iPhoto Library
+ # directory.
+ if (os.path.basename(xmlpath) == ALBUM_DATA_XML):
+ xmlpath = os.path.dirname(xmlpath)
+ addon.setSetting('albumdata_xml_path', xmlpath)
+
+ origxml = os.path.join(xmlpath, ALBUM_DATA_XML)
xmlfile = xbmc.translatePath(os.path.join(addon.getAddonInfo("Profile"),
"iphoto.xml"))
shutil.copyfile(origxml, xmlfile)
shutil.copystat(origxml, xmlfile)
@@ -495,33 +504,33 @@ if (__name__ == "__main__"):
# main menu
try:
item = gui.ListItem(addon.getLocalizedString(30100),
thumbnailImage=ICONS_PATH+"/events.png")
- item.setInfo(type="pictures", infoLabels={ "Title": "Events" })
+ item.setInfo(type="pictures", infoLabels={ "title": "Events" })
add_import_lib_context_item(item)
plugin.addDirectoryItem(int(sys.argv[1]),
BASE_URL+"?action=events", item, True)
item = gui.ListItem(addon.getLocalizedString(30101),
thumbnailImage=ICONS_PATH+"/albums.png")
- item.setInfo(type="pictures", infoLabels={ "Title": "Albums" })
+ item.setInfo(type="pictures", infoLabels={ "title": "Albums" })
add_import_lib_context_item(item)
plugin.addDirectoryItem(int(sys.argv[1]),
BASE_URL+"?action=albums", item, True)
item = gui.ListItem(addon.getLocalizedString(30105),
thumbnailImage=ICONS_PATH+"/faces.png")
- item.setInfo(type="pictures", infoLabels={ "Title": "Faces" })
+ item.setInfo(type="pictures", infoLabels={ "title": "Faces" })
add_import_lib_context_item(item)
plugin.addDirectoryItem(int(sys.argv[1]), BASE_URL+"?action=faces",
item, True)
item = gui.ListItem(addon.getLocalizedString(30106),
thumbnailImage=ICONS_PATH+"/places.png")
- item.setInfo(type="pictures", infoLabels={ "Title": "Places" })
+ item.setInfo(type="pictures", infoLabels={ "title": "Places" })
add_import_lib_context_item(item)
- item.addContextMenuItems([(addon.getLocalizedString(30215),
"XBMC.PlayMedia(\""+BASE_URL+"?action=rm_caches\")",)])
+ item.addContextMenuItems([(addon.getLocalizedString(30215),
"XBMC.RunPlugin(\""+BASE_URL+"?action=rm_caches\")",)])
plugin.addDirectoryItem(int(sys.argv[1]),
BASE_URL+"?action=places", item, True)
item = gui.ListItem(addon.getLocalizedString(30104),
thumbnailImage=ICONS_PATH+"/keywords.png")
- item.setInfo(type="pictures", infoLabels={ "Title": "Keywords" })
+ item.setInfo(type="pictures", infoLabels={ "title": "Keywords" })
add_import_lib_context_item(item)
plugin.addDirectoryItem(int(sys.argv[1]),
BASE_URL+"?action=keywords", item, True)
item = gui.ListItem(addon.getLocalizedString(30102),
thumbnailImage=ICONS_PATH+"/star.png")
- item.setInfo(type="pictures", infoLabels={ "Title": "Ratings" })
+ item.setInfo(type="pictures", infoLabels={ "title": "Ratings" })
add_import_lib_context_item(item)
plugin.addDirectoryItem(int(sys.argv[1]),
BASE_URL+"?action=ratings", item, True)
@@ -585,3 +594,6 @@ if (__name__ == "__main__"):
if (items):
plugin.endOfDirectory(int(sys.argv[1]), True)
+ if view_mode > 0:
+ xbmc.sleep(300)
+ xbmc.executebuiltin("Container.SetViewMode(%d)" % (view_mode +
509))
diff --git a/plugin.image.iphoto/addon.xml b/plugin.image.iphoto/addon.xml
index 9b37740..384b888 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="1.4.2"
provider-name="jingai">
+<addon id="plugin.image.iphoto" name="iPhoto" version="1.4.3"
provider-name="jingai">
<requires>
<import addon="xbmc.python" version="1.0"/>
<import addon="script.module.pysqlite" version="2.5.6"/>
diff --git a/plugin.image.iphoto/changelog.txt
b/plugin.image.iphoto/changelog.txt
index e9691f8..e68b851 100644
--- a/plugin.image.iphoto/changelog.txt
+++ b/plugin.image.iphoto/changelog.txt
@@ -1,3 +1,8 @@
+1.4.3 - 20110331
+- Faces: Use same thumbnails as iPhoto.
+- Add Spanish strings (thanks Oriol Gamero).
+- Don't set view mode for empty albums.
+
1.4.2 - 20110327
- Implement proper JSON parser for Google Maps geocoding.
diff --git a/plugin.image.iphoto/resources/language/English/strings.xml
b/plugin.image.iphoto/resources/language/English/strings.xml
index 3386ecb..c82b297 100644
--- a/plugin.image.iphoto/resources/language/English/strings.xml
+++ b/plugin.image.iphoto/resources/language/English/strings.xml
@@ -4,7 +4,7 @@
<string id="30200">%d star</string>
<string id="30210">Importing iPhoto Library</string>
<string id="30211">Imported %d items</string>
- <string id="30212">Scanning AlbumData.xml...</string>
+ <string id="30212">Scanning iPhoto database...</string>
<string id="30213">Update library</string>
<string id="30214">Ignore Keyword</string>
<string id="30215">Remove cached maps</string>
@@ -23,7 +23,7 @@
<string id="30106">Places</string>
<!-- Plugin settings strings -->
- <string id="30000">Path to AlbumData.xml</string>
+ <string id="30000">Path to iPhoto Library</string>
<string id="30001">Ignore published (MobileMe) albums</string>
<string id="30002">Ignore 'Flagged' album</string>
<string id="30003">Auto update library</string>
diff --git a/plugin.image.iphoto/resources/lib/iphoto_parser.py
b/plugin.image.iphoto/resources/lib/iphoto_parser.py
index 00d3609..d0196bd 100644
--- a/plugin.image.iphoto/resources/lib/iphoto_parser.py
+++ b/plugin.image.iphoto/resources/lib/iphoto_parser.py
@@ -180,7 +180,9 @@ class IPhotoDB:
CREATE TABLE faces (
id integer primary key,
name varchar,
+ thumbpath varchar,
keyphotoid integer,
+ keyphotoidx integer,
photocount integer,
faceorder integer
)""")
@@ -265,11 +267,9 @@ class IPhotoDB:
def GetConfig(self, key):
try:
cur = self.dbconn.cursor()
- cur.execute("""SELECT value
- FROM config
- WHERE key = ? LIMIT 1""",
- (key,))
+ cur.execute("""SELECT value FROM config WHERE key = ? LIMIT 1""",
(key,))
row = cur.fetchone()
+ cur.close()
if (row):
return row[0]
return None
@@ -277,16 +277,10 @@ class IPhotoDB:
return None
def SetConfig(self, key, value):
- cur = self.dbconn.cursor()
if (self.GetConfig(key) == None):
- cur.execute("""INSERT INTO config (key, value)
- VALUES (?, ?)""",
- (key, value))
+ self.dbconn.execute("""INSERT INTO config (key, value) VALUES (?,
?)""", (key, value))
else:
- cur.execute("""UPDATE config
- SET value = ?
- WHERE key = ?""",
- (value, key))
+ self.dbconn.execute("""UPDATE config SET value = ? WHERE key =
?""", (value, key))
self.Commit()
def UpdateLastImport(self):
@@ -318,7 +312,9 @@ class IPhotoDB:
nextid += 1
cur.execute("INSERT INTO %s (id, %s) VALUES (?, ?)" % (table,
column),
(nextid, value))
+ cur.close()
return nextid # return new id
+ cur.close()
return row[0] # return id
except Exception, e:
print to_str(e)
@@ -334,6 +330,7 @@ class IPhotoDB:
cur.execute("SELECT id, name, photocount FROM albums")
for tuple in cur:
albums.append(tuple)
+ cur.close()
except:
pass
return albums
@@ -349,6 +346,7 @@ class IPhotoDB:
WHERE A.albumid = ? ORDER BY %s ASC""" % (sort_col),
(albumid,))
for tuple in cur:
media.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -362,6 +360,7 @@ class IPhotoDB:
FROM rolls R LEFT JOIN media M ON R.keyphotoid =
M.id""")
for tuple in cur:
rolls.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -377,6 +376,7 @@ class IPhotoDB:
FROM media M WHERE M.rollid = ? ORDER BY %s ASC""" %
(sort_col), (rollid,))
for tuple in cur:
media.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -386,11 +386,12 @@ class IPhotoDB:
faces = []
try:
cur = self.dbconn.cursor()
- cur.execute("""SELECT F.id, F.name, M.thumbpath, F.photocount
+ cur.execute("""SELECT F.id, F.name, F.thumbpath, F.photocount
FROM faces F LEFT JOIN media M ON F.keyphotoid = M.id
ORDER BY F.faceorder""")
for tuple in cur:
faces.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -407,6 +408,7 @@ class IPhotoDB:
WHERE A.faceid = ? ORDER BY %s ASC""" % (sort_col),
(faceid,))
for tuple in cur:
media.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -419,6 +421,7 @@ class IPhotoDB:
cur.execute("SELECT id, latlon, address, thumbpath, fanartpath,
photocount FROM places")
for tuple in cur:
places.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -435,6 +438,7 @@ class IPhotoDB:
WHERE A.placeid = ? ORDER BY %s ASC""" % (sort_col),
(placeid,))
for tuple in cur:
media.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -447,6 +451,7 @@ class IPhotoDB:
cur.execute("SELECT id, name, photocount FROM keywords ORDER BY
name")
for tuple in cur:
keywords.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -463,6 +468,7 @@ class IPhotoDB:
WHERE A.keywordid = ? ORDER BY %s ASC""" % (sort_col),
(keywordid,))
for tuple in cur:
media.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -478,6 +484,7 @@ class IPhotoDB:
FROM media M WHERE M.rating = ? ORDER BY %s ASC""" %
(sort_col), (rating,))
for tuple in cur:
media.append(tuple)
+ cur.close()
except Exception, e:
print to_str(e)
pass
@@ -550,11 +557,12 @@ class IPhotoDB:
try:
self.dbconn.execute("""
- INSERT INTO faces (id, name, keyphotoid, photocount, faceorder)
- VALUES (?, ?, ?, ?, ?)""",
+ INSERT INTO faces (id, name, keyphotoid, keyphotoidx, photocount,
faceorder)
+ VALUES (?, ?, ?, ?, ?, ?)""",
(faceid,
face['name'],
face['key image'],
+ face['key image face index'],
face['PhotoCount'],
face['Order']))
except sqlite.IntegrityError:
@@ -615,7 +623,26 @@ class IPhotoDB:
pass
try:
- self.dbconn.execute("""
+ cur = self.dbconn.cursor()
+
+ faces = []
+ cur.execute("""SELECT id, keyphotoid, keyphotoidx FROM faces""")
+ for tuple in cur:
+ faces.append(tuple)
+
+ for faceid in media['facelist']:
+ cur.execute("""
+ INSERT INTO facesmedia (faceid, mediaid)
+ VALUES (?, ?)""", (faceid, mediaid))
+
+ for fid, fkey, fkeyidx in faces:
+ if int(fkey) == int(mediaid):
+ fthumb = os.path.splitext(thumbpath)[0] + "_face%s.jpg"
% (fkeyidx)
+ self.dbconn.execute("""
+ UPDATE faces SET thumbpath = ?
+ WHERE id = ?""", (fthumb, fid))
+
+ cur.execute("""
INSERT INTO media (id, mediatypeid, rollid, caption, guid,
aspectratio, latitude, longitude, rating, mediadate, mediasize, mediapath,
thumbpath, originalpath)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
(mediaid,
@@ -633,11 +660,6 @@ class IPhotoDB:
thumbpath,
originalpath))
- for faceid in media['facelist']:
- self.dbconn.execute("""
- INSERT INTO facesmedia (faceid, mediaid)
- VALUES (?, ?)""", (faceid, mediaid))
-
if enablePlaces == True:
# convert lat/lon pair to an address
try:
@@ -700,7 +722,7 @@ class IPhotoDB:
# add new Place
self.placeList[placeid].append(addr)
- self.dbconn.execute("""
+ cur.execute("""
INSERT INTO places (id, latlon, address, thumbpath,
fanartpath)
VALUES (?, ?, ?, ?, ?)""", (placeid, latlon, addr,
thumbpath, fanartpath))
@@ -710,10 +732,9 @@ class IPhotoDB:
# than necessary.
self.placeList[placeid].append(latlon)
- self.dbconn.execute("""
+ cur.execute("""
INSERT INTO placesmedia (placeid, mediaid)
VALUES (?, ?)""", (placeid, mediaid))
- cur = self.dbconn.cursor()
cur.execute("""SELECT id, photocount
FROM places
WHERE id = ?""", (placeid,))
@@ -727,10 +748,9 @@ class IPhotoDB:
WHERE id = ?""", (photocount, placeid))
for keywordid in media['keywordlist']:
- self.dbconn.execute("""
+ cur.execute("""
INSERT INTO keywordmedia (keywordid, mediaid)
VALUES (?, ?)""", (keywordid, mediaid))
- cur = self.dbconn.cursor()
cur.execute("""SELECT id, photocount
FROM keywords
WHERE id = ?""", (keywordid,))
@@ -742,6 +762,8 @@ class IPhotoDB:
self.dbconn.execute("""
UPDATE keywords SET photocount = ?
WHERE id = ?""", (photocount, keywordid))
+
+ cur.close()
except sqlite.IntegrityError:
pass
except Exception, e:
diff --git a/plugin.image.iphoto/resources/settings.xml
b/plugin.image.iphoto/resources/settings.xml
index c5c267a..9860f4e 100644
--- a/plugin.image.iphoto/resources/settings.xml
+++ b/plugin.image.iphoto/resources/settings.xml
@@ -2,7 +2,7 @@
<settings>
<!-- General -->
<category label="30050">
- <setting id="albumdata_xml_path" type="file" source="video"
label="30000" default=""/>
+ <setting id="albumdata_xml_path" type="folder" source="video"
label="30000" default=""/>
<setting id="places_enable" type="bool" label="30015" default="true"/>
<setting id="places_enable_maps" type="bool" label="30025"
default="true" enable="eq(-1,true)"/>
<setting id="auto_update_lib" type="bool" label="30003"
default="false"/>
-----------------------------------------------------------------------
Summary of changes:
plugin.image.iphoto/addon.py | 48 ++--
plugin.image.iphoto/addon.xml | 2 +-
plugin.image.iphoto/changelog.txt | 5 +
.../resources/language/English/strings.xml | 4 +-
.../resources/language/Spanish/strings.xml | 51 ++++
plugin.image.iphoto/resources/lib/iphoto_parser.py | 74 ++++--
plugin.image.iphoto/resources/settings.xml | 2 +-
plugin.video.bms/LICENSE.txt | 282 --------------------
plugin.video.bms/addon.xml | 18 --
plugin.video.bms/default.py | 112 --------
plugin.video.bms/icon.png | Bin 67241 -> 0 bytes
plugin.video.bms/images/1.jpg | Bin 14123 -> 0 bytes
plugin.video.bms/images/10.jpg | Bin 41003 -> 0 bytes
plugin.video.bms/images/2.jpg | Bin 19953 -> 0 bytes
plugin.video.bms/images/3.jpg | Bin 33091 -> 0 bytes
plugin.video.bms/images/4.jpg | Bin 24377 -> 0 bytes
plugin.video.bms/images/5.jpg | Bin 14015 -> 0 bytes
plugin.video.bms/images/6.jpg | Bin 41239 -> 0 bytes
plugin.video.bms/images/7.jpg | Bin 21459 -> 0 bytes
plugin.video.bms/images/8.jpg | Bin 26084 -> 0 bytes
plugin.video.bms/images/9.jpg | Bin 19285 -> 0 bytes
plugin.video.bms/images/LICENSE.txt | 2 -
22 files changed, 138 insertions(+), 462 deletions(-)
create mode 100644 plugin.image.iphoto/resources/language/Spanish/strings.xml
delete mode 100644 plugin.video.bms/LICENSE.txt
delete mode 100644 plugin.video.bms/addon.xml
delete mode 100644 plugin.video.bms/default.py
delete mode 100644 plugin.video.bms/icon.png
delete mode 100644 plugin.video.bms/images/1.jpg
delete mode 100644 plugin.video.bms/images/10.jpg
delete mode 100644 plugin.video.bms/images/2.jpg
delete mode 100644 plugin.video.bms/images/3.jpg
delete mode 100644 plugin.video.bms/images/4.jpg
delete mode 100644 plugin.video.bms/images/5.jpg
delete mode 100644 plugin.video.bms/images/6.jpg
delete mode 100644 plugin.video.bms/images/7.jpg
delete mode 100644 plugin.video.bms/images/8.jpg
delete mode 100644 plugin.video.bms/images/9.jpg
delete mode 100644 plugin.video.bms/images/LICENSE.txt
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons