Kodi Community Forum
Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db (/showthread.php?tid=80845)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


- fiveisalive - 2010-11-15

solexalex Wrote:I think it is because of pics which contain something in the rating field, but this thing is not a number. or looks not like an integer number.
Can you change a bit the code for me ?
line 160 you have :
Code:
if rating: prefix = prefix + "[color=C0FFFF00]"+("*"*int(rating))+"[/color][color=C0C0C0C0]"+("*"*(5-int(rating)))+"[/color]"
Change it for :
Code:
if rating:
            print "RATING :"
            print rating
            print type(rating)
            print "----"
            prefix = prefix + "[color=C0FFFF00]"+("*"*int(rating))+"[/color][color=C0C0C0C0]"+("*"*(5-int(rating)))+"[/color]"
There should be the error but I can't figure why. The rating that my lib get should be strange, so I need to know what it is exactly.

I worked around by using a "try...except ValueError" construct, but I'll try to use your version to get the debug information for you.

Quote:I don't know which skin you are using, but the contextmenu you are talking about comes from the skin.
I'm using PM3 and I don't have such context menu while watching a picture full screen.
I can have a look but tell me what is you skin.
Anyway, you can get exifs infos while watching a picture full screen using 'O' key on the keyboard.
If you want to know exif info of a picture in a list, you can press 'I' key on your keyboard. These shortcuts, I think, are not dedicated to any skin... or not... lol

Yep, it does seem to be a skin-specific thing. This worked for me when I was using "Alaska" (at least for the standard Pictures built-in for XBMC), but doesn't work at all (even for built-in Pictures) when using Aeon MQ2. I'll check to see if "O" on the keyboard works even using Aeon MQ2.

One other bug report, when I now select "Add to Collection" using context menu, I get a crash of the entire XBMC. Will try to send a log ASAP.


- fiveisalive - 2010-11-17

solexalex Wrote:I think it is because of pics which contain something in the rating field, but this thing is not a number. or looks not like an integer number.
Can you change a bit the code for me ?
line 160 you have :
Code:
if rating: prefix = prefix + "[color=C0FFFF00]"+("*"*int(rating))+"[/color][color=C0C0C0C0]"+("*"*(5-int(rating)))+"[/color]"
Change it for :
Code:
if rating:
            print "RATING :"
            print rating
            print type(rating)
            print "----"
            prefix = prefix + "[color=C0FFFF00]"+("*"*int(rating))+"[/color][color=C0C0C0C0]"+("*"*(5-int(rating)))+"[/color]"
There should be the error but I can't figure why. The rating that my lib get should be strange, so I need to know what it is exactly.

here's what I get

Code:
23:21:28 T:139693180913424 M:2862854144  NOTICE: MyPicsDB >> SQL > SELECT "Image Rating" FROM files WHERE strPath="/home/myth/media/Pictures/NIKON_D60-2010-06-12-impor
t/100NCD60" AND strFilename="DSC_2714.JPG";
23:21:28 T:139693180913424 M:2862854144  NOTICE: RATING :
23:21:28 T:139693180913424 M:2862854144  NOTICE: Image Rating
23:21:28 T:139693180913424 M:2862854144  NOTICE: <type 'str'>
23:21:28 T:139693180913424 M:2862854144  NOTICE: ----



- solexalex - 2010-11-17

don t know if it is due to my mobile phone browser or not, but i can t see the whole log (only many notice lines but no informations behind)
I will have a look this evening on my pc.


- fiveisalive - 2010-11-17

solexalex Wrote:don t know if it is due to my mobile phone browser or not, but i can t see the whole log (only many notice lines but no informations behind)
I will have a look this evening on my pc.

Here's the extract of the log I posted above in plain text with the timestamps removed:

NOTICE: MyPicsDB >> SQL > SELECT "Image Rating" FROM files WHERE strPath="/home/myth/media/Pictures/NIKON_D60-2010-06-12-import/100NCD60" AND strFilename="DSC_2714.JPG";
NOTICE: RATING :
NOTICE: Image Rating
NOTICE: <type 'str'>
NOTICE: ----


