]> git.phdru.name Git - xsetbg.git/commitdiff
Use configured FS encoding instead of the current locale
authorOleg Broytman <phd@phdru.name>
Wed, 22 Jul 2015 18:07:11 +0000 (21:07 +0300)
committerOleg Broytman <phd@phdru.name>
Wed, 22 Jul 2015 18:07:11 +0000 (21:07 +0300)
reload_db.py

index 187bfb353f04ac8b374042d4724ce3fc5fe2e494..97012a8c0d3cfa3dcd733d3f56743b2eac08d714 100755 (executable)
@@ -12,9 +12,10 @@ __license__ = "GNU GPL"
 import sys
 from sqlobject import SQLObjectNotFound, sqlhub
 from sqlobject.sqlbuilder import Insert
-from m_lib.defenc import default_encoding
+from xsetbg_conf import xsetbg_conf
 from xsetbg_db import SqliteSequence, XSetBg, xsetbg_db
 
+fs_encoding = xsetbg_conf.get("images", "fs_encoding")
 dump_file = open(sys.argv[1], 'rU')
 
 if xsetbg_db:
@@ -49,8 +50,8 @@ for line in dump_file:
     id, timestamp, filename = line.strip().split(None, 2)
     id = convert_str(id)
     timestamp = convert_str(timestamp)
-    if default_encoding != 'utf-8':
-        filename = filename.decode(default_encoding).encode('utf-8')
+    if fs_encoding != 'utf-8':
+        filename = filename.decode(fs_encoding).encode('utf-8')
     values = {'last_shown': timestamp, 'full_name': filename}
     if id:
         values['id'] = id