This commit is contained in:
2026-06-21 03:53:06 +03:00
commit f1dd557c5d
147 changed files with 34363 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import fs from "node:fs";
import xml2js from "xml2js";
const xml = ``;
const subPath = "/var/www/html/subtitles/";
const subs = fs.readdirSync(subPath);
let vids = fs.readdirSync("/var/www/html/");
const data = await xml2js.parseStringPromise(xml);
// vids = [...data.ListBucketResult.Contents.filter(file => file.Key[0].startsWith('')).map(file => file.Key[0])];
console.log(subs);
console.log(vids);
vids.forEach((vid) => {
const match = subs.find((sub) =>
vid.toLowerCase().startsWith(sub.slice(0, -4).toLowerCase()),
);
console.log(vid, match);
if (vid && match) {
fs.copyFileSync(subPath + match, subPath + vid + ".srt");
}
});