real fix for BUG-64, can now move a directory between import/storage too... Still have move button disabled on selecting a folder in GUI - to be fixed, then we can move 111 Working dir back to the import dir
This commit is contained in:
5
BUGs
5
BUGs
@@ -1,5 +1,6 @@
|
||||
### Next: 68
|
||||
BUG-56: when making a viewing list of AI:mich, (any search?) and going past the page_size, it gets the wrong data from the DB for the 'next' entry
|
||||
BUG-60: entries per page (in folders view) ignores pagesize, and this also contributes to BUG-56 I think
|
||||
BUG-61: in Fullscreen mode and next/prev occasionally dropped out of FS
|
||||
this is just another consequence of going beyond Pagesize, when we get new entries from DB, it loses FS flag
|
||||
BUG-61: in Fullscreen mode and next/prev dropped out of FS when calling /viewlist route
|
||||
-- only way to fix this, is for when we POST to viewlist, it returns json, and we never leave /view/X
|
||||
-- then we can stay on-page, and stay in FS and then just call ViewImageOrVide()
|
||||
|
||||
2
README
2
README
@@ -65,7 +65,7 @@ To rebuild DB from scratch/empty data:
|
||||
#scratch, when we get real data, we will instead cp a backup file not the
|
||||
#tables.sql
|
||||
|
||||
( cd /srv/docker/config/ ; sudo docker-compose stop padb ; yes | sudo docker-compose rm padb ; sudo rm -rf /srv/docker/container/padb/data/ ; sudo cp /home/ddp/src/photoassistant/tables.sql /srv/docker/container/padb/docker-entrypoint-initdb.d/tables.sql ; sudo docker-compose up padb )
|
||||
( cd /srv/docker/config/ ; sudo docker-compose stop padb_dev ; yes | sudo docker-compose rm padb_dev ; sudo rm -rf /srv/docker/container/padb_dev/data/ ; sudo cp /home/ddp/src/photoassistant/tables.sql /srv/docker/container/padb_dev/docker-entrypoint-initdb.d/tables.sql ; sudo docker-compose up padb_dev ) &
|
||||
|
||||
To get back a 'working' but scanned set of data:
|
||||
|
||||
|
||||
1
TODO
1
TODO
@@ -1,6 +1,5 @@
|
||||
## GENERAL
|
||||
* move all unsorted photos/* -> import/
|
||||
can now move files (bug-64 fixed), but Dir needs new/different code
|
||||
|
||||
* remember last import dir, so you can just go straight back to it
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
# global debug setting
|
||||
DEBUG=False
|
||||
DEBUG=True
|
||||
|
||||
### SQLALCHEMY IMPORTS ###
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
@@ -969,6 +969,8 @@ def MoveFileToRecycleBin(job,del_me):
|
||||
src=del_me.FullPathOnFS()
|
||||
dst=dst_dir + '/' + del_me.name
|
||||
os.replace( src, dst )
|
||||
if DEBUG:
|
||||
print( f"MoveFileToRecycleBin({job.id},{del_me.name}): os.replace {src} with {dst} " )
|
||||
except Exception as e:
|
||||
print( f"ERROR: Failed to remove file from filesystem - which={src}, err: {e}")
|
||||
|
||||
@@ -1005,8 +1007,8 @@ def MoveFileToRecycleBin(job,del_me):
|
||||
return
|
||||
|
||||
####################################################################################################################################
|
||||
# Function that moves a file into a new folder in the storage path - if needed it makes the folder on the FS,
|
||||
# moves the file into the folder on the FS and then changes the database path to the relevant Storage path
|
||||
# Function that moves a file into a new folder in any path (usually form import to storage) - if needed it makes the folder on the FS,
|
||||
# moves the file into the folder on the FS and then changes the path to the appropriate one
|
||||
####################################################################################################################################
|
||||
def MoveFileToNewFolderInStorage(job,move_me, dst_storage_path, dst_rel_path):
|
||||
if DEBUG:
|
||||
@@ -1028,8 +1030,8 @@ def MoveFileToNewFolderInStorage(job,move_me, dst_storage_path, dst_rel_path):
|
||||
parent_dir=session.query(Dir).join(PathDirLink).filter(PathDirLink.path_id==dst_storage_path.id).first()
|
||||
|
||||
# okay, go through new relative path and AddDir any missing subdirs of this
|
||||
# path (think Import/Dir1/Dir2) which b/c we have bin_path in AddDir will
|
||||
# create Bin/Import, Bin/Import/Dir1, Bin/Import/Dir1/Dir2
|
||||
# path (think Import/Dir1/Dir2) which b/c we have dst_storage_path in AddDir will
|
||||
# create Storage/Dir1, Storage/Dir1/Dir2
|
||||
part_rel_path=""
|
||||
for dirname in dst_rel_path.split("/"):
|
||||
part_rel_path += f"{dirname}"
|
||||
@@ -1042,11 +1044,33 @@ def MoveFileToNewFolderInStorage(job,move_me, dst_storage_path, dst_rel_path):
|
||||
print( f"now should change {move_me} in_dir to {new_dir} created above in {dst_storage_path}" )
|
||||
move_me.in_dir = new_dir
|
||||
move_me.in_path = dst_storage_path
|
||||
if move_me.type.name == "Directory":
|
||||
if DEBUG:
|
||||
print( f"{move_me.name} is a dir, so reset its dir_details path to the new path too" )
|
||||
move_me.dir_details.in_path = dst_storage_path
|
||||
move_me.dir_details.rel_path = dst_rel_path + '/' + move_me.dir_details.rel_path
|
||||
ResetAnySubdirPaths( move_me, dst_storage_path, dst_rel_path )
|
||||
if DEBUG:
|
||||
print( f"DONE change of {move_me} in_dir to {new_dir} created above" )
|
||||
session.add(move_me)
|
||||
AddLogForJob(job, f"{move_me.name} - (moved to {os.path.dirname(move_me.FullPathOnFS())})" )
|
||||
return
|
||||
|
||||
def ResetAnySubdirPaths( moving_dir, dst_storage_path, dst_rel_path ):
|
||||
if DEBUG:
|
||||
print( f"ResetAnySubdirPaths( {moving_dir.name}, {dst_storage_path.path_prefix}, {dst_rel_path} )" )
|
||||
sub_dirs = session.query(Entry).join(FileType).join(EntryDirLink).filter(EntryDirLink.dir_eid==moving_dir.id).filter(FileType.name=='Directory').all()
|
||||
for sub in sub_dirs:
|
||||
if DEBUG:
|
||||
print( f"ResetAnySubdirPaths: WAS sub={sub.name}, ip={sub.in_dir.in_path.path_prefix}, rp={sub.dir_details.rel_path}" )
|
||||
sub.in_path = dst_storage_path
|
||||
sub.dir_details.in_path = dst_storage_path
|
||||
sub.dir_details.rel_path = dst_rel_path + '/' + sub.dir_details.rel_path
|
||||
if DEBUG:
|
||||
print( f"ResetAnySubdirPaths: NOW sub={sub.name}, ip={sub.in_dir.in_path.path_prefix}, rp={sub.dir_details.rel_path}" )
|
||||
ResetAnySubdirPaths( sub, dst_storage_path, dst_rel_path )
|
||||
return
|
||||
|
||||
####################################################################################################################################
|
||||
# Convenience function to remove a dir from the database - and its associated links
|
||||
####################################################################################################################################
|
||||
@@ -1585,7 +1609,8 @@ def JobMoveFiles(job):
|
||||
|
||||
for jex in job.extra:
|
||||
if 'eid-' in jex.name:
|
||||
move_me=session.query(Entry).join(File).filter(Entry.id==jex.value).first()
|
||||
# move_me=session.query(Entry).join(File).filter(Entry.id==jex.value).first()
|
||||
move_me=session.query(Entry).get(jex.value)
|
||||
MoveFileToNewFolderInStorage(job, move_me, dst_storage_path, f"{prefix}{suffix}" )
|
||||
now=datetime.now(pytz.utc)
|
||||
next_job=Job(start_time=now, last_update=now, name="checkdups", state="New", wait_for=None, pa_job_state="New", current_file_num=0 )
|
||||
|
||||
Reference in New Issue
Block a user