Kodi Community Forum
Release MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Picture Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=150)
+---- Thread: Release MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags (/showthread.php?tid=133905)



RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - rafikW - 2022-02-14

(2022-02-14, 13:43)Xycl Wrote: There is a new version 19.2.2 which supports MySql and Maria dB.

If the update fails then you must delete all sub-folders in the addons/temp folder
On Windows the path is:  C:\Users\USER_NAME\AppData\Roaming\Kodi\addons\temp
In this case you find in Kodi's log file something like:
Quote:ERROR <general>: XFILE::CFile::Rename - Error renaming file  C:\Users\USER_NAME\AppData\Roaming\Kodi\addons\plugin.image.mypicsdb2
ERROR <general>: Failed to move old addon files from ' C:\Users\USER_NAME\AppData\Roaming\Kodi\addons\plugin.image.mypicsdb2' to ' C:\Users\USER_NAME\AppData\Roaming\Kodi\addons\temp\19defdd5-ecce-4669-9e75-cf8fe33d6f40'
I have my Kodi's instances running on HTC devices, so no Windows user here :-)
Anyway: upgrade to 19.2.2 went without issues.
How to perform DB migration/upgrade without loosing current data in MyPictures.db? Is it even possible?
When I change a database from SqLite to MySql providing the name of the database, IP address of my NAS where MariaDB is installed then what will happen?
Would it be just that new DB is created without transferring a data from existing MyPictures.db?


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - Xycl - 2022-02-14

There is no migration between Sqlite and MySql.
You must enter your pciture paths and rescan the directories.

But if you have an old MyPicsDB MySql database then it'll be updated!


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - Xycl - 2022-02-14

(2022-02-14, 15:58)rafikW Wrote: Would it be just that new DB is created without transferring a data from existing MyPictures.db?

You must create the DB. It is not automatically created. It's described in README.md


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - Xycl - 2022-02-14

(2021-05-19, 15:48)JockeSve Wrote: @Xycl 
Whenever You need testing of MySQL/MariaDB users I'm more than glad to help!
Both with upgrade from Python 2  version and/or with new DB instance.

Please check the update from MyPicsDB Leia to Matrix with your MySql/MariaDB instance.


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - Xycl - 2022-02-14

(2022-01-28, 21:37)vladimir_genov Wrote: Hello Xycl, and thank you for the great plugin! 
It makes Kodi (and any TV-attached device that can run it) the best option for a universal home photo collection player that follows the metadata standards! 

Although the filtering capabilities are amazing, personally I'd also like to have the metadata exposed during photo display, e.g. OSD.
I do understand that your focus is the DB and filtering aspect, and the display part is left to skinners, but at the end there isn't any skin I'm aware of that uses the metadata collected by your plugin.
That is why I'm trying to adjust the slideshow.xml by playing with labels, e.g.:
<label>$INFO[slideshow.caption]</label>

Since Kodi is only indexing the EXIF/IPTC metadata, the Window properties available to $INFO cannot make use of the XMP tags indexed by MypicsDB.

Can you suggest a way to call the MypicsDB.py/MyPictureDB object and "ask" it to provide a list of specific tags for a given photo? (Photo file details are available as $INFO properties in slideshow.xml and can be used as arguments, I suppose).
I'm specifically interested in the list of xmp people tags, i.e. I would like to expose in OSD the names of the people that are present on the photo.
Or any other way to have the metadata exposed to the Window object?

Thanks in advance for your recommendations!

Can you post here an example slideshow.xml which e.g. outputs "here is the person name"?
Then I can use this to test the possibilities.


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - rafikW - 2022-02-14

(2022-02-14, 16:45)Xycl Wrote:
(2021-05-19, 15:48)JockeSve Wrote: @Xycl 
Whenever You need testing of MySQL/MariaDB users I'm more than glad to help!
Both with upgrade from Python 2  version and/or with new DB instance.

Please check the update from MyPicsDB Leia to Matrix with your MySql/MariaDB instance.

Database created, scanning in progress, it should be completed within 2-3 hours I guess.
Thanks for maintaining this add-on :-)


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - vladimir_genov - 2022-02-15

