just a checkpoint

This commit is contained in:
2015-12-04 11:44:12 -05:00
parent afcbf9ed61
commit cfd94529a6
+4 -5
View File
@@ -47,7 +47,7 @@ class DataBase:
c.execute("select * from dirnotes") c.execute("select * from dirnotes")
except sqlite3.OperationalError: except sqlite3.OperationalError:
print("Table %s created" % ("dirnotes")) print("Table %s created" % ("dirnotes"))
c.execute("create table dirnotes (name TEXT, date REAL, size INTEGER, comment TEXT, comment_date REAL)") c.execute("create table dirnotes (name TEXT, date DATETIME, size INTEGER, comment TEXT, comment_date DATETIME)")
def getData(self, fileName): def getData(self, fileName):
c = self.db.cursor() c = self.db.cursor()
@@ -64,8 +64,8 @@ class DataBase:
c = self.db.cursor() c = self.db.cursor()
s = os.stat(fileName) s = os.stat(fileName)
print "params: %s %f %d %s %f" % ((os.path.abspath(fileName), s.st_mtime, s.st_size, comment, time.time())) print "params: %s %f %d %s %f" % ((os.path.abspath(fileName), s.st_mtime, s.st_size, comment, time.time()))
c.execute("insert into dirnotes values (?,?,?,?,?)", c.execute("insert into dirnotes values (?,datetime(?,'unixepoch','localtime'),?,?,datetime(?,'unixepoch','localtime'))",
(fileName, s.st_mtime, s.st_size, str(comment), time.time())) (os.path.abspath(fileName), s.st_mtime, s.st_size, str(comment), time.time()))
self.db.commit() self.db.commit()
def parse(): def parse():
@@ -90,7 +90,7 @@ class FileObj():
try: try:
self.comment = xattr.getxattr(fileName,COMMENT_KEY) self.comment = xattr.getxattr(fileName,COMMENT_KEY)
except Exception as e: except Exception as e:
print("comment read on %s failed, execption %s" % (self.fileName,e)) #print("comment read on %s failed, execption %s" % (self.fileName,e))
pass pass
def getName(self): def getName(self):
return self.fileName return self.fileName
@@ -184,7 +184,6 @@ if __name__=="__main__":
p = parse() p = parse()
if p.dirname[-1]=='/': if p.dirname[-1]=='/':
p.dirname = p.dirname[:-1] p.dirname = p.dirname[:-1]
print(dir(p))
print(p.dirname) print(p.dirname)
db = DataBase() db = DataBase()