Pictures database and library mode; scan EXIF and IPTC metadata tags into a SQL db

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Closed
Martijn Online
Team-XBMC
Posts: 7,711
Joined: Jul 2011
Reputation: 114
Location: Dawn of time
Post: #371
(2012-06-01 08:07)Xycl Wrote:  Commands are os.walk, os.listdir, os.stat and os.path.walk (I hope that I already have an overlook over the source code)

Those don't work on SMB:// drives

There's a PR pending to extend current xbmcvfs module
https://github.com/xbmc/xbmc/pull/1013

Other option is to use the JSON-RPC to retrieve the files on those drives.
Perhaps this can be usefull?
https://github.com/paddycarey/script.module.devtoolkit

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first


For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2012-06-01 10:33 by Martijn.)
find
Xycl Offline
Senior Member
Posts: 248
Joined: Feb 2012
Reputation: 6
Location: Germany
Post: #372
The problem is the stat function.
I don't see an xbmcvfs function or json method to replace it.

Main page: https://github.com/Xycl
Repository: Xycl Repository
How to submit a log file: XBMC-Wiki
find
mikebzh44 Offline
Posting Freak
Posts: 1,061
Joined: Nov 2011
Reputation: 18
Location: Nantes - France
Post: #373
I have always an error with 0.7.1.1 beta under OpenELEC with accented names :

Code:
20:45:22 T:139850233669376   ERROR: Error Type: <type 'exceptions.UnicodeDecodeError'>
20:45:22 T:139850233669376   ERROR: Error Contents: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128)
20:45:22 T:139850233669376   ERROR: Traceback (most recent call last):
                                              File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 510, in <module>
                                                main2()
                                              File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 150, in main2
                                                count_files(unquote_plus(options.rootpath),recursive = options.recursive)
                                              File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 217, in count_files
                                                path,folders,files = oswalk(path).next()
                                              File "/usr/lib/python2.7/os.py", line 284, in walk
                                                if isdir(join(top, name)):
                                              File "/usr/lib/python2.7/posixpath.py", line 69, in join
                                                path +=  b
                                            UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128)

I think is specific to OpenELEC because Fmronan is running ubuntu, get accented directories name and the script scan his library.

On my OpenELEC, I have mounted my shared directory so now the path for my pictures is /storage/NAS/Pictures.

If I add a subdirectory containing non accented pictures, the scan is OK and DB is populated.

If I add a subdirectory containing accented pictures (Arrière.JPG), the scan is KO.

If I renamed the picture to Arriere.JPG and restart XBMC and rescan directory, everything is OK Confused

Sorry for my english, but, you know, I'm French so ...

find
Xycl Offline
Senior Member
Posts: 248
Joined: Feb 2012
Reputation: 6
Location: Germany
Post: #374
(2012-05-31 06:42)mikebzh44 Wrote:  How my openelec is set up by default :

Code:
root ~/.xbmc/temp # locale
LC_CTYPE="POSIX"

(2012-06-04 20:54)mikebzh44 Wrote:  
Code:
File "/storage/.xbmc/addons/plugin.image.mypicsdb/scanpath.py", line 217, in count_files
                                                path,folders,files = oswalk(path).next()
                                              File "/usr/lib/python2.7/os.py", line 284, in walk
                                                if isdir(join(top, name)):
                                              File "/usr/lib/python2.7/posixpath.py", line 69, in join

I think "POSIX" is the reason for the decoding.
Setting this in XBMCbuntu will cause the same decoding error.
Can you add
Code:
export LC_ALL="en_US.utf-8"
at the end of your .profile?
But I don't know if openelec support this locale.

Main page: https://github.com/Xycl
Repository: Xycl Repository
How to submit a log file: XBMC-Wiki
find
mikebzh44 Offline
Posting Freak
Posts: 1,061
Joined: Nov 2011
Reputation: 18
Location: Nantes - France
Post: #375
Yes, Fmronan got the same locale as you :

LANG=fr_FR.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIF

I will try this settings tomorrow morning.

Sorry for my english, but, you know, I'm French so ...

find
mikebzh44 Offline
Posting Freak
Posts: 1,061
Joined: Nov 2011
Reputation: 18
Location: Nantes - France
Post: #376
Try to fix it by setting locale but OpenELEC didn't get all locales :

https://github.com/OpenELEC/OpenELEC.tv/issues/364

As I never use accented charaters in directories or pictures names, it doesn't matter but we should keep this in mind if other users get the same issue.

Sorry for my english, but, you know, I'm French so ...

find
Xycl Offline
Senior Member
Posts: 248
Joined: Feb 2012
Reputation: 6
Location: Germany
Post: #377
Now we have a problem.

Of course, I can call os.walk with an utf-8 encoded string like os.walk(path.encode('utf-8'), but then it won't work with Windows because there you must use unicodes.
With strings instead of unicodes it works in Windows only with your locale codepage which means that with a german Windows you can read e.g. Coté.jpg (because the é is part of the codepage) but not with a greek Windows! Sad

Okay.
My priorities:
1) The tag filter wizard should go productive.
2) Your functions which set skin properties should go productive.
Todo:
3) An editor to translate the generic tags must be written. The database table already has a column TagTranslation in table TagTypes. You can e.g. use SQLiteSpy to translate the tags.
4) I would like to rewrite the complete scanning stuff with xbmcvfs functions and json GetDirectory. Then you'll be able to scan nfs or smb shares.
Problem: There is no function to get the last modification time. Therefore a rescan will really rescan all pictures and not only the modified onesFrown

Main page: https://github.com/Xycl
Repository: Xycl Repository
How to submit a log file: XBMC-Wiki
find
R00STER Offline
Junior Member
Posts: 4
Joined: Dec 2011
Reputation: 0
Post: #378
I have a problem running mypictures database on an Openelec system.

When I add a photo source and try a scan it bombs out with:

"Error Script Failed : scanpath.py"

Initially this was from a Samba share but now I have moved all my files locally (which helps with loading time anyway). It doesn't seem to matter what location I try scanning I always get this error.

Anyone able to offer advice?
find
mikebzh44 Offline
Posting Freak
Posts: 1,061
Joined: Nov 2011
Reputation: 18
Location: Nantes - France
Post: #379
Did your directories or picture names is accented or with special characters ?

I have also mount my NAS shared directories to local path but if I scan :

/storage/NAS/Picture/Fazer/Arrière.JPG

then scanpath.py crash. Rename picture to :

/storage/NAS/Picture/Fazer/Arriere.JPG

And scan is OK.

Sorry for my english, but, you know, I'm French so ...

find
R00STER Offline
Junior Member
Posts: 4
Joined: Dec 2011
Reputation: 0
Post: #380
I don't think so, but will have a look.

I did try it on one small folder with no hierarchy and got the same error, but will check the names in it.
find
Thread Closed