first commit
This commit is contained in:
commit
846e90ca71
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules/
|
||||||
|
renamer.sh
|
14
.prettierrc.json
Normal file
14
.prettierrc.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"tabWidth": 2,
|
||||||
|
"printWidth": 120,
|
||||||
|
"singleQuote": false,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"semi": true,
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"arrowParens": "always",
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"bracketSameLine": false,
|
||||||
|
"jsxSingleQuote": false,
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"proseWrap": "preserve"
|
||||||
|
}
|
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Launch Program",
|
||||||
|
"skipFiles": [
|
||||||
|
"<node_internals>/**"
|
||||||
|
],
|
||||||
|
"program": "${file}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
7
jsconfig.js
Normal file
7
jsconfig.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "CommonJS",
|
||||||
|
"target": "ES6"
|
||||||
|
"checkJs": true
|
||||||
|
}
|
||||||
|
}
|
85
package-lock.json
generated
Normal file
85
package-lock.json
generated
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
{
|
||||||
|
"name": "tybemove",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "tybemove",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/lodash": "^4.17.14",
|
||||||
|
"@types/node": "^22.10.5",
|
||||||
|
"change-case": "^5.4.4",
|
||||||
|
"js-convert-case": "^4.2.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"normalize-path": "^3.0.0",
|
||||||
|
"prettier": "^3.4.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/lodash": {
|
||||||
|
"version": "4.17.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.14.tgz",
|
||||||
|
"integrity": "sha512-jsxagdikDiDBeIRaPYtArcT8my4tN1og7MtMRquFT3XNA6axxyHDRUemqDz/taRDdOUn0GnGHRCuff4q48sW9A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "22.10.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz",
|
||||||
|
"integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~6.20.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/change-case": {
|
||||||
|
"version": "5.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz",
|
||||||
|
"integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/js-convert-case": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-convert-case/-/js-convert-case-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-i4mHCxiBNj6ajjMnZnC70qAOMA8gb+YgYipy2VR7a+Q5EBgEQ2/SgSAUBdNEyObk++B4AIUiFWeDEX2ggOd8cQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/lodash": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/normalize-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/prettier": {
|
||||||
|
"version": "3.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz",
|
||||||
|
"integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"prettier": "bin/prettier.cjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "6.20.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||||
|
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
20
package.json
Normal file
20
package.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "tybemove",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"description": "",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/lodash": "^4.17.14",
|
||||||
|
"@types/node": "^22.10.5",
|
||||||
|
"change-case": "^5.4.4",
|
||||||
|
"js-convert-case": "^4.2.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"normalize-path": "^3.0.0",
|
||||||
|
"prettier": "^3.4.2"
|
||||||
|
}
|
||||||
|
}
|
43
run.js
Normal file
43
run.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
const _ = require("lodash");
|
||||||
|
const fs = require("fs");
|
||||||
|
const normalize = require("normalize-path");
|
||||||
|
const { toHeaderCase } = require("js-convert-case");
|
||||||
|
const { files } = require("./files.json");
|
||||||
|
|
||||||
|
const data = fs.readFileSync("./ta_backup-20250402-auto/es_video-20250402-0.json", { encoding: "utf8" });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("./types").Root[]}
|
||||||
|
*/
|
||||||
|
const sortedArrayOfObjects = data
|
||||||
|
.split("\n")
|
||||||
|
.filter(Boolean)
|
||||||
|
.map(JSON.parse)
|
||||||
|
.filter((i) => !i?.index);
|
||||||
|
|
||||||
|
const filteredVideos = _.filter(sortedArrayOfObjects, (i) => {
|
||||||
|
return _.includes(files, i.media_url);
|
||||||
|
});
|
||||||
|
|
||||||
|
const formattedList = filteredVideos.map((i) => {
|
||||||
|
const title = normalize(i.title);
|
||||||
|
// .replaceAll(String.fromCharCode(32), String.fromCharCode(92, 32))
|
||||||
|
// .replaceAll(String.fromCharCode(40), String.fromCharCode(92, 40))
|
||||||
|
// .replaceAll(String.fromCharCode(41), String.fromCharCode(92, 41))
|
||||||
|
// .replace(
|
||||||
|
// /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,
|
||||||
|
// ""
|
||||||
|
// );
|
||||||
|
|
||||||
|
const changedCase = toHeaderCase(title);
|
||||||
|
|
||||||
|
// const trimmed = _.trim(changedCase);
|
||||||
|
|
||||||
|
return `cp ${i.media_url} "output/${title}.${i.media_url.split(".").pop()}"`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const concatted = _.concat(["#!/bin/bash"], ["mkdir -p output"], formattedList);
|
||||||
|
|
||||||
|
const joinedList = concatted.join("\n");
|
||||||
|
|
||||||
|
fs.writeFileSync("renamer.sh", joinedList, { encoding: "utf8" });
|
58
types.ts
Normal file
58
types.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
export interface Root {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
category: string[];
|
||||||
|
vid_thumb_url: string;
|
||||||
|
vid_thumb_base64: boolean;
|
||||||
|
tags: any[];
|
||||||
|
published: string;
|
||||||
|
vid_last_refresh: number;
|
||||||
|
date_downloaded: number;
|
||||||
|
youtube_id: string;
|
||||||
|
vid_type: string;
|
||||||
|
active: boolean;
|
||||||
|
channel: Channel;
|
||||||
|
stats: Stats;
|
||||||
|
media_url: string;
|
||||||
|
player: Player;
|
||||||
|
streams: Stream[];
|
||||||
|
media_size: number;
|
||||||
|
playlist: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Channel {
|
||||||
|
channel_name: string;
|
||||||
|
channel_thumb_url: string;
|
||||||
|
channel_active: boolean;
|
||||||
|
channel_description: string;
|
||||||
|
channel_last_refresh: number;
|
||||||
|
channel_subscribed: boolean;
|
||||||
|
channel_subs: number;
|
||||||
|
channel_banner_url: string;
|
||||||
|
channel_tvart_url: string;
|
||||||
|
channel_views: number;
|
||||||
|
channel_id: string;
|
||||||
|
channel_tags: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Stats {
|
||||||
|
view_count: number;
|
||||||
|
like_count: number;
|
||||||
|
dislike_count: number;
|
||||||
|
average_rating: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Player {
|
||||||
|
duration: number;
|
||||||
|
watched: boolean;
|
||||||
|
duration_str: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Stream {
|
||||||
|
type: string;
|
||||||
|
index: number;
|
||||||
|
codec: string;
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
bitrate: number;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user