(2022-02-14, 17:18)Xycl Wrote:
(2022-01-28, 21:37)vladimir_genov Wrote: Hello Xycl, and thank you for the great plugin! 
It makes Kodi (and any TV-attached device that can run it) the best option for a universal home photo collection player that follows the metadata standards! 

Although the filtering capabilities are amazing, personally I'd also like to have the metadata exposed during photo display, e.g. OSD.
I do understand that your focus is the DB and filtering aspect, and the display part is left to skinners, but at the end there isn't any skin I'm aware of that uses the metadata collected by your plugin.
That is why I'm trying to adjust the slideshow.xml by playing with labels, e.g.:
<label>$INFO[slideshow.caption]</label>

Since Kodi is only indexing the EXIF/IPTC metadata, the Window properties available to $INFO cannot make use of the XMP tags indexed by MypicsDB.

Can you suggest a way to call the MypicsDB.py/MyPictureDB object and "ask" it to provide a list of specific tags for a given photo? (Photo file details are available as $INFO properties in slideshow.xml and can be used as arguments, I suppose).
I'm specifically interested in the list of xmp people tags, i.e. I would like to expose in OSD the names of the people that are present on the photo.
Or any other way to have the metadata exposed to the Window object?

Thanks in advance for your recommendations!

Can you post here an example slideshow.xml which e.g. outputs "here is the person name"?
Then I can use this to test the possibilities.
Hi, pliease find a sample AppData\Roaming\Kodi\addons\skin.confluence\720p\SlideShow.xml:
xml:

<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol>2</defaultcontrol>
<controls>
<control type="label">
<description>Picture comment</description>
<posx>0</posx>
<posy>567</posy>
<width>1280</width>
<height>55</height>
<align>center</align>
<aligny>center</aligny>
<font>!font10</font>
<font>font20</font>
<textcolor>white</textcolor>
<label>$INFO[slideshow.caption][CR]$INFO[slideshow.exifdate] - $INFO[slideshow.city] $INFO[slideshow.sublocation][CR]$INFO[Slideshow.keywords]</label>
</control>
</controls>
</window>