- solexalex - 2010-11-17

OK I got it. ( My mobile phone was not showing the horizontal rule to slide the log on the right)

So it is strange... You got, instead of a int for the rating, the name of the field in the database 'Image Rating'
I updated to SVN 144 for you. I hope it solves the problem. I changed the SQLite request

Be carefull I changed some strings once again !


- fiveisalive - 2010-11-18

solexalex Wrote:OK I got it. ( My mobile phone was not showing the horizontal rule to slide the log on the right)

So it is strange... You got, instead of a int for the rating, the name of the field in the database 'Image Rating'
I updated to SVN 144 for you. I hope it solves the problem. I changed the SQLite request

Be carefull I changed some strings once again !

Nope, still not working with SVN r144:

Code:
02:25:29 T:139783900759824 M:2714869760  NOTICE: MyPicsDB >> SQL > SELECT files."Image Rating" FROM files WHERE strPath="/home/myth/media/Pictures/Lumix-import-old/108
_PANA" AND strFilename="P1080368.JPG";
02:25:29 T:139783900759824 M:2714869760  NOTICE: MyPicsDB >> The request failed :
02:25:29 T:139783900759824 M:2714869760  NOTICE: MyPicsDB >> exceptions.Exception - no such column: files.Image Rating
02:25:29 T:139783900759824 M:2714869760  NOTICE: MyPicsDB >> ---
02:25:29 T:139783900759824 M:2714869760    INFO: -->Python script returned the following error<--
02:25:29 T:139783900759824 M:2714869760   ERROR: Error Type: exceptions.IndexError
02:25:29 T:139783900759824 M:2714869760   ERROR: Error Contents: list index out of range
02:25:29 T:139783900759824 M:2714869760   ERROR: Traceback (most recent call last):
                                              File "/home/myth/.xbmc/addons/plugin.image.mypicsdb/default.py", line 1021, in ?
                                                m.show_pics()
                                              File "/home/myth/.xbmc/addons/plugin.image.mypicsdb/default.py", line 974, in show_pics
                                                fanart = xbmcplugin.getSetting(int(sys.argv[1]),'usepicasfanart')=='true' and join(path,filename) or picfanart
                                              File "/home/myth/.xbmc/addons/plugin.image.mypicsdb/default.py", line 156, in addPic
                                                rating = MPDB.getRating(picpath,picname)
                                              File "/home/myth/.xbmc/addons/plugin.image.mypicsdb/resources/lib/MypicsDB.py", line 515, in getRating
                                                return [row for row in Request( """SELECT files."Image Rating" FROM files WHERE strPath="%s" AND strFilename="%s";"""%(
path,filename) )][0][0]
                                            IndexError: list index out of range

It seems the problem is that none of my files have an image rating field at all, but the plugin should handle that situation. At least put in a try...exception clause to handle the IndexError.


- fiveisalive - 2010-11-18

Another bug, the "Slideshow" function in the context menu "Diaporama" in French doesn't work when I try the "All Images From..." a period, it simply returns back to the list without starting slideshow, log here:

