Răsfoiți Sursa

just a checkpoint

Pat Beirne 9 ani în urmă
părinte
comite
cfd94529a6
1 a modificat fișierele cu 4 adăugiri și 5 ștergeri
  1. 4 5
      dirnotes

+ 4 - 5
dirnotes

@@ -47,7 +47,7 @@ class DataBase:
 			c.execute("select * from dirnotes")
 		except sqlite3.OperationalError:
 			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):
 		c = self.db.cursor()
@@ -64,8 +64,8 @@ class DataBase:
 		c = self.db.cursor()
 		s = os.stat(fileName)
 		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 (?,?,?,?,?)",
-			(fileName, s.st_mtime, s.st_size, str(comment), time.time()))
+		c.execute("insert into dirnotes values (?,datetime(?,'unixepoch','localtime'),?,?,datetime(?,'unixepoch','localtime'))",
+			(os.path.abspath(fileName), s.st_mtime, s.st_size, str(comment), time.time()))
 		self.db.commit()
 
 def parse():
@@ -90,7 +90,7 @@ class FileObj():
 		try:
 			self.comment = xattr.getxattr(fileName,COMMENT_KEY)
 		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
 	def getName(self):
 		return self.fileName
@@ -184,7 +184,6 @@ if __name__=="__main__":
 	p = parse()
 	if p.dirname[-1]=='/':
 		p.dirname = p.dirname[:-1]
-	print(dir(p))
 	print(p.dirname)
 	
 	db = DataBase()