Merge branch 'master' of 192.168.0.2:photoassistant
This commit is contained in:
3
TODO
3
TODO
@@ -1,7 +1,10 @@
|
|||||||
## GENERAL
|
## GENERAL
|
||||||
|
* on start up, should validate the import/storage/recycle bin paths exist and spit an error if they dont
|
||||||
|
|
||||||
* issue where someone could call IP .../Imp/photos and SP .../Sto/photos and then static/photos is ambiguous:
|
* issue where someone could call IP .../Imp/photos and SP .../Sto/photos and then static/photos is ambiguous:
|
||||||
-- DONE: make path prefix by static/<ptype.name>/ so that files are in: static/<ptype.name>/in_path.pp/dir.rel_path/
|
-- DONE: make path prefix by static/<ptype.name>/ so that files are in: static/<ptype.name>/in_path.pp/dir.rel_path/
|
||||||
-- then deleting below would just path_prefix from static/storage to .pa_bin/storage, etc.
|
-- then deleting below would just path_prefix from static/storage to .pa_bin/storage, etc.
|
||||||
|
-- need to create the subdir if it does not exist in recycle_bin_path
|
||||||
-- need to be able to view recycle bin (should be simple when we have path_types) &&& should able to consolidate the files_ip/files_sp/files_rb? route handling functions
|
-- need to be able to view recycle bin (should be simple when we have path_types) &&& should able to consolidate the files_ip/files_sp/files_rb? route handling functions
|
||||||
-- could also allow undelete per file / show content as another Files->View and more like storage (i.e. show folders)
|
-- could also allow undelete per file / show content as another Files->View and more like storage (i.e. show folders)
|
||||||
* storage_path viewing needs to be by folder / not a big grab bag of files (by default - DONE)
|
* storage_path viewing needs to be by folder / not a big grab bag of files (by default - DONE)
|
||||||
|
|||||||
@@ -281,10 +281,18 @@ def MessageToFE( job_id, alert, message ):
|
|||||||
session.commit()
|
session.commit()
|
||||||
return msg.id
|
return msg.id
|
||||||
|
|
||||||
|
def ProcessRecycleBinDir(parent_job):
|
||||||
|
settings = session.query(Settings).first()
|
||||||
|
if settings == None:
|
||||||
|
raise Exception("Cannot create file data with no settings / recycle bin path is missing")
|
||||||
|
paths = settings.recycle_bin_path.split("#")
|
||||||
|
ptype = session.query(PathType).filter(PathType.name=='Bin').first().id
|
||||||
|
JobsForPaths( parent_job, paths, ptype )
|
||||||
|
|
||||||
def ProcessStorageDirs(parent_job):
|
def ProcessStorageDirs(parent_job):
|
||||||
settings = session.query(Settings).first()
|
settings = session.query(Settings).first()
|
||||||
if settings == None:
|
if settings == None:
|
||||||
raise Exception("Cannot create file data with no settings / import path is missing")
|
raise Exception("Cannot create file data with no settings / storage path is missing")
|
||||||
paths = settings.storage_path.split("#")
|
paths = settings.storage_path.split("#")
|
||||||
ptype = session.query(PathType).filter(PathType.name=='Storage').first().id
|
ptype = session.query(PathType).filter(PathType.name=='Storage').first().id
|
||||||
JobsForPaths( parent_job, paths, ptype )
|
JobsForPaths( parent_job, paths, ptype )
|
||||||
@@ -469,6 +477,7 @@ def JobForceScan(job):
|
|||||||
session.query(File).delete()
|
session.query(File).delete()
|
||||||
session.query(Entry).delete()
|
session.query(Entry).delete()
|
||||||
session.commit()
|
session.commit()
|
||||||
|
ProcessRecycleBinDir(job)
|
||||||
ProcessImportDirs(job)
|
ProcessImportDirs(job)
|
||||||
ProcessStorageDirs(job)
|
ProcessStorageDirs(job)
|
||||||
FinishJob(job, "Completed (forced remove and recreation of all file data)")
|
FinishJob(job, "Completed (forced remove and recreation of all file data)")
|
||||||
@@ -536,6 +545,15 @@ def ResetExistsOnFS(job, path):
|
|||||||
# used when scanning and a file has been removed out from under PA, or
|
# used when scanning and a file has been removed out from under PA, or
|
||||||
# when we remove duplicates
|
# when we remove duplicates
|
||||||
def RemoveFileFromDB(id):
|
def RemoveFileFromDB(id):
|
||||||
|
print( "DDP: this should just switch the path link to the recycle bin and maybe udpate rel_path?")
|
||||||
|
|
||||||
|
# okay, so 'id' will have EntryDirLink -> PathDirLink needs a change, what about rel_path?
|
||||||
|
|
||||||
|
pdl = session.query(PathDirLink).join(Dir).join(EntryDirLink).filter(EntryDirLink.entry_id==id).first()
|
||||||
|
print( pdl )
|
||||||
|
|
||||||
|
# think this needs to just switch pdl.path_id to bin???
|
||||||
|
|
||||||
session.query(EntryDirLink).filter(EntryDirLink.entry_id==id).delete()
|
session.query(EntryDirLink).filter(EntryDirLink.entry_id==id).delete()
|
||||||
session.query(File).filter(File.eid==id).delete()
|
session.query(File).filter(File.eid==id).delete()
|
||||||
session.query(Entry).filter(Entry.id==id).delete()
|
session.query(Entry).filter(Entry.id==id).delete()
|
||||||
@@ -936,6 +954,7 @@ def CheckForDups(job):
|
|||||||
FinishJob(job, f"Finished looking for duplicates")
|
FinishJob(job, f"Finished looking for duplicates")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Actually moves the physical file from its current real directory to a subdir of the recycle bin path
|
||||||
def RemoveFileFromFS( del_me ):
|
def RemoveFileFromFS( del_me ):
|
||||||
try:
|
try:
|
||||||
settings = session.query(Settings).first()
|
settings = session.query(Settings).first()
|
||||||
|
|||||||
Reference in New Issue
Block a user