Code:
02:31:12 T:139784755861664 M:2707714048   DEBUG: RunScriptWithParams - calling plugin My Pictures Database('plugin://plugin.image.mypicsdb/','-1','?action='diapo'&method='date'&period='month'&value='2010-11'&viewmode='scan'')
02:31:12 T:139784755861664 M:2707714048    INFO: initializing python engine.
02:31:12 T:139784755861664 M:2707714048   DEBUG: new python thread created. id=75
02:31:12 T:139783771002640 M:2707714048   DEBUG: thread start, auto delete: 0
02:31:12 T:139783771002640 M:2707714048   DEBUG: Python thread: start processing
02:31:12 T:139783771002640 M:2707722240  NOTICE: -->Python Interpreter Initialized<--
02:31:12 T:139783771002640 M:2707722240   DEBUG: Process - The source file to load is /home/myth/.xbmc/addons/plugin.image.mypicsdb/default.py
02:31:12 T:139783771002640 M:2707722240   DEBUG: Process - Setting the Python path to /home/myth/.xbmc/addons/plugin.image.mypicsdb:/home/myth/.xbmc/addons/script.module.dialogaddonscan/lib:/home/myth/.xbmc/addons/script.module.common.playback/lib:/home/myth/.xbmc/addons/script.module.beautifulsoup/lib:/home/myth/.xbmc/addons/script.module.cryptopy/lib:/home/myth/.xbmc/addons/script.module.simplejson/lib:/usr/local/lib64/xbmc/addons/script.module.pil/lib:/home/myth/.xbmc/addons/script.module.elementtree/lib:/usr/local/lib64/xbmc/addons/script.module.pysqlite/lib:/usr/local/lib64/xbmc/system/python/python24.zip:/usr/local/share/xbmc/system/python/lib/python24.zip:/usr/local/share/xbmc/system/python/lib/python2.4/:/usr/local/share/xbmc/system/python/lib/python2.4/plat-linux2:/usr/local/share/xbmc/system/python/lib/python2.4/lib-tk:/usr/local/share/xbmc/system/python/lib/python2.4/lib-dynload
02:31:12 T:139783771002640 M:2707722240   DEBUG: Process - Entering source directory /home/myth/.xbmc/addons/plugin.image.mypicsdb
02:31:12 T:139783771002640 M:2707722240   ERROR: dll_fstat64 emulated function failed
02:31:13 T:139783771002640 M:2707722240  NOTICE: using pysqlite2
02:31:13 T:139783771002640 M:2707722240  NOTICE: MyPicturesDB plugin called :
02:31:13 T:139783771002640 M:2707722240  NOTICE: plugin://plugin.image.mypicsdb/?action='diapo'&method='date'&period='month'&value='2010-11'&viewmode='scan'
02:31:13 T:139783771002640 M:2707722240  NOTICE: --------------------
02:31:13 T:139783771002640 M:2707722240  NOTICE: Previous line repeats 1 times.
02:31:13 T:139783771002640 M:2707722240  NOTICE: month
02:31:13 T:139783771002640 M:2707722240  NOTICE: 2010-11
02:31:13 T:139783771002640 M:2707722240  NOTICE: MyPicsDB >> SQL > SELECT strPath,strFilename FROM files WHERE datetime("EXIF DateTimeOriginal") BETWEEN datetime('2010-11-01','start of month') AND datetime('2010-11-01','start of month','+1 months') ORDER BY "EXIF DateTimeOriginal" ASC;
02:31:13 T:139783771002640 M:2707595264    INFO: Loading skin file: DialogProgress.xml
02:31:13 T:139783771002640 M:2707595264   DEBUG: Load DialogProgress.xml: 18.88ms
02:31:13 T:139783771002640 M:2707595264   DEBUG: DialogProgress::StartModal called
02:31:13 T:139783771002640 M:2707595264   DEBUG: ------ Window Init (DialogProgress.xml) ------
02:31:13 T:139783771002640 M:2707595264   DEBUG: Alloc resources: 1.18ms (0.00 ms skin load)
02:31:13 T:139783771002640 M:2707439616    INFO: Scriptresult: Success
02:31:13 T:139783771002640 M:2707439616    INFO: Python script stopped



- fiveisalive - 2010-11-18

Regarding the context menu options, I think the plugin should have at least the following options for all images (and folders where it makes sense). These options are present in the standard pictures application, in order they are:

