This repository has been archived by the owner on Sep 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4ed74c
commit a8d3494
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { readFileSync, rmSync, writeFileSync } from "fs"; | ||
import { archivedVideoEnding, blankSplashContent, moviesFolder, splashesToRemove } from "../constants"; | ||
|
||
export function revertChanges() { | ||
for (const loadingVideo of splashesToRemove) { | ||
const fullFilePath = moviesFolder + "/" + loadingVideo; | ||
|
||
// Save content to new file, in case the user wants to re-add the loading videos | ||
const split = fullFilePath.split("."); | ||
split[1] = archivedVideoEnding; | ||
|
||
let archivedVideoFilePath = split.join("") | ||
archivedVideoFilePath += ".mp4"; | ||
|
||
let content: Buffer; | ||
|
||
try { | ||
content = readFileSync(archivedVideoFilePath); | ||
} catch (error) { | ||
console.log("Could not read file " + archivedVideoFilePath + "."); | ||
continue; | ||
} | ||
|
||
console.log("Reverting deletion of video " + fullFilePath + "."); | ||
|
||
writeFileSync(fullFilePath, content); | ||
rmSync(archivedVideoFilePath); | ||
} | ||
} | ||
|
||
revertChanges(); |