|
|
|
@ -4,20 +4,20 @@ import argparse |
|
|
|
import datetime |
|
|
|
import os |
|
|
|
import os.path as osp |
|
|
|
import shlex |
|
|
|
import sqlite3 |
|
|
|
import subprocess |
|
|
|
import time |
|
|
|
import traceback |
|
|
|
|
|
|
|
FORCE_ADMIN = not config.getboolean('global','no_admin',fallback=False) |
|
|
|
TEST = True |
|
|
|
DB_PATH = config.getpath('global','db_path') |
|
|
|
ext_database = sqlite3.connect(DB_PATH) |
|
|
|
|
|
|
|
|
|
|
|
EXE_PATH = config.getpath('global','modified_time_updater') |
|
|
|
|
|
|
|
def update_mtimes(starts): |
|
|
|
global EXE_PATH |
|
|
|
if not is_admin() and FORCE_ADMIN: |
|
|
|
raise Exception("Process must be admin") |
|
|
|
for start in starts: |
|
|
|
@ -32,15 +32,20 @@ def build(after,starts): |
|
|
|
for path in starts: |
|
|
|
for root,dirs,files in os.walk(path,topdown=True): |
|
|
|
try: |
|
|
|
for file in files: |
|
|
|
yield os.path.join(root,file) |
|
|
|
dirs[:] = list(filter(lambda p: osp.getmtime(osp.join(root,p)) > after,dirs)) |
|
|
|
ignore = any('__ignore__' in files) |
|
|
|
if ignore: |
|
|
|
del dirs |
|
|
|
else: |
|
|
|
for file in files: |
|
|
|
yield os.path.join(root,file) |
|
|
|
dirs[:] = list(filter(lambda p: osp.getmtime(osp.join(root,p)) > after,dirs)) |
|
|
|
except: |
|
|
|
print('Error',root,sep= ': ') |
|
|
|
|
|
|
|
def _update(ext,starts,after,do_update_mtimes = False): |
|
|
|
if do_update_mtimes: |
|
|
|
update_mtimes(starts) |
|
|
|
starts = no_parents(starts) |
|
|
|
files = build(after,starts) |
|
|
|
for file in files: |
|
|
|
if file.endswith(ext): |
|
|
|
@ -92,7 +97,6 @@ def update(ext,do_update_mtimes): |
|
|
|
|
|
|
|
except Exception as e: |
|
|
|
set_updating(ext,ext_database,False) |
|
|
|
traceback.print_exc() |
|
|
|
input() |
|
|
|
raise e |
|
|
|
|
|
|
|
|