1. Picture information
2. Start slideshow here
3. Go to root (could skip this, "root" doesn't make as much sense with this plugin)
4. Switch media (again skip this)
5. Add to favorites
6. Settings (make this "addons settings")


- solexalex - 2010-11-18

in fact the indexerror you got now is much better. With ths one i know that your first problem is solved but i have to handle the case user dont have any picture rated.

For the slideshow i will have a look this evening.

The context menu is particular as many items are treated differently depending on what the plugin has to do for showing the item content.
I will do my best to keep the context menu close to the standard one.

I thank you once again for all your involvment to help this plugin be a good one.


- fiveisalive - 2010-11-18

solexalex Wrote:in fact the indexerror you got now is much better. With ths one i know that your first problem is solved but i have to handle the case user dont have any picture rated.

For the slideshow i will have a look this evening.

The context menu is particular as many items are treated differently depending on what the plugin has to do for showing the item content.
I will do my best to keep the context menu close to the standard one.

Thanks! Another small feature that would make MyPicsDB closer to the standard one would be to also include the date of the picture in the right-hand column when viewing as a standard "List". This should be present in all views but would be particularly useful in the case of Collections which could be a collection of a number of dates, so seeing the dates at a glance would be useful. Also when viewing by date, but looking at a single particular day, would make it easy to know what day you were looking at without having to go back up a level.

Also when viewing collections, it would be useful to be able to order them by date, rather than in the order in which they were originally added to the collection.

Quote:I thank you once again for all your involvment to help this plugin be a good one.

No problem. I'll try to get to some code if I get time.


- solexalex - 2010-11-18

fiveisalive Wrote:Another bug, the "Slideshow" function in the context menu "Diaporama" in French doesn't work when I try the "All Images From..." a period, it simply returns back to the list without starting slideshow
OK this part is uggly... It's a shame !! I use the httpapi which should be considered as deprecated... Blush
You need to activate the xbmc webserver I think for this to work... I didn't found something similar or I messed somewhere...
This part should definitely be recoded... (I need a bug tracker and/or something to log the request you all made to me !! lol )

----
The error with picture rating is fixed (svn 145)

---
Quote:when viewing collections, it would be useful to be able to order them by date, rather than in the order in which they were originally added to the collection
svn 146 : the pictures from a collection are sorted by EXIF DateTimeOriginal field


- solexalex - 2010-11-18

Quote:This should be present in all views but would be particularly useful in the case of Collections which could be a collection of a number of dates, so seeing the dates at a glance would be useful.
I totally agree with you. The problem is I can't figure out how to set the label2 from a listitem. I'm going to ask to other devs for help on this and include some info with it if possible.

Quote:Also when viewing by date, but looking at a single particular day, would make it easy to know what day you were looking at without having to go back up a level.
Once again I agree with you, and once again the things seems to not work as expected because I already name the lists so that you know what the list view you are seeing is. Unfortunately it doesn't seems to work. Maybe it is because of the skin that does not show it, or XBMC itself that is buggy.... I have to say I haven't searched for such a bug, and I haven't posted any bug report neither...

I will look for further information and hopefully make it works.
If someone knows about this, or if someone can search the forum for the answer for me, I would be very glad. I'm asking now to french forums


- solexalex - 2010-11-18

Picture date is now visible ! svn #147


- solexalex - 2010-11-20

svn #148 :
you can use an addon setting to set the minimum rating a picture should have to be shown. This filter is not made on requests, but only when plugin has to add the picture in the container. If the minimum rating does not match, the picture is simply passed.


- Robotica - 2010-12-10

Robotica Wrote:don't be sorry since sharing this work is great. Can't do all...

I will step in that topic and ask what is needed and then I will come back here.

As for mySQL support: I think this is hard to test since this plugin uses a seperate database. Maybe I am wrong....
solexalex Wrote:oh well. It is a very good idea. But as english is not my first language, i don t feel to read the whole conversation.

Do you know if there is something to do to ask for thinking about a picture database ?

Sorry for being lazy on this but reading only the first topic is a hard work for me Wink


Posted this question in the wrong topic. But there seems to be a wiki and a topic related to the database design:
http://wiki.xbmc.org/index.php?title=Database_Schema_4.0
http://forum.xbmc.org/showthread.php?tid=73831