Add special case for _edited files for cleaner
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
Windows Registry Editor Version 5.00
|
Windows Registry Editor Version 5.00
|
||||||
|
|
||||||
[HKEY_CURRENT_USER\Software\Classes\*\shell\Clean video name]
|
[HKEY_CURRENT_USER\Software\Classes\*\shell\Clean name]
|
||||||
@="Clean video name"
|
@="Clean name"
|
||||||
|
|
||||||
[HKEY_CURRENT_USER\Software\Classes\*\shell\Clean video name\command]
|
[HKEY_CURRENT_USER\Software\Classes\*\shell\Clean name\command]
|
||||||
@="C:\\Users\\administrator\\go\\bin\\tcleaner.exe \"%1\""
|
@="C:\\Users\\administrator\\go\\bin\\tcleaner.exe \"%1\""
|
@@ -17,7 +17,8 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
// regex to match "2025-07-08"
|
// regex to match "2025-07-08"
|
||||||
re := regexp.MustCompile(`(\d{4}-\d{2}-\d{2})`)
|
re := regexp.MustCompile(`\d{4}-\d{2}-\d{2}`)
|
||||||
|
editedRe := regexp.MustCompile(`_edited_\d{5}`)
|
||||||
|
|
||||||
for _, file := range flag.Args() {
|
for _, file := range flag.Args() {
|
||||||
filelog := logger.Default.WithPrefix(file)
|
filelog := logger.Default.WithPrefix(file)
|
||||||
@@ -40,8 +41,16 @@ func main() {
|
|||||||
filelog.Info("SKIP (no date pattern): %s\n", name)
|
filelog.Info("SKIP (no date pattern): %s\n", name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namePart := match[0]
|
||||||
|
editMatch := editedRe.FindStringSubmatch(name)
|
||||||
|
filelog.Debug("Edit match: %v", editMatch)
|
||||||
|
if editMatch != nil {
|
||||||
|
namePart = namePart + editMatch[0]
|
||||||
|
filelog.Info("Video has edited part, new name: %s", namePart)
|
||||||
|
}
|
||||||
|
|
||||||
newName := match[1] + filepath.Ext(name)
|
newName := namePart + filepath.Ext(name)
|
||||||
filelog.Debug("New name: %s", newName)
|
filelog.Debug("New name: %s", newName)
|
||||||
if name == newName {
|
if name == newName {
|
||||||
filelog.Info("SKIP (already named): %s\n", name)
|
filelog.Info("SKIP (already named): %s\n", name)
|
||||||
|
Reference in New Issue
Block a user