Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
Add script to remove loading videos
Browse files Browse the repository at this point in the history
  • Loading branch information
EsotericEnderman committed Jun 29, 2024
1 parent 62e3430 commit 4e6f951
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { removeLoadingVideos } from "./scripts/remove-loading-videos";

removeLoadingVideos();
24 changes: 24 additions & 0 deletions src/scripts/remove-loading-videos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { archivedVideoEnding, blankSplashContent, moviesFolder, splashesToRemove } from "../constants.js";
import { readFileSync, rmSync, writeFileSync } from "fs";

export function removeLoadingVideos() {
for (const loadingVideo of splashesToRemove) {
const fullFilePath = moviesFolder + "/" + loadingVideo;

const content = readFileSync(fullFilePath);

// 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";

console.log("Removing video " + fullFilePath + " and archiving it at " + archivedVideoFilePath + ".");

writeFileSync(archivedVideoFilePath, content);

rmSync(fullFilePath);
writeFileSync(fullFilePath, blankSplashContent);
}
}

0 comments on commit 4e6f951

Please sign in to comment.