All pastes #894879 Raw Edit

Stuff

public text v1 · immutable
·published 2008-02-07 11:25 UTC
rendered paste body
diff -up freevo-1.7.6.1/src/helpers/cache.py.sqlite2 freevo-1.7.6.1/src/helpers/cache.py
--- freevo-1.7.6.1/src/helpers/cache.py.sqlite2	2007-09-10 21:15:10.000000000 +0200
+++ freevo-1.7.6.1/src/helpers/cache.py	2008-02-07 04:35:37.000000000 +0100
@@ -375,7 +375,7 @@ def create_metadata():
     sys.__stdout__.flush()
     try:
         # The DB stuff
-        import sqlite
+        from pysqlite2 import dbapi2 as sqlite
 
         for dir in config.AUDIO_ITEMS:
             if os.path.isdir(dir[1]):
diff -up freevo-1.7.6.1/src/util/dbutil.py.sqlite2 freevo-1.7.6.1/src/util/dbutil.py
--- freevo-1.7.6.1/src/util/dbutil.py.sqlite2	2007-07-10 17:49:44.000000000 +0200
+++ freevo-1.7.6.1/src/util/dbutil.py	2008-02-07 05:04:56.000000000 +0100
@@ -74,7 +74,7 @@ def inti(a):
 DATABASE = os.path.join(config.FREEVO_CACHEDIR, 'freevo.sqlite')
 
 try:
-    import sqlite
+    from pysqlite2 import dbapi2 as sqlite
 except:
     print "Python SQLite not installed!"
 
@@ -84,7 +84,7 @@ class MetaDatabase:
     def __init__(self):
         # Private Variables
         DATABASE = os.path.join(config.FREEVO_CACHEDIR, 'freevo.sqlite')
-        self.db = sqlite.connect(DATABASE, client_encoding=config.LOCALE)
+        self.db = sqlite.connect(DATABASE)
         self.cursor = self.db.cursor()
 
     def runQuery(self,query, close=False):
@@ -107,9 +107,9 @@ class MetaDatabase:
 
     def close(self):
         '''close the database, committing any open transactions first'''
-        if not self.db.closed:
-            self.db.commit()
-            self.db.close()
+        #if not self.db.closed: not working with pysqlite2
+        self.db.commit()
+        self.db.close()
 
     def commit(self):
         '''commit transactions'''