nascleanup + autoThumbs: flatten indexer layout, SMB rm, recursive tmp
This commit is contained in:
+43
-4
@@ -34,8 +34,13 @@ set "RELPATH=%WINPATH:~3%"
|
||||
set "RELPATH=%RELPATH:\=/%"
|
||||
set "NASPATH=/volume1/Hydra/%RELPATH%"
|
||||
|
||||
echo Seeding existing thumbnails on NAS (extract_eadir_to_tmp.sh)...
|
||||
ssh Hydra "bash -lc '~/extract_eadir_to_tmp.sh \"%NASPATH%\" || true'"
|
||||
echo Uploading extract_eadir_to_tmp.sh to NAS and seeding...
|
||||
if not exist "%~dp0extract_eadir_to_tmp.sh" (
|
||||
echo ERROR: extract_eadir_to_tmp.sh not found next to this batch file.
|
||||
goto END
|
||||
)
|
||||
ssh Hydra "cat > ~/extract_eadir_to_tmp.sh" < "%~dp0extract_eadir_to_tmp.sh"
|
||||
ssh Hydra "bash -lc 'if command -v dos2unix >/dev/null 2>&1; then dos2unix -f ~/extract_eadir_to_tmp.sh; else tr -d \"\r\" < ~/extract_eadir_to_tmp.sh > ~/extract_eadir_to_tmp.sh.tmp && mv ~/extract_eadir_to_tmp.sh.tmp ~/extract_eadir_to_tmp.sh; fi; chmod +x ~/extract_eadir_to_tmp.sh; ~/extract_eadir_to_tmp.sh \"%NASPATH%\" || true'"
|
||||
|
||||
REM Run psthumbgen.py
|
||||
python psthumbgen.py --directory "%WINPATH%"
|
||||
@@ -58,6 +63,7 @@ echo DEBUG: WINPATH = %WINPATH%
|
||||
echo DEBUG: RELPATH = %RELPATH%
|
||||
echo DEBUG: NASPATH = %NASPATH%
|
||||
echo.
|
||||
call :WIN_REMOVE_LOCAL_EADIR
|
||||
REM Ensure nascleanup.sh exists on NAS (upload + fix line endings), then run it
|
||||
echo Uploading nascleanup.sh to NAS and running cleanup...
|
||||
if not exist "%~dp0nascleanup.sh" (
|
||||
@@ -66,6 +72,7 @@ if not exist "%~dp0nascleanup.sh" (
|
||||
)
|
||||
ssh Hydra "cat > ~/nascleanup.sh" < "%~dp0nascleanup.sh"
|
||||
ssh Hydra "bash -lc 'if command -v dos2unix >/dev/null 2>&1; then dos2unix -f ~/nascleanup.sh; else tr -d \"\r\" < ~/nascleanup.sh > ~/nascleanup.sh.tmp && mv ~/nascleanup.sh.tmp ~/nascleanup.sh; fi; chmod +x ~/nascleanup.sh; ~/nascleanup.sh \"%NASPATH%\"'"
|
||||
call :WIN_REMOVE_LOCAL_EADIR_TMP
|
||||
goto END
|
||||
|
||||
:BOTH
|
||||
@@ -87,12 +94,20 @@ echo DEBUG: NASPATH = %NASPATH%
|
||||
echo.
|
||||
|
||||
REM Pre-seed eaDir_tmp from @eaDir on NAS before generation
|
||||
echo Seeding existing thumbnails on NAS (extract_eadir_to_tmp.sh)...
|
||||
ssh Hydra "bash -lc '~/extract_eadir_to_tmp.sh \"%NASPATH%\" || true'"
|
||||
echo Uploading extract_eadir_to_tmp.sh to NAS and seeding...
|
||||
if not exist "%~dp0extract_eadir_to_tmp.sh" (
|
||||
echo ERROR: extract_eadir_to_tmp.sh not found next to this batch file.
|
||||
goto END
|
||||
)
|
||||
ssh Hydra "cat > ~/extract_eadir_to_tmp.sh" < "%~dp0extract_eadir_to_tmp.sh"
|
||||
ssh Hydra "bash -lc 'if command -v dos2unix >/dev/null 2>&1; then dos2unix -f ~/extract_eadir_to_tmp.sh; else tr -d \"\r\" < ~/extract_eadir_to_tmp.sh > ~/extract_eadir_to_tmp.sh.tmp && mv ~/extract_eadir_to_tmp.sh.tmp ~/extract_eadir_to_tmp.sh; fi; chmod +x ~/extract_eadir_to_tmp.sh; ~/extract_eadir_to_tmp.sh \"%NASPATH%\" || true'"
|
||||
|
||||
REM Run psthumbgen.py
|
||||
python psthumbgen.py --directory "%WINPATH%"
|
||||
|
||||
REM Clear old @eaDir on the share via SMB (helps when NAS cp hits Permission denied on root-owned dirs)
|
||||
call :WIN_REMOVE_LOCAL_EADIR
|
||||
|
||||
REM SSH cleanup commands (run separately)
|
||||
REM Ensure nascleanup.sh exists on NAS (upload + fix line endings), then run it
|
||||
echo Uploading nascleanup.sh to NAS and running cleanup...
|
||||
@@ -102,6 +117,7 @@ if not exist "%~dp0nascleanup.sh" (
|
||||
)
|
||||
ssh Hydra "cat > ~/nascleanup.sh" < "%~dp0nascleanup.sh"
|
||||
ssh Hydra "bash -lc 'if command -v dos2unix >/dev/null 2>&1; then dos2unix -f ~/nascleanup.sh; else tr -d \"\r\" < ~/nascleanup.sh > ~/nascleanup.sh.tmp && mv ~/nascleanup.sh.tmp ~/nascleanup.sh; fi; chmod +x ~/nascleanup.sh; ~/nascleanup.sh \"%NASPATH%\"'"
|
||||
call :WIN_REMOVE_LOCAL_EADIR_TMP
|
||||
goto END
|
||||
|
||||
:FIX_ONEDRIVE
|
||||
@@ -147,5 +163,28 @@ echo 3. Your custom thumbnails should now have priority!
|
||||
echo.
|
||||
goto END
|
||||
|
||||
REM Remove folder-level @eaDir on the pasted Windows path (same files as NAS over SMB).
|
||||
:WIN_REMOVE_LOCAL_EADIR
|
||||
if "%WINPATH%"=="" goto :eof
|
||||
if exist "%WINPATH%\@eaDir" (
|
||||
echo Removing "%WINPATH%\@eaDir" via Windows ^(SMB share^)...
|
||||
rd /s /q "%WINPATH%\@eaDir" 2>nul
|
||||
if exist "%WINPATH%\@eaDir" (
|
||||
echo WARNING: Could not remove @eaDir; try PowerShell as admin or delete in Explorer.
|
||||
)
|
||||
)
|
||||
goto :eof
|
||||
|
||||
REM Remove every eaDir_tmp under pasted path (including subfolders e.g. gameplay\eaDir_tmp).
|
||||
:WIN_REMOVE_LOCAL_EADIR_TMP
|
||||
if "%WINPATH%"=="" goto :eof
|
||||
echo Removing all eaDir_tmp folders under "%WINPATH%" ^(recursive, SMB^)...
|
||||
if not exist "%~dp0remove_eadir_tmp_recursive.ps1" (
|
||||
echo ERROR: remove_eadir_tmp_recursive.ps1 not found next to this batch file.
|
||||
goto :eof
|
||||
)
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0remove_eadir_tmp_recursive.ps1" "%WINPATH%"
|
||||
goto :eof
|
||||
|
||||
:END
|
||||
pause
|
||||
Reference in New Issue
Block a user