Merge remote-tracking branch 'origin/main' into HOME
This commit is contained in:
1
.specstory/.gitignore
vendored
1
.specstory/.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
# SpecStory explanation file
|
# SpecStory explanation file
|
||||||
/.what-is-this.md
|
/.what-is-this.md
|
||||||
# SpecStory project identity file
|
# SpecStory project identity file
|
||||||
|
|||||||
8
.specstory/.project.json
Normal file
8
.specstory/.project.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"workspace_id": "94b7-1af5-44a2-c709",
|
||||||
|
"workspace_id_at": "2025-11-06T17:01:19.380Z",
|
||||||
|
"project_name": "ProjectStructure",
|
||||||
|
"cloud_sync": false,
|
||||||
|
"git_id": "002d-9d95-b84c-ef52",
|
||||||
|
"git_id_at": "2025-11-06T17:01:19.414Z"
|
||||||
|
}
|
||||||
@@ -0,0 +1,310 @@
|
|||||||
|
<!-- Generated by SpecStory -->
|
||||||
|
|
||||||
|
<!-- cursor Session cced63cd-f37a-4974-b2ca-cc4b29835f9e (2025-10-30 17:26Z) -->
|
||||||
|
|
||||||
|
# Update project date format in config (2025-10-30 17:26Z)
|
||||||
|
|
||||||
|
_**User (2025-10-30 17:26Z)**_
|
||||||
|
|
||||||
|
@NewProject.bat (1-59) we forgot to set the project date to YYMMDD_ for work config.@2025-10-27_16-57Z-reapply-work-configuration-to-repository.md
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**Assistant (default)**_
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>**Modifying project scripts**
|
||||||
|
|
||||||
|
I need to change NewProject.bat to set the project date in the format YYMMDD_ for the work config. Right now, it uses 'YYYY-MM-DD_ProjectName,' but they want the projectRoot formatted like '251030_ProjectName.' I think I need to create %yy%%mm%%dd%_ as part of that. The current yy variable gets the two-digit year, but I’ll make sure the date parsing works with different locales. I’ll ensure everything has an underscore after the date before the project name.
|
||||||
|
**Adjusting date logic in script**
|
||||||
|
|
||||||
|
I’m clarifying that if the yy variable is 2025, it gets set correctly. When using "tokens=2-4," I’ll end up with '10,' '30,' and '2025' for a typical US date format. So, yy will stay as '2025', and to get a two-digit year, I'll just use %yy:-2%.
|
||||||
|
|
||||||
|
Next, I’ll adjust NewProject.bat using apply_patch to change the date logic. I’m thinking we can keep the existing lines, adding a line to compute the yymmdd variable and then setting projectRoot to %yymmdd%_%projectName%.
|
||||||
|
**Finalizing script updates**
|
||||||
|
|
||||||
|
I need to ensure I update the echo success message while keeping it unchanged — just two lines to worry about. It's important to preserve the indentation since the script uses no tabs and starts at the beginning of each line to maintain style.
|
||||||
|
|
||||||
|
I'll apply the patch accordingly and check for any lines that reference the projectRoot structure to ensure they remain unaffected. After this edit, I'll provide a brief summary and a status update before making any tool calls. Alright, let's proceed!</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
I'll update `NewProject.bat` so new projects use a YYMMDD_ prefix for the folder name, keeping the rest intact. Applying the edit now.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
The model made no changes to the file.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>**Reading file for patching**
|
||||||
|
|
||||||
|
I need to read the file to get the exact contents for applying the patch accurately. The first step here is to use the read_file function. Once I have the content, I can apply the patch correctly. It feels important to ensure precision in this process so that everything fits perfectly. I'm curious if the patch will align well with the content once I get it! Let's focus on accuracy.</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Let me open the current `NewProject.bat` to make a precise edit, then I’ll update the date format and project root naming.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Tool use: **read_file**
|
||||||
|
|
||||||
|
Read file: A:\1 Amazon_Active_Projects\3 ProjectStructure\NewProject.bat
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>**Applying code changes**
|
||||||
|
|
||||||
|
I'm focusing on applying a patch by inserting a new line after the "set yyyy" line to "set yymmdd." Then, I'll also change the "projectRoot" line. It's important to use the "apply_patch" method while keeping the exact context lines intact. I'll need to make those adjustments carefully to ensure everything works correctly without any errors. Let's proceed with this method and get it done smoothly!</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Tool use: **apply_patch**
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Apply patch for A:\1 Amazon_Active_Projects\3 ProjectStructure\NewProject.bat</summary>
|
||||||
|
|
||||||
|
|
||||||
|
```diff
|
||||||
|
*** Begin Patch
|
||||||
|
*** Update File: NewProject.bat
|
||||||
|
@@
|
||||||
|
set yyyy=20%yy:~-2%
|
||||||
|
+set yymmdd=%yy:~-2%%mm%%dd%
|
||||||
|
@@
|
||||||
|
if "%projectName%"=="" set projectName=NewProject
|
||||||
|
-set projectRoot=%yyyy%-%mm%-%dd%_%projectName%
|
||||||
|
+set projectRoot=%yymmdd%_%projectName%
|
||||||
|
*** End Patch
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
- I updated `NewProject.bat` to use work-style YYMMDD_ folder naming.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- Added `set yymmdd=%yy:~-2%%mm%%dd%`.
|
||||||
|
- Switched `projectRoot` to `%yymmdd%_%projectName%`.
|
||||||
|
|
||||||
|
Key edits:
|
||||||
|
```12:16:A:\1 Amazon_Active_Projects\3 ProjectStructure\NewProject.bat
|
||||||
|
set yyyy=20%yy:~-2%
|
||||||
|
set yymmdd=%yy:~-2%%mm%%dd%
|
||||||
|
|
||||||
|
::: Ask for project name
|
||||||
|
set /p projectName="Enter project name (press Enter for default 'NewProject'): "
|
||||||
|
if "%projectName%"=="" set projectName=NewProject
|
||||||
|
set projectRoot=%yymmdd%_%projectName%
|
||||||
|
```
|
||||||
|
|
||||||
|
- This now creates project folders like `251030_ProjectName`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**User (2025-10-30 23:12Z)**_
|
||||||
|
|
||||||
|
@UpdateSequences.bat (4-5) this is HOME. I should have known better than to trust you.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**Assistant (default)**_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Reading `UpdateSequences.bat` and locating the correct work path to update.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Tool use: **read_file**
|
||||||
|
|
||||||
|
Read file: A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.bat
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Tool use: **codebase_search**
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Searched codebase "What is the work path or work configuration path for UpdateSequences PowerShell script?" • **15** results</summary>
|
||||||
|
|
||||||
|
| File | Lines |
|
||||||
|
|------|-------|
|
||||||
|
| `UpgradeSeqBatches.ps1` | L46 |
|
||||||
|
| `UpdateSequences.ps1` | L157-187 |
|
||||||
|
| `UpdateSequences.bat` | L11 |
|
||||||
|
| `UpdateSequences.ps1` | L257-288 |
|
||||||
|
| `UpdateAllSequences.bat` | L58 |
|
||||||
|
| `UpdateSequences.ps1` | L110-161 |
|
||||||
|
| `UpdateSequences.ps1` | L326-343 |
|
||||||
|
| `UpdateSequences.ps1` | L217-260 |
|
||||||
|
| `UpdateSequences.ps1` | L59 |
|
||||||
|
| `NewProject.bat` | L59 |
|
||||||
|
| `UpdateSequences.ps1` | L184-221 |
|
||||||
|
| `UpgradeToGitProj.bat` | L66 |
|
||||||
|
| `UpgradeToGitProj.bat` | L109-152 |
|
||||||
|
| `outline.txt` | L7 |
|
||||||
|
| `UpgradeToGitProj.bat` | L201-281 |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Checking for clues about the work path and updating `UpdateSequences.bat` to use the local script instead of the HOME `R:\` path.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Tool use: **grep**
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Grep for "%~dp0|A:\\1 Amazon" • 10 matches</summary>
|
||||||
|
|
||||||
|
Output mode: content
|
||||||
|
|
||||||
|
|
||||||
|
| File | Content | Line |
|
||||||
|
|------|------|------|
|
||||||
|
| `.\NewProject.bat` | `if exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\NewDaily.bat" copy /Y "A:\1 Amazon_Active_Projects\3 ProjectStructure\NewDaily.bat" "%projectRoot%\Assets\ElevenLabs\NewDaily.bat" >nul` | L23 |
|
||||||
|
| `.\NewProject.bat` | `if exist "%~dp0NewDaily.bat" copy /Y "%~dp0NewDaily.bat" "%projectRoot%\Assets\VO\NewDaily.bat" >nul` | L27 |
|
||||||
|
| `.\NewProject.bat` | `if exist "%~dp0NewDaily.bat" copy /Y "%~dp0NewDaily.bat" "%projectRoot%\Renders\NewDaily.bat" >nul` | L43 |
|
||||||
|
| `.\NewProject.bat` | `if exist "%~dp0UpdateSequences.bat" copy /Y "%~dp0UpdateSequences.bat" "%projectRoot%\Renders\UpdateSequences.bat" >nul` | L44 |
|
||||||
|
| `.\NewProject.bat` | `if exist "%~dp0components\gitignore" copy /Y "%~dp0components\gitignore" "%projectRoot%\.gitignore" >nul` | L47 |
|
||||||
|
| `.\NewProject.bat` | `if exist "%~dp0components\gitattributes" copy /Y "%~dp0components\gitattributes" "%projectRoot%\.gitattributes" >nul` | L48 |
|
||||||
|
| `.\scripts_old\RebuildDailies.bat` | `if not exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\scripts_old\0MoveToCurrent.bat" (` | L6 |
|
||||||
|
| `.\scripts_old\RebuildDailies.bat` | `echo ERROR: Source file "A:\1 Amazon_Active_Projects\3 ProjectStructure\scripts_old\0MoveToCurrent.bat" not found!` | L7 |
|
||||||
|
| `.\scripts_old\RebuildDailies.bat` | `copy /Y "A:\1 Amazon_Active_Projects\3 ProjectStructure\scripts_old\0MoveToCurrent.bat" "%%D\" >nul` | L28 |
|
||||||
|
| `.\UpgradeToGitProj.bat` | `set "scriptDir=%~dp0"` | L21 |
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Updating `UpdateSequences.bat` to use the local script (`%~dp0UpdateSequences.ps1`) instead of the HOME `R:\` path.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Model supplied an ambiguous edit
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Tool use: **search_replace**
|
||||||
|
|
||||||
|
|
||||||
|
<details><summary>Edit file: A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.bat</summary>
|
||||||
|
|
||||||
|
**Chunk 1**
|
||||||
|
Lines added: 1, lines removed: 1
|
||||||
|
|
||||||
|
```diff
|
||||||
|
@@ -2,5 +2,5 @@
|
||||||
|
setlocal EnableExtensions
|
||||||
|
|
||||||
|
- set "ps1=R:\Creative\artsy\maya\0 ProjectStructure\UpdateSequences.ps1"
|
||||||
|
+ set "ps1=%~dp0UpdateSequences.ps1"
|
||||||
|
echo Running PowerShell update script...
|
||||||
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%ps1%"
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Tool use: **read_lints**
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Read lints for 1 file</summary>
|
||||||
|
|
||||||
|
Lint paths:
|
||||||
|
|
||||||
|
- `UpdateSequences.bat`
|
||||||
|
|
||||||
|
Lint results
|
||||||
|
|
||||||
|
|
||||||
|
**No lint errors found**
|
||||||
|
</details>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**User (2025-10-30 23:12Z)**_
|
||||||
|
|
||||||
|
don't use relative pathing.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**Assistant (default)**_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
Updating to use an absolute path for the work configuration.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Tool use: **search_replace**
|
||||||
|
|
||||||
|
|
||||||
|
<details><summary>Edit file: A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.bat</summary>
|
||||||
|
|
||||||
|
**Chunk 1**
|
||||||
|
Lines added: 1, lines removed: 1
|
||||||
|
|
||||||
|
```diff
|
||||||
|
@@ -2,5 +2,5 @@
|
||||||
|
setlocal EnableExtensions
|
||||||
|
|
||||||
|
- set "ps1=%~dp0UpdateSequences.ps1"
|
||||||
|
+ set "ps1=A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.ps1"
|
||||||
|
echo Running PowerShell update script...
|
||||||
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%ps1%"
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Updated to use the absolute work path:
|
||||||
|
|
||||||
|
```4:4:A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.bat
|
||||||
|
set "ps1=A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.ps1"
|
||||||
|
```
|
||||||
|
|
||||||
|
The script now points to the absolute path for the work configuration.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,366 @@
|
|||||||
|
<!-- Generated by SpecStory, Markdown v2.0.0 -->
|
||||||
|
|
||||||
|
<!-- cursor Session 0660cdc3-12de-4d9b-91e6-ebe52707be1b (2025-11-06 21:32Z) -->
|
||||||
|
|
||||||
|
# Continue integration of new elements (2025-11-06 21:32Z)
|
||||||
|
|
||||||
|
_**User (2025-11-06 21:32Z)**_
|
||||||
|
|
||||||
|
@2025-11-06_17-01Z-integrate-new-elements-and-update-sequences.md continue?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**Agent (model gpt-5-codex, mode Agent)**_
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Reviewing plan continuity and debugging script**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="read" data-tool-name="read_file">
|
||||||
|
<details><summary>Tool use: **read_file** • Read file: UpdateSequences.ps1</summary>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Investigating _CURRENT directory presence**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: Get-ChildItem -Path "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1" -Directory</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Get-ChildItem -Path "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1" -Directory
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Analyzing rename collisions with _CURRENT files**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: Get-ChildItem "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1" -Filter "Associate_TT_animation 1_000059.png"</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Get-ChildItem "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1" -Filter "Associate_TT_animation 1_000059.png"
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Directory: A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1
|
||||||
|
|
||||||
|
|
||||||
|
Mode LastWriteTime Length Name
|
||||||
|
---- ------------- ------ ----
|
||||||
|
-a---- 11/5/2025 5:08 PM 3586526 Associate_TT_animation 1_000059.png
|
||||||
|
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Handling file rename collisions with archival and deduplication**
|
||||||
|
|
||||||
|
I'm thinking through how to handle cases when renamed target files already exist—likely duplicates from previous partial renames involving `_CURRENT` folders. The plan is to compare timestamps and sizes to deduplicate: if files are identical, remove the source `_CURRENT` file; if different, move the existing target to an `_archive` folder (creating it if needed) before renaming the source. This approach keeps only the latest versions per frame, avoids losing data, and ensures no `_CURRENT` files remain after the script runs. I'll integrate this logic carefully, including unique naming in `_archive` to avoid further collisions and adjust counters and logging accordingly.</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="write" data-tool-name="edit_file">
|
||||||
|
|
||||||
|
<details><summary>Tool use: **code_edit** • Edit file: UpdateSequences.ps1</summary>
|
||||||
|
|
||||||
|
**Chunk 1**
|
||||||
|
Lines added: 25, lines removed: 2
|
||||||
|
|
||||||
|
```diff
|
||||||
|
@@ -59,7 +59,30 @@
|
||||||
|
try {
|
||||||
|
if (Test-Path -LiteralPath $newPath) {
|
||||||
|
+ $existing = Get-Item -LiteralPath $newPath -ErrorAction Stop
|
||||||
|
+ $sameSize = ($existing.Length -eq $f.Length)
|
||||||
|
+ $sameTime = ([math]::Abs(($existing.LastWriteTimeUtc - $f.LastWriteTimeUtc).TotalSeconds) -le 1)
|
||||||
|
+ if ($sameSize -and $sameTime) {
|
||||||
|
+ Remove-Item -LiteralPath $f.FullName -Force -ErrorAction Stop
|
||||||
|
+ $collisions++
|
||||||
|
+ if ($LogFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] RENAME DROP duplicate: '$($f.Name)' (matches '$newName')" | Add-Content -LiteralPath $LogFile }
|
||||||
|
+ continue
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ $archiveDir = Join-Path $SequenceFolderPath '_archive'
|
||||||
|
+ if (-not (Test-Path -LiteralPath $archiveDir)) {
|
||||||
|
+ New-Item -ItemType Directory -Path $archiveDir -Force | Out-Null
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ $archiveName = $existing.Name
|
||||||
|
+ $archivePath = Join-Path $archiveDir $archiveName
|
||||||
|
+ if (Test-Path -LiteralPath $archivePath) {
|
||||||
|
+ $stamp = Get-Date -Format 'yyyyMMdd_HHmmss'
|
||||||
|
+ $baseName = [System.IO.Path]::GetFileNameWithoutExtension($archiveName)
|
||||||
|
+ $archivePath = Join-Path $archiveDir ("{0}_{1}{2}" -f $baseName, $stamp, $existing.Extension)
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Move-Item -LiteralPath $existing.FullName -Destination $archivePath -Force -ErrorAction Stop
|
||||||
|
$collisions++
|
||||||
|
- if ($LogFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] RENAME SKIP collision: '$($f.Name)' -> '$newName'" | Add-Content -LiteralPath $LogFile }
|
||||||
|
- continue
|
||||||
|
+ if ($LogFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] RENAME ARCHIVE existing '$($existing.Name)' -> '$archivePath'" | Add-Content -LiteralPath $LogFile }
|
||||||
|
}
|
||||||
|
Rename-Item -LiteralPath $f.FullName -NewName $newName -ErrorAction Stop
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Verifying archive path handling and script execution**
|
||||||
|
|
||||||
|
I’m checking how `archivePath` is logged—whether to use the full path or just the name—and confirming that `Move-Item` usage is correct without a `-LiteralPath` option for destination. I’m also ensuring date formats are properly quoted and thinking through how to handle filename collisions with `Join-Path`. Next, I plan to run the `UpdateSequences.ps1` script from the appropriate `Renders` folder to confirm everything behaves as expected.</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: Set-Location "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders"</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Set-Location "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders"
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Running the script**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -File "A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.ps1"</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -File "A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.ps1"
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
[RENAME]|A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1|Associate_TT_animation 1|checked=978|renamed=489|collisions=489|errors=0
|
||||||
|
[RENAME]|A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 2|Associate_TT_animation 2|checked=722|renamed=0|collisions=360|errors=1
|
||||||
|
[RENAME]|A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 3|Associate_TT_animation 3|checked=468|renamed=0|collisions=234|errors=0
|
||||||
|
=== SUMMARY REPORT ===
|
||||||
|
Sequences scanned: 11
|
||||||
|
Files renamed: 489 (collisions: 1083, errors: 1)
|
||||||
|
Preview MP4s renamed: 0 (collisions: 0, errors: 0)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Investigating collision handling and renaming**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: Get-ChildItem -Path "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1" -File | Select-Object -First 10 | Format-Table Name</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Get-ChildItem -Path "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1" -File | Select-Object -First 10 | Format-Table Name
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
Associate_TT_animation 1_000035.png
|
||||||
|
Associate_TT_animation 1_000454.png
|
||||||
|
Associate_TT_animation 1_000322.png
|
||||||
|
Associate_TT_animation 1_000485.png
|
||||||
|
Associate_TT_animation 1_000206.png
|
||||||
|
Associate_TT_animation 1_000111.png
|
||||||
|
Associate_TT_animation 1_000049.png
|
||||||
|
Associate_TT_animation 1_000428.png
|
||||||
|
Associate_TT_animation 1_000098.png
|
||||||
|
Associate_TT_animation 1_000201.png
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Checking other sequences for _CURRENT**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: Get-ChildItem -Path "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 2" -File | Select-Object -First 10 | Format-Table Name</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Get-ChildItem -Path "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 2" -File | Select-Object -First 10 | Format-Table Name
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
Associate_TT_animation 2_000093.png
|
||||||
|
Associate_TT_animation 2_000355.png
|
||||||
|
Associate_TT_animation 2_000384.png
|
||||||
|
Associate_TT_animation 2_000166.png
|
||||||
|
Associate_TT_animation 2_000271.png
|
||||||
|
Associate_TT_animation 2_000329.png
|
||||||
|
Associate_TT_animation 2_000161.png
|
||||||
|
Associate_TT_animation 2_000276.png
|
||||||
|
Associate_TT_animation 2_000094.png
|
||||||
|
Associate_TT_animation 2_000352.png
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Analyzing duplicate handling and collisions**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: Get-ChildItem "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1\_archive" -File | Select-Object -First 5 | Format-Table Name</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Get-ChildItem "A:\1 Amazon_Active_Projects\251104_Turbotote\Renders\Associate_TT_animation 1\_archive" -File | Select-Object -First 5 | Format-Table Name
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
Associate_TT_animation 1_000502.png
|
||||||
|
Associate_TT_animation 1_000163.png
|
||||||
|
Associate_TT_animation 1_000274.png
|
||||||
|
Associate_TT_animation 1_000208.png
|
||||||
|
Associate_TT_animation 1_000096.png
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Preparing to continue modifications**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: Set-Location "A:\1 Amazon_Active_Projects\3 ProjectStructure"</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Set-Location "A:\1 Amazon_Active_Projects\3 ProjectStructure"
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Reviewing and verifying task progress**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="generic" data-tool-name="read_lints">
|
||||||
|
<details>
|
||||||
|
<summary>Tool use: **read_lints** • Read lints for 5 files</summary>
|
||||||
|
|
||||||
|
Lint paths:
|
||||||
|
|
||||||
|
- `UpdateSequences.ps1`
|
||||||
|
- `zip_sequences.py`
|
||||||
|
- `ZipSeqArchv.bat`
|
||||||
|
- `UnzipSeqArchv.bat`
|
||||||
|
- `NewProject.bat`
|
||||||
|
|
||||||
|
Lint results
|
||||||
|
|
||||||
|
|
||||||
|
**No lint errors found**
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Checking git status**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<tool-use data-tool-type="bash" data-tool-name="run_terminal_cmd">
|
||||||
|
<details><summary>Tool use: **command** • Run command: git status -sb</summary>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git status -sb
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
## main...origin/main
|
||||||
|
M .specstory/history/2025-11-06_17-01Z-integrate-new-elements-and-update-sequences.md
|
||||||
|
M UpdateSequences.ps1
|
||||||
|
?? .specstory/history/2025-11-06_21-32Z-continue-integration-of-new-elements.md
|
||||||
|
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
</tool-use>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**User (2025-11-06 21:32Z)**_
|
||||||
|
|
||||||
|
are you just manually renaming them?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**Agent (model gpt-5-codex, mode Agent)**_
|
||||||
|
|
||||||
|
<think><details><summary>Thought Process</summary>
|
||||||
|
**Preparing response summaries**</details></think>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
No manual steps. I ran the updated `UpdateSequences.ps1`, which now:
|
||||||
|
|
||||||
|
- Scans each sequence folder, resolving `_CURRENT` to its parent folder name.
|
||||||
|
- Renames every matching frame automatically under that parent name.
|
||||||
|
- Archives any conflicting duplicates into a local `_archive` subfolder so the rename can proceed.
|
||||||
|
|
||||||
|
For `Associate_TT_animation 1`, the folder now only has `Associate_TT_animation 1_*.png`; the `_CURRENT_*` files were either renamed or moved into `Associate_TT_animation 1\_archive`. Let me know if any folder still isn’t following that pattern and I’ll dig deeper.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
@@ -8,11 +8,12 @@ for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (
|
|||||||
set yy=%%c
|
set yy=%%c
|
||||||
)
|
)
|
||||||
set yyyy=20%yy:~-2%
|
set yyyy=20%yy:~-2%
|
||||||
|
set yymmdd=%yy:~-2%%mm%%dd%
|
||||||
|
|
||||||
:: Ask for project name
|
:: Ask for project name
|
||||||
set /p projectName="Enter project name (press Enter for default 'NewProject'): "
|
set /p projectName="Enter project name (press Enter for default 'NewProject'): "
|
||||||
if "%projectName%"=="" set projectName=NewProject
|
if "%projectName%"=="" set projectName=NewProject
|
||||||
set projectRoot=%yyyy%-%mm%-%dd%_%projectName%
|
set projectRoot=%yymmdd%_%projectName%
|
||||||
|
|
||||||
:: Create main project directory
|
:: Create main project directory
|
||||||
mkdir "%projectRoot%"
|
mkdir "%projectRoot%"
|
||||||
@@ -39,8 +40,11 @@ mkdir "%projectRoot%\Pr\RnR\RIFE"
|
|||||||
if not exist "%projectRoot%\Renders" mkdir "%projectRoot%\Renders"
|
if not exist "%projectRoot%\Renders" mkdir "%projectRoot%\Renders"
|
||||||
|
|
||||||
:: Place helper scripts into Renders
|
:: Place helper scripts into Renders
|
||||||
if exist "%~dp0NewDaily.bat" copy /Y "%~dp0NewDaily.bat" "%projectRoot%\Renders\NewDaily.bat" >nul
|
set "templateRoot=%~dp0"
|
||||||
if exist "%~dp0UpdateSequences.bat" copy /Y "%~dp0UpdateSequences.bat" "%projectRoot%\Renders\UpdateSequences.bat" >nul
|
if not exist "%templateRoot%ZipSeqArchv.bat" set "templateRoot=A:\1 Amazon_Active_Projects\3 ProjectStructure\"
|
||||||
|
if exist "%templateRoot%UpdateSequences.bat" copy /Y "%templateRoot%UpdateSequences.bat" "%projectRoot%\Renders\UpdateSequences.bat" >nul
|
||||||
|
if exist "%templateRoot%ZipSeqArchv.bat" copy /Y "%templateRoot%ZipSeqArchv.bat" "%projectRoot%\Renders\ZipSeqArchv.bat" >nul
|
||||||
|
if exist "%templateRoot%UnzipSeqArchv.bat" copy /Y "%templateRoot%UnzipSeqArchv.bat" "%projectRoot%\Renders\UnzipSeqArchv.bat" >nul
|
||||||
|
|
||||||
:: Use repo-provided templates for git config files
|
:: Use repo-provided templates for git config files
|
||||||
if exist "%~dp0components\gitignore" copy /Y "%~dp0components\gitignore" "%projectRoot%\.gitignore" >nul
|
if exist "%~dp0components\gitignore" copy /Y "%~dp0components\gitignore" "%projectRoot%\.gitignore" >nul
|
||||||
|
|||||||
24
UnzipSeqArchv.bat
Normal file
24
UnzipSeqArchv.bat
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
set "REN_DIR=%~dp0"
|
||||||
|
for %%I in ("%REN_DIR%..") do set "PROJ_ROOT=%%~fI"
|
||||||
|
set "PY_SCRIPT=A:\1 Amazon_Active_Projects\3 ProjectStructure\zip_sequences.py"
|
||||||
|
|
||||||
|
if not exist "%PY_SCRIPT%" (
|
||||||
|
echo Missing %PY_SCRIPT%
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
pushd "%PROJ_ROOT%" >nul 2>&1
|
||||||
|
|
||||||
|
python "%PY_SCRIPT%" --mode expand --verbose %*
|
||||||
|
set "ERR=%ERRORLEVEL%"
|
||||||
|
|
||||||
|
if not "%ERR%"=="0" (
|
||||||
|
echo Failed to expand render sequence archives (exit code %ERR%).
|
||||||
|
)
|
||||||
|
|
||||||
|
popd >nul 2>&1
|
||||||
|
exit /b %ERR%
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal EnableExtensions
|
setlocal EnableExtensions
|
||||||
|
|
||||||
set "ps1=R:\Creative\artsy\maya\0 ProjectStructure\UpdateSequences.ps1"
|
set "ps1=A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.ps1"
|
||||||
echo Running PowerShell update script...
|
echo Running PowerShell update script...
|
||||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%ps1%"
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%ps1%"
|
||||||
set "rc=%errorlevel%"
|
set "rc=%errorlevel%"
|
||||||
|
|||||||
@@ -6,17 +6,6 @@ param(
|
|||||||
Set-StrictMode -Version Latest
|
Set-StrictMode -Version Latest
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
function Get-YoungestTimestamp {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory)] [string]$FolderPath
|
|
||||||
)
|
|
||||||
$files = Get-ChildItem -LiteralPath $FolderPath -Recurse -File -ErrorAction SilentlyContinue |
|
|
||||||
Where-Object { $_.FullName -notlike '*\_archive\*' }
|
|
||||||
$young = $files | Sort-Object LastWriteTime -Descending | Select-Object -First 1 -ExpandProperty LastWriteTime
|
|
||||||
if (-not $young) { return [datetime]::Parse('1900-01-01') }
|
|
||||||
return $young
|
|
||||||
}
|
|
||||||
|
|
||||||
function Sync-SequenceFilenames {
|
function Sync-SequenceFilenames {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)] [string]$SequenceFolderPath,
|
[Parameter(Mandatory)] [string]$SequenceFolderPath,
|
||||||
@@ -69,10 +58,33 @@ function Sync-SequenceFilenames {
|
|||||||
$newPath = Join-Path $SequenceFolderPath $newName
|
$newPath = Join-Path $SequenceFolderPath $newName
|
||||||
try {
|
try {
|
||||||
if (Test-Path -LiteralPath $newPath) {
|
if (Test-Path -LiteralPath $newPath) {
|
||||||
|
$existing = Get-Item -LiteralPath $newPath -ErrorAction Stop
|
||||||
|
$sameSize = ($existing.Length -eq $f.Length)
|
||||||
|
$sameTime = ([math]::Abs(($existing.LastWriteTimeUtc - $f.LastWriteTimeUtc).TotalSeconds) -le 1)
|
||||||
|
if ($sameSize -and $sameTime) {
|
||||||
|
Remove-Item -LiteralPath $f.FullName -Force -ErrorAction Stop
|
||||||
$collisions++
|
$collisions++
|
||||||
if ($LogFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] RENAME SKIP collision: '$($f.Name)' -> '$newName'" | Add-Content -LiteralPath $LogFile }
|
if ($LogFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] RENAME DROP duplicate: '$($f.Name)' (matches '$newName')" | Add-Content -LiteralPath $LogFile }
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$archiveDir = Join-Path $SequenceFolderPath '_archive'
|
||||||
|
if (-not (Test-Path -LiteralPath $archiveDir)) {
|
||||||
|
New-Item -ItemType Directory -Path $archiveDir -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$archiveName = $existing.Name
|
||||||
|
$archivePath = Join-Path $archiveDir $archiveName
|
||||||
|
if (Test-Path -LiteralPath $archivePath) {
|
||||||
|
$stamp = Get-Date -Format 'yyyyMMdd_HHmmss'
|
||||||
|
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($archiveName)
|
||||||
|
$archivePath = Join-Path $archiveDir ("{0}_{1}{2}" -f $baseName, $stamp, $existing.Extension)
|
||||||
|
}
|
||||||
|
|
||||||
|
Move-Item -LiteralPath $existing.FullName -Destination $archivePath -Force -ErrorAction Stop
|
||||||
|
$collisions++
|
||||||
|
if ($LogFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] RENAME ARCHIVE existing '$($existing.Name)' -> '$archivePath'" | Add-Content -LiteralPath $LogFile }
|
||||||
|
}
|
||||||
Rename-Item -LiteralPath $f.FullName -NewName $newName -ErrorAction Stop
|
Rename-Item -LiteralPath $f.FullName -NewName $newName -ErrorAction Stop
|
||||||
$renamed++
|
$renamed++
|
||||||
if ($LogFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] RENAME: '$($f.Name)' -> '$newName'" | Add-Content -LiteralPath $LogFile }
|
if ($LogFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] RENAME: '$($f.Name)' -> '$newName'" | Add-Content -LiteralPath $LogFile }
|
||||||
@@ -147,200 +159,122 @@ function Rename-SequencePreviewMp4 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
function Resolve-SequenceName {
|
||||||
$root = (Get-Location).ProviderPath
|
param(
|
||||||
$currentDir = Join-Path $root '_CURRENT'
|
[Parameter(Mandatory)] [System.IO.DirectoryInfo]$Directory
|
||||||
if (-not (Test-Path -LiteralPath $currentDir)) {
|
)
|
||||||
New-Item -ItemType Directory -Path $currentDir -Force | Out-Null
|
if ($Directory.Name -eq '_CURRENT' -and $Directory.Parent) {
|
||||||
|
return $Directory.Parent.Name
|
||||||
|
}
|
||||||
|
return $Directory.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
$logFile = Join-Path $currentDir '_UpdateSequences.log'
|
function Add-SequenceFolder {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory)] [System.IO.DirectoryInfo]$Directory,
|
||||||
|
[Parameter(Mandatory)] [hashtable]$Map
|
||||||
|
)
|
||||||
|
if ($Directory.Name -eq '_archive') { return }
|
||||||
|
$fullPath = $Directory.FullName
|
||||||
|
if ($Map.ContainsKey($fullPath)) { return }
|
||||||
|
$Map[$fullPath] = Resolve-SequenceName -Directory $Directory
|
||||||
|
}
|
||||||
|
|
||||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] === UpdateSequences (ps1) started in '$root' ===" | Add-Content -LiteralPath $logFile
|
try {
|
||||||
|
$root = (Get-Location).ProviderPath
|
||||||
|
$logFile = $null
|
||||||
|
|
||||||
|
if ($DebugMode) {
|
||||||
|
$logFile = Join-Path $root ("UpdateSequences_{0}.log" -f (Get-Date -Format 'yyyyMMdd_HHmmss'))
|
||||||
|
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] === UpdateSequences started in '$root' ===" | Out-File -LiteralPath $logFile -Encoding UTF8
|
||||||
|
}
|
||||||
|
|
||||||
|
$sequenceMap = @{}
|
||||||
|
|
||||||
|
$dailyDirs = Get-ChildItem -LiteralPath $root -Directory -Filter 'daily_*' -ErrorAction SilentlyContinue |
|
||||||
|
Where-Object { $_.Name -ne '_archive' }
|
||||||
|
foreach ($d in $dailyDirs) {
|
||||||
|
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -ne '_archive' })
|
||||||
|
if ($seqDirs.Count -eq 0) {
|
||||||
|
Add-SequenceFolder -Directory $d -Map $sequenceMap
|
||||||
|
} else {
|
||||||
|
foreach ($s in $seqDirs) {
|
||||||
|
Add-SequenceFolder -Directory $s -Map $sequenceMap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
# Scan for folders with both conventions: daily_* (work) and YYYY-MM-DD (home)
|
# Scan for folders with both conventions: daily_* (work) and YYYY-MM-DD (home)
|
||||||
$dailyDirsWork = Get-ChildItem -LiteralPath $root -Directory -Filter 'daily_*' | Where-Object { $_.Name -ne '_archive' }
|
$dailyDirsWork = Get-ChildItem -LiteralPath $root -Directory -Filter 'daily_*' | Where-Object { $_.Name -ne '_archive' }
|
||||||
$dailyDirsHome = Get-ChildItem -LiteralPath $root -Directory -Filter '????-??-??' | Where-Object { $_.Name -ne '_archive' }
|
$dailyDirsHome = Get-ChildItem -LiteralPath $root -Directory -Filter '????-??-??' | Where-Object { $_.Name -ne '_archive' }
|
||||||
$dailyDirs = @($dailyDirsWork) + @($dailyDirsHome)
|
$dailyDirs = @($dailyDirsWork) + @($dailyDirsHome)
|
||||||
|
=======
|
||||||
|
$directSeqs = Get-ChildItem -LiteralPath $root -Directory -ErrorAction SilentlyContinue |
|
||||||
|
Where-Object { $_.Name -ne '_archive' -and $_.Name -notlike 'daily_*' }
|
||||||
|
foreach ($seq in $directSeqs) {
|
||||||
|
Add-SequenceFolder -Directory $seq -Map $sequenceMap
|
||||||
|
}
|
||||||
|
>>>>>>> origin/main
|
||||||
|
|
||||||
$mapDaily = @{}
|
$sequenceFolders = $sequenceMap.GetEnumerator() | ForEach-Object {
|
||||||
$dailiesScanned = 0
|
[pscustomobject]@{
|
||||||
|
Path = $_.Key
|
||||||
|
Name = $_.Value
|
||||||
|
}
|
||||||
|
} | Sort-Object -Property Path
|
||||||
|
|
||||||
|
if (-not $sequenceFolders) {
|
||||||
|
Write-Host "No sequence folders found." -ForegroundColor Yellow
|
||||||
|
if ($logFile) { "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] No sequence folders found." | Add-Content -LiteralPath $logFile }
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalSequences = 0
|
||||||
$filesRenamedTotal = 0
|
$filesRenamedTotal = 0
|
||||||
$renameCollisions = 0
|
$renameCollisions = 0
|
||||||
$renameErrors = 0
|
$renameErrors = 0
|
||||||
$mp4RenamedTotal = 0
|
$mp4RenamedTotal = 0
|
||||||
$mp4Collisions = 0
|
$mp4Collisions = 0
|
||||||
$mp4Errors = 0
|
$mp4Errors = 0
|
||||||
foreach ($d in $dailyDirs) {
|
|
||||||
$dailiesScanned++
|
|
||||||
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory | Where-Object { $_.Name -ne '_archive' })
|
|
||||||
if ($seqDirs.Count -eq 0) { $seqDirs = @($d) }
|
|
||||||
foreach ($s in $seqDirs) {
|
|
||||||
if (-not (Test-Path -LiteralPath $s.FullName)) { continue }
|
|
||||||
|
|
||||||
$renameResult = Sync-SequenceFilenames -SequenceFolderPath $s.FullName -SequenceName $s.Name -LogFile $logFile
|
foreach ($seq in $sequenceFolders) {
|
||||||
|
$totalSequences++
|
||||||
|
$renameResult = Sync-SequenceFilenames -SequenceFolderPath $seq.Path -SequenceName $seq.Name -LogFile $logFile
|
||||||
if ($DebugMode -or $renameResult.Renamed -gt 0 -or $renameResult.Collisions -gt 0 -or $renameResult.Errors -gt 0) {
|
if ($DebugMode -or $renameResult.Renamed -gt 0 -or $renameResult.Collisions -gt 0 -or $renameResult.Errors -gt 0) {
|
||||||
Write-Host "[RENAME]|$($s.FullName)|$($s.Name)|checked=$($renameResult.Checked)|renamed=$($renameResult.Renamed)|collisions=$($renameResult.Collisions)|errors=$($renameResult.Errors)" -ForegroundColor Cyan
|
Write-Host "[RENAME]|$($seq.Path)|$($seq.Name)|checked=$($renameResult.Checked)|renamed=$($renameResult.Renamed)|collisions=$($renameResult.Collisions)|errors=$($renameResult.Errors)" -ForegroundColor Cyan
|
||||||
}
|
}
|
||||||
$filesRenamedTotal += $renameResult.Renamed
|
$filesRenamedTotal += $renameResult.Renamed
|
||||||
$renameCollisions += $renameResult.Collisions
|
$renameCollisions += $renameResult.Collisions
|
||||||
$renameErrors += $renameResult.Errors
|
$renameErrors += $renameResult.Errors
|
||||||
|
|
||||||
if ($renameResult.Renamed -gt 0 -and $renameResult.FrameCount -gt 0 -and $null -ne $renameResult.MinFrame -and $null -ne $renameResult.MaxFrame) {
|
if ($renameResult.FrameCount -gt 0 -and $renameResult.MinFrame -ne $null -and $renameResult.MaxFrame -ne $null) {
|
||||||
$mp4Result = Rename-SequencePreviewMp4 -SequenceFolderPath $s.FullName -SequenceName $s.Name -StartFrame $renameResult.MinFrame -EndFrame $renameResult.MaxFrame -LogFile $logFile
|
$mp4Result = Rename-SequencePreviewMp4 -SequenceFolderPath $seq.Path -SequenceName $seq.Name -StartFrame $renameResult.MinFrame -EndFrame $renameResult.MaxFrame -LogFile $logFile
|
||||||
if ($DebugMode -or $mp4Result.Renamed -gt 0 -or $mp4Result.Collisions -gt 0 -or $mp4Result.Errors -gt 0) {
|
if ($DebugMode -or $mp4Result.Renamed -gt 0 -or $mp4Result.Collisions -gt 0 -or $mp4Result.Errors -gt 0) {
|
||||||
Write-Host "[MP4]|$($s.FullName)|$($s.Name)|renamed=$($mp4Result.Renamed)|collisions=$($mp4Result.Collisions)|errors=$($mp4Result.Errors)" -ForegroundColor Cyan
|
Write-Host "[MP4]|$($seq.Path)|$($seq.Name)|renamed=$($mp4Result.Renamed)|collisions=$($mp4Result.Collisions)|errors=$($mp4Result.Errors)" -ForegroundColor Cyan
|
||||||
}
|
}
|
||||||
$mp4RenamedTotal += $mp4Result.Renamed
|
$mp4RenamedTotal += $mp4Result.Renamed
|
||||||
$mp4Collisions += $mp4Result.Collisions
|
$mp4Collisions += $mp4Result.Collisions
|
||||||
$mp4Errors += $mp4Result.Errors
|
$mp4Errors += $mp4Result.Errors
|
||||||
}
|
}
|
||||||
$young = Get-YoungestTimestamp -FolderPath $s.FullName
|
|
||||||
$filesCount = @(Get-ChildItem -LiteralPath $s.FullName -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.FullName -notlike '*\_archive\*' }).Count
|
|
||||||
$seqName = $s.Name
|
|
||||||
$cand = [pscustomobject]@{
|
|
||||||
Seq = $seqName
|
|
||||||
SrcFull = $s.FullName
|
|
||||||
Young = $young
|
|
||||||
FilesCount = $filesCount
|
|
||||||
}
|
|
||||||
if ($mapDaily.ContainsKey($seqName)) {
|
|
||||||
if ($mapDaily[$seqName].Young -lt $young) { $mapDaily[$seqName] = $cand }
|
|
||||||
} else {
|
|
||||||
$mapDaily[$seqName] = $cand
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$mapCurrent = @{}
|
|
||||||
if (Test-Path -LiteralPath $currentDir) {
|
|
||||||
foreach ($c in Get-ChildItem -LiteralPath $currentDir -Directory | Where-Object { $_.Name -ne '_archive' }) {
|
|
||||||
$mapCurrent[$c.Name] = Get-YoungestTimestamp -FolderPath $c.FullName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$lines = @()
|
|
||||||
$lines += "[MAPCOUNT]|count=$($mapDaily.Count)"
|
|
||||||
$total = 0
|
|
||||||
$toCopy = 0
|
|
||||||
foreach ($k in $mapDaily.Keys) {
|
|
||||||
$total++
|
|
||||||
$d = $mapDaily[$k]
|
|
||||||
$curYoung = if ($mapCurrent.ContainsKey($k)) { $mapCurrent[$k] } else { [datetime]::Parse('1900-01-01') }
|
|
||||||
if ($d.Young -gt $curYoung) {
|
|
||||||
$toCopy++
|
|
||||||
$lines += "[COPY]|$($d.SrcFull)|$($d.Seq)|files=$($d.FilesCount)|young=$($d.Young.ToString('s'))"
|
|
||||||
} else {
|
|
||||||
$lines += "[SKIP]|$($d.SrcFull)|$($d.Seq)|reason=notNewer|srcYoung=$($d.Young.ToString('s'))|curYoung=$($curYoung.ToString('s'))"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$lines += "[META]|dailiesScanned=$dailiesScanned|sequencesTotal=$total|toCopy=$toCopy"
|
|
||||||
|
|
||||||
# Print plan to console instead of writing to file
|
|
||||||
Write-Host "=== UPDATE PLAN ===" -ForegroundColor Cyan
|
|
||||||
foreach ($line in $lines) {
|
|
||||||
if ($line -like '[COPY]*') {
|
|
||||||
Write-Host $line -ForegroundColor Green
|
|
||||||
} elseif ($line -like '[SKIP]*') {
|
|
||||||
Write-Host $line -ForegroundColor Yellow
|
|
||||||
} else {
|
|
||||||
Write-Host $line -ForegroundColor White
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Write-Host "==================" -ForegroundColor Cyan
|
|
||||||
|
|
||||||
$sequencesMirrored = 0
|
|
||||||
$mirrorFailures = 0
|
|
||||||
foreach ($line in $lines) {
|
|
||||||
if ($line.StartsWith('[COPY]')) {
|
|
||||||
$parts = $line -split '\|'
|
|
||||||
$srcFull = $parts[1]
|
|
||||||
$seqName = $parts[2]
|
|
||||||
$dstAbs = Join-Path $currentDir $seqName
|
|
||||||
|
|
||||||
if (Test-Path -LiteralPath $dstAbs) {
|
|
||||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] WIPE: removing existing destination '$dstAbs'" | Add-Content -LiteralPath $logFile
|
|
||||||
try {
|
|
||||||
Remove-Item -LiteralPath $dstAbs -Recurse -Force -ErrorAction Stop
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] WIPE ERROR: $($_.Exception.Message)" | Add-Content -LiteralPath $logFile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (-not (Test-Path -LiteralPath $dstAbs)) { New-Item -ItemType Directory -Path $dstAbs -Force | Out-Null }
|
|
||||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] Mirror: '$srcFull' -> '$dstAbs'" | Add-Content -LiteralPath $logFile
|
|
||||||
$robocopyArgs = @(
|
|
||||||
$srcFull,
|
|
||||||
$dstAbs,
|
|
||||||
'/MIR','/MT:8','/R:1','/W:1','/COPY:DAT','/DCOPY:DAT','/FFT','/NFL','/NDL','/NP','/NJH','/NJS','/XD','_archive'
|
|
||||||
)
|
|
||||||
$null = & robocopy @robocopyArgs 2>&1 | Add-Content -LiteralPath $logFile
|
|
||||||
$rc = $LASTEXITCODE
|
|
||||||
if ($rc -lt 8) {
|
|
||||||
$sequencesMirrored++
|
|
||||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] OK rc=$rc" | Add-Content -LiteralPath $logFile
|
|
||||||
} else {
|
|
||||||
$mirrorFailures++
|
|
||||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] ERROR rc=$rc" | Add-Content -LiteralPath $logFile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print summary report to console
|
|
||||||
Write-Host "=== SUMMARY REPORT ===" -ForegroundColor Magenta
|
Write-Host "=== SUMMARY REPORT ===" -ForegroundColor Magenta
|
||||||
Write-Host "Dailies scanned: $dailiesScanned" -ForegroundColor White
|
Write-Host "Sequences scanned: $totalSequences" -ForegroundColor White
|
||||||
Write-Host "Sequences found: $total" -ForegroundColor White
|
|
||||||
Write-Host "Planned copies: $toCopy" -ForegroundColor Green
|
|
||||||
Write-Host "Completed OK: $sequencesMirrored" -ForegroundColor Green
|
|
||||||
Write-Host "Completed FAIL: $mirrorFailures" -ForegroundColor Red
|
|
||||||
Write-Host "Files renamed: $filesRenamedTotal (collisions: $renameCollisions, errors: $renameErrors)" -ForegroundColor White
|
Write-Host "Files renamed: $filesRenamedTotal (collisions: $renameCollisions, errors: $renameErrors)" -ForegroundColor White
|
||||||
Write-Host "Preview MP4s renamed: $mp4RenamedTotal (collisions: $mp4Collisions, errors: $mp4Errors)" -ForegroundColor White
|
Write-Host "Preview MP4s renamed: $mp4RenamedTotal (collisions: $mp4Collisions, errors: $mp4Errors)" -ForegroundColor White
|
||||||
|
|
||||||
# Summarize skipped sequences
|
|
||||||
$skippedLines = @()
|
|
||||||
foreach ($line in $lines) {
|
|
||||||
if ($line.StartsWith('[SKIP]')) {
|
|
||||||
$skippedLines += $line
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($skippedLines.Count -gt 0) {
|
|
||||||
Write-Host "`n=== SKIPPED SEQUENCES ===" -ForegroundColor Yellow
|
|
||||||
$skippedByReason = @{}
|
|
||||||
foreach ($skip in $skippedLines) {
|
|
||||||
$parts = $skip -split '\|'
|
|
||||||
$reason = $parts[3]
|
|
||||||
$seqName = $parts[2]
|
|
||||||
if (-not $skippedByReason.ContainsKey($reason)) {
|
|
||||||
$skippedByReason[$reason] = @()
|
|
||||||
}
|
|
||||||
$skippedByReason[$reason] += $seqName
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($reason in $skippedByReason.Keys) {
|
|
||||||
$seqs = $skippedByReason[$reason]
|
|
||||||
Write-Host "$reason ($($seqs.Count) sequences):" -ForegroundColor Yellow
|
|
||||||
foreach ($seq in $seqs | Sort-Object) {
|
|
||||||
Write-Host " - $seq" -ForegroundColor White
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Write-Host "========================" -ForegroundColor Yellow
|
|
||||||
}
|
|
||||||
Write-Host "=====================" -ForegroundColor Magenta
|
Write-Host "=====================" -ForegroundColor Magenta
|
||||||
|
|
||||||
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] === UpdateSequences (ps1) completed (d=$dailiesScanned seq=$total ok=$sequencesMirrored fail=$mirrorFailures) ===" | Add-Content -LiteralPath $logFile
|
if ($logFile) {
|
||||||
|
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] === UpdateSequences completed (seq=$totalSequences renamed=$filesRenamedTotal mp4=$mp4RenamedTotal) ===" | Add-Content -LiteralPath $logFile
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "@$logFile"
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
$root = (Get-Location).ProviderPath
|
if ($logFile) {
|
||||||
$currentDir = Join-Path $root '_CURRENT'
|
"[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] ERROR: $($_.Exception.Message)" | Add-Content -LiteralPath $logFile
|
||||||
if (-not (Test-Path -LiteralPath $currentDir)) {
|
|
||||||
New-Item -ItemType Directory -Path $currentDir -Force | Out-Null
|
|
||||||
}
|
}
|
||||||
$planFile = Join-Path $currentDir '_UpdatePlan.txt'
|
Write-Host "ERROR: $_" -ForegroundColor Red
|
||||||
($_.Exception | Out-String) | Set-Content -LiteralPath ($planFile + '.error.txt') -Encoding ASCII
|
|
||||||
Write-Host "ERROR: $_"
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ if not exist "%rendersDir%" (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
for %%F in (NewDaily.bat UpdateSequences.bat) do (
|
for %%F in (UpdateSequences.bat ZipSeqArchv.bat UnzipSeqArchv.bat) do (
|
||||||
if exist "%scriptDir%%%F" (
|
if exist "%scriptDir%%%F" (
|
||||||
if "%DRY%"=="1" (
|
if "%DRY%"=="1" (
|
||||||
echo [DRY] copy "%scriptDir%%%F" "%rendersDir%\%%F"
|
echo [DRY] copy "%scriptDir%%%F" "%rendersDir%\%%F"
|
||||||
@@ -122,12 +122,14 @@ if exist "%animDir%" (
|
|||||||
rem Ensure submodule dir exists and place helper scripts there
|
rem Ensure submodule dir exists and place helper scripts there
|
||||||
if "%DRY%"=="1" (
|
if "%DRY%"=="1" (
|
||||||
if not exist "!_subdir!" echo [DRY] mkdir "!_subdir!"
|
if not exist "!_subdir!" echo [DRY] mkdir "!_subdir!"
|
||||||
if exist "%scriptDir%NewDaily.bat" echo [DRY] copy "%scriptDir%NewDaily.bat" "!_subdir!\NewDaily.bat"
|
|
||||||
if exist "%scriptDir%UpdateSequences.bat" echo [DRY] copy "%scriptDir%UpdateSequences.bat" "!_subdir!\UpdateSequences.bat"
|
if exist "%scriptDir%UpdateSequences.bat" echo [DRY] copy "%scriptDir%UpdateSequences.bat" "!_subdir!\UpdateSequences.bat"
|
||||||
|
if exist "%scriptDir%ZipSeqArchv.bat" echo [DRY] copy "%scriptDir%ZipSeqArchv.bat" "!_subdir!\ZipSeqArchv.bat"
|
||||||
|
if exist "%scriptDir%UnzipSeqArchv.bat" echo [DRY] copy "%scriptDir%UnzipSeqArchv.bat" "!_subdir!\UnzipSeqArchv.bat"
|
||||||
) else (
|
) else (
|
||||||
if not exist "!_subdir!" mkdir "!_subdir!" >nul 2>&1
|
if not exist "!_subdir!" mkdir "!_subdir!" >nul 2>&1
|
||||||
if exist "%scriptDir%NewDaily.bat" copy /Y "%scriptDir%NewDaily.bat" "!_subdir!\NewDaily.bat" >nul
|
|
||||||
if exist "%scriptDir%UpdateSequences.bat" copy /Y "%scriptDir%UpdateSequences.bat" "!_subdir!\UpdateSequences.bat" >nul
|
if exist "%scriptDir%UpdateSequences.bat" copy /Y "%scriptDir%UpdateSequences.bat" "!_subdir!\UpdateSequences.bat" >nul
|
||||||
|
if exist "%scriptDir%ZipSeqArchv.bat" copy /Y "%scriptDir%ZipSeqArchv.bat" "!_subdir!\ZipSeqArchv.bat" >nul
|
||||||
|
if exist "%scriptDir%UnzipSeqArchv.bat" copy /Y "%scriptDir%UnzipSeqArchv.bat" "!_subdir!\UnzipSeqArchv.bat" >nul
|
||||||
)
|
)
|
||||||
for /d %%D in ("%%S\daily_*") do (
|
for /d %%D in ("%%S\daily_*") do (
|
||||||
set "dailyName=%%~nD"
|
set "dailyName=%%~nD"
|
||||||
|
|||||||
24
ZipSeqArchv.bat
Normal file
24
ZipSeqArchv.bat
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
set "REN_DIR=%~dp0"
|
||||||
|
for %%I in ("%REN_DIR%..") do set "PROJ_ROOT=%%~fI"
|
||||||
|
set "PY_SCRIPT=A:\1 Amazon_Active_Projects\3 ProjectStructure\zip_sequences.py"
|
||||||
|
|
||||||
|
if not exist "%PY_SCRIPT%" (
|
||||||
|
echo Missing %PY_SCRIPT%
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
pushd "%PROJ_ROOT%" >nul 2>&1
|
||||||
|
|
||||||
|
python "%PY_SCRIPT%" --verbose %*
|
||||||
|
set "ERR=%ERRORLEVEL%"
|
||||||
|
|
||||||
|
if not "%ERR%"=="0" (
|
||||||
|
echo Failed to update render sequence archives (exit code %ERR%).
|
||||||
|
)
|
||||||
|
|
||||||
|
popd >nul 2>&1
|
||||||
|
exit /b %ERR%
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
*.fbx filter=lfs diff=lfs merge=lfs -text
|
*.fbx filter=lfs diff=lfs merge=lfs -text
|
||||||
*.fbxkey filter=lfs diff=lfs merge=lfs -text
|
*.fbxkey filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.blend2 filter=lfs diff=lfs merge=lfs -text
|
||||||
*.mb filter=lfs diff=lfs merge=lfs -text
|
*.mb filter=lfs diff=lfs merge=lfs -text
|
||||||
*.ma filter=lfs diff=lfs merge=lfs -text
|
*.ma filter=lfs diff=lfs merge=lfs -text
|
||||||
*.tiff filter=lfs diff=lfs merge=lfs -text
|
*.tiff filter=lfs diff=lfs merge=lfs -text
|
||||||
@@ -40,8 +41,13 @@
|
|||||||
*.dae filter=lfs diff=lfs merge=lfs -text
|
*.dae filter=lfs diff=lfs merge=lfs -text
|
||||||
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||||
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
|
||||||
*.vdb filter=lfs diff=lfs merge=lfs -text
|
*.vdb filter=lfs diff=lfs merge=lfs -text
|
||||||
*.aep filter=lfs diff=lfs merge=lfs -text
|
*.aep filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.aegraphic filter=lfs diff=lfs merge=lfs -text
|
||||||
*.prproj filter=lfs diff=lfs merge=lfs -text
|
*.prproj filter=lfs diff=lfs merge=lfs -text
|
||||||
*.prin filter=lfs diff=lfs merge=lfs -text
|
*.prin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.prel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.docx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.MOV filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||||
@@ -83,12 +83,6 @@ desktop.ini
|
|||||||
# *.aac
|
# *.aac
|
||||||
# *.ogg
|
# *.ogg
|
||||||
|
|
||||||
# Archive files
|
|
||||||
*.zip
|
|
||||||
*.rar
|
|
||||||
*.7z
|
|
||||||
*.tar.gz
|
|
||||||
|
|
||||||
# Log files
|
# Log files
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
@@ -119,9 +113,12 @@ temp/
|
|||||||
tmp/
|
tmp/
|
||||||
cache/
|
cache/
|
||||||
|
|
||||||
# image sequences
|
Renders/**
|
||||||
seq/
|
!Renders/_zipped/
|
||||||
Renders/
|
!Renders/_zipped/**
|
||||||
|
!Renders/**/
|
||||||
|
!Renders/**/*.bat
|
||||||
|
!Renders/**/*.log
|
||||||
|
|
||||||
# Premiere
|
# Premiere
|
||||||
*.prlock
|
*.prlock
|
||||||
@@ -129,3 +126,5 @@ Adobe Premiere Pro Video Previews/
|
|||||||
Adobe Premiere Pro Audio Previews/
|
Adobe Premiere Pro Audio Previews/
|
||||||
Adobe Premiere Pro (Beta) Video Previews/
|
Adobe Premiere Pro (Beta) Video Previews/
|
||||||
Adobe Premiere Pro (Beta) Audio Previews/
|
Adobe Premiere Pro (Beta) Audio Previews/
|
||||||
|
|
||||||
|
Pr/RnR/
|
||||||
|
|||||||
333
zip_sequences.py
Normal file
333
zip_sequences.py
Normal file
@@ -0,0 +1,333 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Maintain zipped render sequences for Git hooks.
|
||||||
|
|
||||||
|
Default mode scans `Renders/`, produces ZIP archives under `Renders/_zipped/`,
|
||||||
|
and stages any updated archives so commits only track compact files. Switch to
|
||||||
|
`--mode expand` to inflate the tracked archives back into the ignored working
|
||||||
|
directories after checkouts or pulls.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Iterator, Sequence
|
||||||
|
|
||||||
|
|
||||||
|
RENDER_ROOT = Path("Renders")
|
||||||
|
ARCHIVE_ROOT = RENDER_ROOT / "_zipped"
|
||||||
|
SEQUENCE_EXTENSIONS = {
|
||||||
|
".png",
|
||||||
|
".jpg",
|
||||||
|
".jpeg",
|
||||||
|
".tif",
|
||||||
|
".tiff",
|
||||||
|
".exr",
|
||||||
|
}
|
||||||
|
STATE_SUFFIX = ".meta.json"
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args() -> argparse.Namespace:
|
||||||
|
parser = argparse.ArgumentParser(description="Sync render sequences with zipped archives.")
|
||||||
|
parser.add_argument(
|
||||||
|
"--mode",
|
||||||
|
choices=("zip", "expand"),
|
||||||
|
default="zip",
|
||||||
|
help="zip sequences for commit (default) or expand tracked archives",
|
||||||
|
)
|
||||||
|
parser.add_argument("--jobs", type=int, help="max parallel workers")
|
||||||
|
parser.add_argument("--verbose", action="store_true", help="print extra progress details")
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def max_workers(requested: int | None) -> int:
|
||||||
|
cpu = os.cpu_count() or 1
|
||||||
|
limit = max(1, min(8, cpu))
|
||||||
|
if requested and requested > 0:
|
||||||
|
return min(requested, max(1, cpu))
|
||||||
|
return limit
|
||||||
|
|
||||||
|
|
||||||
|
def log(mode: str, message: str, *, verbose_only: bool = False, verbose: bool = False) -> None:
|
||||||
|
if verbose_only and not verbose:
|
||||||
|
return
|
||||||
|
print(f"[{mode}] {message}")
|
||||||
|
|
||||||
|
|
||||||
|
def is_archive_path(path: Path) -> bool:
|
||||||
|
return any(part == "_archive" for part in path.parts)
|
||||||
|
|
||||||
|
|
||||||
|
def find_sequence_dirs(root: Path) -> Iterator[Path]:
|
||||||
|
for dirpath, dirnames, filenames in os.walk(root):
|
||||||
|
path = Path(dirpath)
|
||||||
|
dirnames[:] = [d for d in dirnames if d != "_archive"]
|
||||||
|
if is_archive_path(path):
|
||||||
|
continue
|
||||||
|
has_frames = any(Path(dirpath, f).suffix.lower() in SEQUENCE_EXTENSIONS for f in filenames)
|
||||||
|
if has_frames:
|
||||||
|
yield path
|
||||||
|
|
||||||
|
|
||||||
|
def iter_sequence_files(seq_dir: Path) -> Iterator[Path]:
|
||||||
|
for dirpath, dirnames, filenames in os.walk(seq_dir):
|
||||||
|
path = Path(dirpath)
|
||||||
|
dirnames[:] = [d for d in dirnames if d != "_archive"]
|
||||||
|
if is_archive_path(path):
|
||||||
|
continue
|
||||||
|
for filename in filenames:
|
||||||
|
yield path / filename
|
||||||
|
|
||||||
|
|
||||||
|
def compute_state(seq_dir: Path) -> dict:
|
||||||
|
entries = []
|
||||||
|
files = sorted(
|
||||||
|
iter_sequence_files(seq_dir),
|
||||||
|
key=lambda p: p.relative_to(seq_dir).as_posix(),
|
||||||
|
)
|
||||||
|
for file_path in files:
|
||||||
|
stat = file_path.stat()
|
||||||
|
entries.append(
|
||||||
|
{
|
||||||
|
"path": file_path.relative_to(seq_dir).as_posix(),
|
||||||
|
"size": stat.st_size,
|
||||||
|
"mtime_ns": stat.st_mtime_ns,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return {"files": entries}
|
||||||
|
|
||||||
|
|
||||||
|
def current_state(seq_dir: Path) -> dict:
|
||||||
|
if not seq_dir.exists() or not seq_dir.is_dir():
|
||||||
|
return {"files": []}
|
||||||
|
return compute_state(seq_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def load_state(state_path: Path) -> dict | None:
|
||||||
|
if not state_path.exists():
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
return json.loads(state_path.read_text())
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def state_changed(seq_state: dict, stored_state: dict | None) -> bool:
|
||||||
|
if stored_state is None:
|
||||||
|
return True
|
||||||
|
return seq_state != stored_state
|
||||||
|
|
||||||
|
|
||||||
|
def archive_path_for(seq_dir: Path) -> Path:
|
||||||
|
rel = seq_dir.relative_to(RENDER_ROOT)
|
||||||
|
return (ARCHIVE_ROOT / rel).with_suffix(".zip")
|
||||||
|
|
||||||
|
|
||||||
|
def sequence_dir_for(zip_path: Path) -> Path:
|
||||||
|
rel = zip_path.relative_to(ARCHIVE_ROOT)
|
||||||
|
return (RENDER_ROOT / rel).with_suffix("")
|
||||||
|
|
||||||
|
|
||||||
|
def state_path_for(zip_path: Path) -> Path:
|
||||||
|
return zip_path.with_suffix(zip_path.suffix + STATE_SUFFIX)
|
||||||
|
|
||||||
|
|
||||||
|
def zip_sequence(seq_dir: Path, zip_path: Path) -> None:
|
||||||
|
from zipfile import ZIP_STORED, ZipFile
|
||||||
|
|
||||||
|
zip_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with ZipFile(zip_path, "w", compression=ZIP_STORED) as archive:
|
||||||
|
for file_path in iter_sequence_files(seq_dir):
|
||||||
|
archive.write(file_path, arcname=file_path.relative_to(seq_dir).as_posix())
|
||||||
|
|
||||||
|
|
||||||
|
def expand_sequence(zip_path: Path, seq_state: dict) -> None:
|
||||||
|
from zipfile import ZipFile
|
||||||
|
|
||||||
|
target_dir = sequence_dir_for(zip_path)
|
||||||
|
if target_dir.exists():
|
||||||
|
shutil.rmtree(target_dir)
|
||||||
|
target_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
with ZipFile(zip_path, "r") as archive:
|
||||||
|
archive.extractall(target_dir)
|
||||||
|
|
||||||
|
for entry in seq_state.get("files", []):
|
||||||
|
file_path = target_dir / entry["path"]
|
||||||
|
if file_path.exists():
|
||||||
|
os.utime(file_path, ns=(entry["mtime_ns"], entry["mtime_ns"]))
|
||||||
|
|
||||||
|
|
||||||
|
def process_zip(seq_dir: Path, zip_path: Path, state_path: Path, seq_state: dict, *, verbose: bool) -> Sequence[Path]:
|
||||||
|
log("zip", f"{seq_dir} -> {zip_path}", verbose_only=True, verbose=verbose)
|
||||||
|
zip_sequence(seq_dir, zip_path)
|
||||||
|
state_path.write_text(json.dumps(seq_state, indent=2))
|
||||||
|
return (zip_path, state_path)
|
||||||
|
|
||||||
|
|
||||||
|
def process_expand(zip_path: Path, state: dict, *, verbose: bool) -> None:
|
||||||
|
log("expand", f"{zip_path} -> {sequence_dir_for(zip_path)}", verbose_only=True, verbose=verbose)
|
||||||
|
expand_sequence(zip_path, state)
|
||||||
|
|
||||||
|
|
||||||
|
def run_zip(worker_count: int, *, verbose: bool) -> int:
|
||||||
|
work_items: list[tuple[Path, Path, Path, dict]] = []
|
||||||
|
|
||||||
|
if RENDER_ROOT.exists():
|
||||||
|
for seq_dir in find_sequence_dirs(RENDER_ROOT):
|
||||||
|
seq_state = compute_state(seq_dir)
|
||||||
|
if not seq_state["files"]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
zip_path = archive_path_for(seq_dir)
|
||||||
|
state_path = state_path_for(zip_path)
|
||||||
|
stored_state = load_state(state_path)
|
||||||
|
|
||||||
|
if not state_changed(seq_state, stored_state):
|
||||||
|
continue
|
||||||
|
|
||||||
|
work_items.append((seq_dir, zip_path, state_path, seq_state))
|
||||||
|
|
||||||
|
if not work_items:
|
||||||
|
if not RENDER_ROOT.exists():
|
||||||
|
log("zip", "Render root 'Renders' not found; nothing to zip.")
|
||||||
|
else:
|
||||||
|
log("zip", "Archives already up to date; no sequences needed zipping.")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
updated_paths: list[Path] = []
|
||||||
|
|
||||||
|
total = len(work_items)
|
||||||
|
completed = 0
|
||||||
|
|
||||||
|
with ThreadPoolExecutor(max_workers=worker_count) as executor:
|
||||||
|
future_map = {
|
||||||
|
executor.submit(process_zip, seq_dir, zip_path, state_path, seq_state, verbose=verbose): seq_dir
|
||||||
|
for seq_dir, zip_path, state_path, seq_state in work_items
|
||||||
|
}
|
||||||
|
|
||||||
|
for future in as_completed(future_map):
|
||||||
|
updated_paths.extend(future.result())
|
||||||
|
completed += 1
|
||||||
|
seq_dir = future_map[future]
|
||||||
|
rel = seq_dir.relative_to(RENDER_ROOT)
|
||||||
|
log("zip", f"{completed}/{total} {rel}")
|
||||||
|
|
||||||
|
updated_count = len(updated_paths) // 2
|
||||||
|
log("zip", f"Updated {updated_count} sequence archive(s).", verbose=verbose)
|
||||||
|
if updated_paths:
|
||||||
|
log(
|
||||||
|
"zip",
|
||||||
|
"Archives updated. Stage manually with `git add Renders/_zipped`, if desired.",
|
||||||
|
verbose_only=True,
|
||||||
|
verbose=verbose,
|
||||||
|
)
|
||||||
|
|
||||||
|
removed = cleanup_orphan_archives(verbose=verbose)
|
||||||
|
if removed:
|
||||||
|
log("zip", f"Removed {removed} orphan archive(s).", verbose=verbose)
|
||||||
|
|
||||||
|
return updated_count
|
||||||
|
|
||||||
|
|
||||||
|
def run_expand(worker_count: int, *, verbose: bool) -> int:
|
||||||
|
if not ARCHIVE_ROOT.exists():
|
||||||
|
log("expand", "No archives to expand (missing 'Renders/_zipped').")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
work_items: list[tuple[Path, dict]] = []
|
||||||
|
|
||||||
|
for zip_path in ARCHIVE_ROOT.rglob("*.zip"):
|
||||||
|
state_path = state_path_for(zip_path)
|
||||||
|
seq_state = load_state(state_path)
|
||||||
|
if seq_state is None:
|
||||||
|
log("expand", f"Skipping {zip_path} (missing metadata)")
|
||||||
|
continue
|
||||||
|
|
||||||
|
target_dir = sequence_dir_for(zip_path)
|
||||||
|
if current_state(target_dir) == seq_state:
|
||||||
|
continue
|
||||||
|
|
||||||
|
work_items.append((zip_path, seq_state))
|
||||||
|
|
||||||
|
if not work_items:
|
||||||
|
log("expand", "Working folders already match archives; nothing to expand.")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
total = len(work_items)
|
||||||
|
completed = 0
|
||||||
|
|
||||||
|
with ThreadPoolExecutor(max_workers=worker_count) as executor:
|
||||||
|
future_map = {
|
||||||
|
executor.submit(process_expand, zip_path, seq_state, verbose=verbose): zip_path
|
||||||
|
for zip_path, seq_state in work_items
|
||||||
|
}
|
||||||
|
|
||||||
|
for future in as_completed(future_map):
|
||||||
|
future.result()
|
||||||
|
completed += 1
|
||||||
|
zip_path = future_map[future]
|
||||||
|
rel = zip_path.relative_to(ARCHIVE_ROOT)
|
||||||
|
log("expand", f"{completed}/{total} {rel}")
|
||||||
|
|
||||||
|
log("expand", f"Refreshed {len(work_items)} sequence folder(s).", verbose=verbose)
|
||||||
|
return len(work_items)
|
||||||
|
|
||||||
|
|
||||||
|
def cleanup_orphan_archives(*, verbose: bool) -> int:
|
||||||
|
if not ARCHIVE_ROOT.exists():
|
||||||
|
return 0
|
||||||
|
|
||||||
|
removed: list[Path] = []
|
||||||
|
|
||||||
|
for zip_path in ARCHIVE_ROOT.rglob("*.zip"):
|
||||||
|
seq_dir = sequence_dir_for(zip_path)
|
||||||
|
if seq_dir.exists():
|
||||||
|
continue
|
||||||
|
|
||||||
|
rel = zip_path.relative_to(ARCHIVE_ROOT)
|
||||||
|
log("zip", f"Removing orphan archive {rel}", verbose_only=True, verbose=verbose)
|
||||||
|
|
||||||
|
zip_path.unlink(missing_ok=True)
|
||||||
|
state_path = state_path_for(zip_path)
|
||||||
|
if state_path.exists():
|
||||||
|
state_path.unlink()
|
||||||
|
removed.append(zip_path)
|
||||||
|
|
||||||
|
if not removed:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
for parent in sorted({p.parent for p in removed}, key=lambda p: len(p.parts), reverse=True):
|
||||||
|
if not parent.exists():
|
||||||
|
continue
|
||||||
|
while parent != ARCHIVE_ROOT and not any(parent.iterdir()):
|
||||||
|
parent.rmdir()
|
||||||
|
parent = parent.parent
|
||||||
|
|
||||||
|
return len(removed)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
args = parse_args()
|
||||||
|
workers = max_workers(args.jobs)
|
||||||
|
|
||||||
|
if args.mode == "expand":
|
||||||
|
run_expand(workers, verbose=args.verbose)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
updated = run_zip(workers, verbose=args.verbose)
|
||||||
|
return 0 if updated >= 0 else 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
raise SystemExit(main())
|
||||||
|
except Exception as exc: # broad to surface unexpected errors cleanly
|
||||||
|
print(f"Sequence sync failed: {exc}", file=sys.stderr)
|
||||||
|
raise
|
||||||
|
|
||||||
Reference in New Issue
Block a user