A possible implementation may be an improvement of the existing "setproperties" action (as per Mike's post in the 1st page of this thread 10 years ago), that could add the paths as keys and tag values to the Window object upon starting a slideshow.
Then the Slideshow could use them by something like $INFO[Window.Property(Slideshow.path)] in the <label> element above.

If face tags coordinates are also added, skinners may use it to draw rectangular frames around each tagged person's face... Smile


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - rockrider69 - 2022-02-16

(2022-02-14, 13:43)Xycl Wrote: There is a new version 19.2.2which supports MySql and Maria dB.
Hello and thanks you for keeping the addon alive !

I am still using Sqlite but I installed the new version because I like to keep my addons up to date.

All is working fine for me except the below error messages I get in the kodi.log at the end of all usage of the addon : select and display pictures, or like is this example refreshing the DB.
Hopefully it looks like an ignored exception, related to some DB closing instructions, probably not valid for Sqlite ?

No hurry as far as I can see, the addon is still working but maybe something to look into.
 
Quote:2022-02-15 23:56:09.321 T:28839    INFO <general>: [My Pictures Database] line   604 in scanpath.py object scanpath >> started
2022-02-15 23:56:09.352 T:28839    INFO <general>: [My Pictures Database] line   105 in scanpath.py object VFSScanner.dispatcher >> dispatcher started
2022-02-15 23:56:09.353 T:28839    INFO <general>: [My Pictures Database] line   127 in scanpath.py object VFSScanner.dispatcher >> Database refresh started
2022-02-15 23:57:24.577 T:29247    INFO <general>: initializing python engine.
2022-02-15 23:57:29.244 T:27931    INFO <general>: Loading skin file: /home/osmc/.kodi/addons/screensaver.bing/resources/skins/default/1080i/default.xml, load type: LOAD_ON_GUI_INIT
2022-02-15 23:57:29.247 T:27931 WARNING <general>: Skin has invalid include: contentpanelslide
2022-02-15 23:57:29.250 T:27931   ERROR <general>: Control 101 in window 13001 has been asked to focus, but it can't
2022-02-15 23:58:29.153 T:28839    INFO <general>: [My Pictures Database] line   159 in scanpath.py object VFSScanner.dispatcher >> 42958 scanned / 0 added / 0 deleted / 0 modified
2022-02-15 23:58:29.161 T:28839   ERROR <general>: Exception ignored in: 
2022-02-15 23:58:29.161 T:28839   ERROR <general>: <function MyPictureDB.__del__ at 0xc0d366a8>
2022-02-15 23:58:29.161 T:28839   ERROR <general>: 
                                                   
2022-02-15 23:58:29.162 T:28839   ERROR <general>: Traceback (most recent call last):
                                                   
2022-02-15 23:58:29.162 T:28839   ERROR <general>:   File "/home/osmc/.kodi/addons/script.service.mypicsdb2/../plugin.image.mypicsdb2/resources/lib/MypicsDB.py", line 77, in __del__
                                                   
2022-02-15 23:58:29.163 T:28839   ERROR <general>:     
2022-02-15 23:58:29.163 T:28839   ERROR <general>: self.cur.close()
2022-02-15 23:58:29.163 T:28839   ERROR <general>: 
                                                   
2022-02-15 23:58:29.163 T:28839   ERROR <general>:   File "/home/osmc/.kodi/addons/script.service.mypicsdb2/../plugin.image.mypicsdb2/resources/lib/dbabstractionlayer.py", line 192, in close
                                                   
2022-02-15 23:58:29.164 T:28839   ERROR <general>:     
2022-02-15 23:58:29.165 T:28839   ERROR <general>: self.cursor.close()
2022-02-15 23:58:29.165 T:28839   ERROR <general>: 
                                                   
2022-02-15 23:58:29.165 T:28839   ERROR <general>: sqlite3
2022-02-15 23:58:29.165 T:28839   ERROR <general>: .
2022-02-15 23:58:29.165 T:28839   ERROR <general>: ProgrammingError
2022-02-15 23:58:29.165 T:28839   ERROR <general>: : 
2022-02-15 23:58:29.165 T:28839   ERROR <general>: Cannot operate on a closed database.
2022-02-15 23:58:29.165 T:28839   ERROR <general>: 
                                                   
2022-02-15 23:58:29.165 T:28839    INFO <general>: CPythonInvoker(90, /home/osmc/.kodi/addons/script.service.mypicsdb2/../plugin.image.mypicsdb2/scanpath.py): script successfully run



RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - Xycl - 2022-02-18

(2022-02-16, 19:50)rockrider69 Wrote: Hello and thanks you for keeping the addon alive !

I am still using Sqlite but I installed the new version because I like to keep my addons up to date.

All is working fine for me except the below error messages I get in the kodi.log at the end of all usage of the addon : select and display pictures, or like is this example refreshing the DB.
Hopefully it looks like an ignored exception, related to some DB closing instructions, probably not valid for Sqlite ?

No hurry as far as I can see, the addon is still working but maybe something to look into.

Fixed with version 19.2.3


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - rockrider69 - 2022-02-18

19.2.3 installed and yes this is fixed !
Thx a lot that was fast  Wink


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - Xycl - 2022-02-25

(2022-02-15, 17:23)vladimir_genov Wrote: A possible implementation may be an improvement of the existing "setproperties" action (as per Mike's post in the 1st page of this thread 10 years ago), that could add the paths as keys and tag values to the Window object upon starting a slideshow.
Then the Slideshow could use them by something like $INFO[Window.Property(Slideshow.path)] in the <label> element above.

If face tags coordinates are also added, skinners may use it to draw rectangular frames around each tagged person's face... Smile

 I added a list item property called mypicsdb_person.
Quote:                persons = MPDB.get_pic_persons(picpath,picname)
                liz.setProperty('mypicsdb_person', persons ) 

and added $INFO[listitem.property(mypicsdb_person)] to your slideshow.xml
liz is the list item.

Problem: When you display "one" picture (pressing return on this picture) then you'll get the correct persons, but when you then press the left or right cursor to get the previous or next picture the property value isn't refreshed. The same happens with a slideshow.

Perhaps a bug or I don't know enough about Kodi.


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - vladimir_genov - 2022-03-07

Looks like the new
xml:
$INFO[listitem.property(mypicsdb_person)]
works perfectly fine in the context of list items, i.e. when showing a list of photos.

I have edited AppData\Roaming\Kodi\addons\skin.confluence\720p\ViewsPictures.xml by replacing the label for the picture resolution:
xml:
<label>$INFO[ListItem.PictureResolution,$LOCALIZE[31327] - ]</label>
with:
xml:
<label>$INFO[listitem.property(mypicsdb_person)]</label>

Then navigated to a list of photos within MyPicsDB plugin, and selected the "Pic thumbs" view mode on the left. When hovering the mouse over photo thumbnails, the photo preview on the right shows the correct people for each photo.

As far as I understand, Slideshow does not use listitems, but a specific set of Slideshow info labels (https://kodi.wiki/view/InfoLabels#Slideshow) that are set by Kodi's https://github.com/xbmc/xbmc/blob/master/xbmc/GUIInfoManager.cpp. I suppose the ultimate solution would be a pull request for GUIInfoManager.cpp to read XMP tags and populate them as Slideshow.* labels, but this most likely falls outside the scope of your plugin Smile

I tried to use the new MPDB.get_pic_persons() in the following two scenarios, but failed in both:

- populate WINDOW property for each photo during listitem generation in default.py:

python:
                persons = MPDB.get_pic_persons(picpath,picname)
                WINDOW = xbmcgui.Window( 10000 )
                WINDOW.setProperty ( picname, persons )
                common.log("Main.add_picture: window", WINDOW.getProperty(picname))
                liz.setProperty('mypicsdb_person', persons ) 
                liz.setInfo( type="pictures", infoLabels=infolabels  

Then trying to use it in SlideShow.xml:
xml:
<label>$INFO[Window(10000).Property(Slideshow.Filename)]</label>

Result: nothing gets displayed during Slideshow. 
I suppose I lack knowledge about how Slideshow uses such custom Window objects from Kodi, because some predefined ones are displayed just fine.

- exposing MPDB.get_pic_persons() outside the plugin, again in default.py:

python:
    def getpersons(self):
        picpath = m.args.picpath
        picname    = m.args.picname
        common.log("getpersons args: ", picpath, picname)        
        persons = MPDB.get_pic_persons(picpath,picname)        
        common.log("getpersons db result: ", persons)
        return persons    

and 

python:
    elif m.args.action=='getpersons':
        m.getpersons()    

Then trying to call it using
xml:
RunScript(plugin.image.mypicsdb2,0,?action='getpersons'&picpath=$INFO[Slideshow.Path]&picname=$INFO[Slideshow.Filename])
in <label> in Slideshow.xml.
Result: "0" displayed as label and nothing logged by default.py in the log, i.e. I lack knowledge about how to use RunScript in <label>.

Any suggestions how to make these work?


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - maaaatteo - 2022-04-21

(2022-02-14, 11:10)rafikW Wrote:
(2021-04-20, 08:59)Xycl Wrote: I forgot to say: Currently MySql or MariaDB are not supported.
Don't even try to use them.
Is there a plan to implement a support for centralized database?
In case you have more than one kodi device it would be nice to have your MyPicsDB database on your NAS :-)
agree with @rafikW !!! that would be awesome


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - maaaatteo - 2022-04-21

or at least short hints how to copy local database from one device to another


RE: MyPicsDB: Pictures DB with EXIF, IPTC & XMP tags - rafikW - 2022-04-21

(2022-04-21, 17:22)maaaatteo Wrote:
(2022-02-14, 11:10)rafikW Wrote:
(2021-04-20, 08:59)Xycl Wrote: I forgot to say: Currently MySql or MariaDB are not supported.
Don't even try to use them.
Is there a plan to implement a support for centralized database?
In case you have more than one kodi device it would be nice to have your MyPicsDB database on your NAS :-)
agree with @rafikW !!! that would be awesome
If you read more posts you will find out that there is central database already supported since 19.2.2 version.
Even if you have thousands of pictures scanning will takes few hours so an effort on how to copy records from local database to the central one is not justified.
Just install add-on, configure it to use central database on your NAS and start scanning. Period.