New maint. function: Recreate hash, #215
parent
3348d524d5
commit
f42ada4007
|
|
@ -621,6 +621,15 @@ def exif_update_dirs(maint_update_dirs_path_recorder, maint_update_dirs_exif_dat
|
|||
|
||||
return maint_wait, maint_last_msg
|
||||
|
||||
def recreate_hash(maint_wait):
|
||||
version = str(db_version)
|
||||
conn, cursor = wib_db.transaction_begin()
|
||||
wib_db.migrate_filehash(cursor, version)
|
||||
wib_db.transaction_end(conn, cursor)
|
||||
maint_last_msg = "Hashes recreated"
|
||||
|
||||
return maint_wait, maint_last_msg
|
||||
|
||||
def reapply_ranking(path_recorder, maint_wait):
|
||||
dirs = {}
|
||||
|
||||
|
|
@ -1339,6 +1348,11 @@ def create_tab(tab: ImageBrowserTab, current_gr_tab: gr.Tab):
|
|||
maint_update_dirs_from = gr.Textbox(label="From (full path)")
|
||||
with gr.Column(scale=10):
|
||||
maint_update_dirs_to = gr.Textbox(label="to (full path)")
|
||||
with gr.Row(visible=maint):
|
||||
with gr.Column(scale=1):
|
||||
maint_recreate_hash = gr.Button(value="Recreate hash for existing files")
|
||||
with gr.Column(scale=10):
|
||||
gr.HTML(visible=False)
|
||||
with gr.Row(visible=maint):
|
||||
with gr.Column(scale=1):
|
||||
maint_reapply_ranking = gr.Button(value="Reapply ranking after moving files")
|
||||
|
|
@ -1485,6 +1499,12 @@ def create_tab(tab: ImageBrowserTab, current_gr_tab: gr.Tab):
|
|||
outputs=[maint_wait, maint_last_msg],
|
||||
show_progress=True
|
||||
)
|
||||
maint_recreate_hash.click(
|
||||
fn=recreate_hash,
|
||||
inputs=[maint_wait],
|
||||
outputs=[maint_wait, maint_last_msg],
|
||||
show_progress=True
|
||||
)
|
||||
maint_reapply_ranking.click(
|
||||
fn=reapply_ranking,
|
||||
inputs=[path_recorder, maint_wait],
|
||||
|
|
|
|||
|
|
@ -270,7 +270,8 @@ def migrate_filehash(cursor, version):
|
|||
if os.path.exists(file):
|
||||
hash = get_hash(file)
|
||||
cursor.execute('''
|
||||
INSERT INTO filehash (file, hash)
|
||||
INSERT OR REPLACE
|
||||
INTO filehash (file, hash)
|
||||
VALUES (?, ?)
|
||||
''', (file, hash))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue