|
|
@@ -29,13 +29,19 @@ def find_hash(hsh, db=None):
|
|
|
)
|
|
|
return cursor.fetchone()
|
|
|
|
|
|
-def insert_file(hsh, filename, timestamp, db=None):
|
|
|
+def insert_file(hsh, filename, timestamp, db=None, uploaded=None):
|
|
|
cursor = db.cursor()
|
|
|
+ was_uploaded = int(time.time()) if uploaded else None
|
|
|
cursor.execute("""
|
|
|
- insert into file(hash, filename, timestamp)
|
|
|
- values(?, ?, ?)
|
|
|
+ insert into file(hash, filename, timestamp, uploaded)
|
|
|
+ values(?, ?, ?, ?)
|
|
|
""",
|
|
|
- (hsh, filename, int(time.mktime(timestamp.timetuple())), )
|
|
|
+ (
|
|
|
+ hsh,
|
|
|
+ filename,
|
|
|
+ int(time.mktime(timestamp.timetuple())),
|
|
|
+ was_uploaded
|
|
|
+ )
|
|
|
)
|
|
|
|
|
|
def hash_file(filename):
|
|
|
@@ -72,6 +78,10 @@ def main():
|
|
|
const=True,
|
|
|
default=False
|
|
|
)
|
|
|
+ dbparser.add_argument('--uploaded', action='store_const',
|
|
|
+ const=True, default=False,
|
|
|
+ dest='uploaded',
|
|
|
+ )
|
|
|
dbparser.add_argument('-limit', type=int, dest='limit')
|
|
|
|
|
|
stations_parser = subparsers.add_parser('station')
|
|
|
@@ -136,7 +146,10 @@ def main():
|
|
|
|
|
|
if do_insert:
|
|
|
thehash = hash_file(filename)
|
|
|
- insert_file(thehash, filename, dt, db=conn)
|
|
|
+ insert_file(thehash, filename, dt,
|
|
|
+ db=conn,
|
|
|
+ uploaded=args.uploaded,
|
|
|
+ )
|
|
|
counter += 1
|
|
|
print(dt)
|
|
|
|
|
|
@@ -367,7 +380,6 @@ def main():
|
|
|
|
|
|
else:
|
|
|
errout = processes[index].stderr.read(4096)
|
|
|
- scr.addstr(0, 0, 'ALL FUCKED')
|
|
|
refresh = True
|
|
|
|
|
|
k = scr.getch()
|