CineMax commited on
Commit
ea242e6
Β·
verified Β·
1 Parent(s): 1defb60

Upload 8 files

Browse files
Files changed (8) hide show
  1. c/cloudflare.js +52 -0
  2. c/encoder.js +196 -0
  3. c/github.js +134 -0
  4. c/index.js +383 -0
  5. c/input.js +72 -0
  6. c/package.json +23 -0
  7. c/tmdb.js +91 -0
  8. c/ui.js +81 -0
c/cloudflare.js ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+ const { execSync, spawn } = require('child_process');
3
+ const path = require('path');
4
+ const { log, sep } = require('./ui');
5
+
6
+ // ─── CHECK WRANGLER ───────────────────────────────────────────────────────────
7
+ function checkWrangler() {
8
+ try {
9
+ execSync('npx wrangler --version', { stdio: 'ignore' });
10
+ return true;
11
+ } catch {
12
+ return false;
13
+ }
14
+ }
15
+
16
+ // ─── DEPLOY TO CLOUDFLARE PAGES ───────────────────────────────────────────────
17
+ function deployToCloudflare({ folderPath, projectName }) {
18
+ return new Promise((resolve, reject) => {
19
+ sep();
20
+ log.step(`Cloudflare Pages β†’ Proyecto: ${projectName}`);
21
+ log.info('Si es la primera vez, se abrirΓ‘ tu navegador para autenticarte.');
22
+ log.info('Acepta los permisos y vuelve a esta ventana.');
23
+ sep();
24
+
25
+ const args = [
26
+ 'wrangler',
27
+ 'pages',
28
+ 'deploy',
29
+ folderPath,
30
+ '--project-name',
31
+ projectName,
32
+ ];
33
+
34
+ const proc = spawn('npx', args, {
35
+ stdio: 'inherit',
36
+ shell: true,
37
+ });
38
+
39
+ proc.on('close', (code) => {
40
+ if (code === 0) {
41
+ log.ok(`βœ… Cloudflare Pages desplegado β†’ https://${projectName}.pages.dev`);
42
+ resolve(`https://${projectName}.pages.dev`);
43
+ } else {
44
+ reject(new Error(`Wrangler fallΓ³ con cΓ³digo ${code}`));
45
+ }
46
+ });
47
+
48
+ proc.on('error', reject);
49
+ });
50
+ }
51
+
52
+ module.exports = { deployToCloudflare, checkWrangler };
c/encoder.js ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+ const ffmpeg = require('fluent-ffmpeg');
3
+ const path = require('path');
4
+ const fs = require('fs-extra');
5
+ const { log, createBar, sep } = require('./ui');
6
+ const chalk = require('chalk');
7
+
8
+ // ─── PROBE STREAMS ────────────────────────────────────────────────────────────
9
+ function probeFile(inputPath) {
10
+ return new Promise((resolve, reject) => {
11
+ ffmpeg.ffprobe(inputPath, (err, meta) => {
12
+ if (err) return reject(err);
13
+ resolve(meta);
14
+ });
15
+ });
16
+ }
17
+
18
+ // ─── GET AUDIO STREAMS INFO ───────────────────────────────────────────────────
19
+ function getAudioStreams(meta) {
20
+ return meta.streams.filter((s) => s.codec_type === 'audio').map((s, i) => {
21
+ const lang =
22
+ (s.tags && (s.tags.language || s.tags.LANGUAGE)) || `audio${i}`;
23
+ const title =
24
+ (s.tags && (s.tags.title || s.tags.TITLE)) || lang.toUpperCase();
25
+ return { index: s.index, streamIndex: i, lang, title };
26
+ });
27
+ }
28
+
29
+ // ─── ENCODE VIDEO (copy, no audio) ────────────────────────────────────────────
30
+ function encodeVideo(inputPath, outputDir, segmentTime, onProgress, duration) {
31
+ return new Promise((resolve, reject) => {
32
+ const playlistPath = path.join(outputDir, 'video', 'stream.m3u8');
33
+ fs.ensureDirSync(path.join(outputDir, 'video'));
34
+
35
+ let bar = null;
36
+ if (duration) {
37
+ bar = createBar('Video ', 100);
38
+ }
39
+
40
+ ffmpeg(inputPath)
41
+ .outputOptions([
42
+ '-c:v copy', // video: copy sin re-encodear
43
+ '-an', // sin audio
44
+ '-f hls',
45
+ `-hls_time ${segmentTime}`,
46
+ '-hls_list_size 0',
47
+ '-hls_segment_type mpegts',
48
+ '-hls_flags independent_segments',
49
+ `-hls_segment_filename ${path.join(outputDir, 'video', 'seg%05d.ts')}`,
50
+ ])
51
+ .output(playlistPath)
52
+ .on('progress', (p) => {
53
+ if (bar && p.percent) bar.update(Math.min(Math.round(p.percent), 99));
54
+ if (onProgress) onProgress('video', p.percent || 0);
55
+ })
56
+ .on('end', () => {
57
+ if (bar) bar.update(100);
58
+ resolve(playlistPath);
59
+ })
60
+ .on('error', reject)
61
+ .run();
62
+ });
63
+ }
64
+
65
+ // ─── ENCODE SINGLE AUDIO TRACK (MP3) ──────────────────────────────────────────
66
+ function encodeAudio(inputPath, outputDir, audioStream, segmentTime, onProgress) {
67
+ return new Promise((resolve, reject) => {
68
+ const label = audioStream.lang;
69
+ const audioDir = path.join(outputDir, 'audio', label);
70
+ fs.ensureDirSync(audioDir);
71
+ const playlistPath = path.join(audioDir, 'stream.m3u8');
72
+
73
+ ffmpeg(inputPath)
74
+ .outputOptions([
75
+ `-map 0:${audioStream.index}`, // seleccionar pista especΓ­fica
76
+ '-vn', // sin video
77
+ '-c:a libmp3lame', // codec MP3
78
+ '-b:a 128k',
79
+ '-ar 44100',
80
+ '-ac 2',
81
+ '-f hls',
82
+ `-hls_time ${segmentTime}`,
83
+ '-hls_list_size 0',
84
+ '-hls_segment_type mpegts',
85
+ '-hls_flags independent_segments',
86
+ `-hls_segment_filename ${path.join(audioDir, 'seg%05d.ts')}`,
87
+ ])
88
+ .output(playlistPath)
89
+ .on('progress', (p) => {
90
+ if (onProgress) onProgress(label, p.percent || 0);
91
+ })
92
+ .on('end', () => resolve(playlistPath))
93
+ .on('error', reject)
94
+ .run();
95
+ });
96
+ }
97
+
98
+ // ─── BUILD MASTER M3U8 ────────────────────────────────────────────────────────
99
+ async function buildMasterPlaylist(outputDir, audioStreams, videoMeta) {
100
+ const lines = ['#EXTM3U', '#EXT-X-VERSION:6', ''];
101
+
102
+ // Detectar resoluciΓ³n y bandwidth del video
103
+ const vs = videoMeta.streams.find((s) => s.codec_type === 'video');
104
+ const width = vs ? vs.width : 1920;
105
+ const height = vs ? vs.height : 1080;
106
+ const bitrate = vs && vs.bit_rate ? parseInt(vs.bit_rate) : 4000000;
107
+ const fps = vs && vs.r_frame_rate
108
+ ? Math.round(eval(vs.r_frame_rate))
109
+ : 30;
110
+
111
+ // ── AUDIO TRACKS ──────────────────────────────────────────────────────────
112
+ audioStreams.forEach((a, i) => {
113
+ const isDefault = i === 0 ? 'YES' : 'NO';
114
+ lines.push(
115
+ `#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",` +
116
+ `LANGUAGE="${a.lang}",` +
117
+ `NAME="${a.title}",` +
118
+ `DEFAULT=${isDefault},` +
119
+ `AUTOSELECT=YES,` +
120
+ `URI="audio/${a.lang}/stream.m3u8"`
121
+ );
122
+ });
123
+
124
+ lines.push('');
125
+
126
+ // ── VIDEO STREAM ──────────────────────��───────────────────────────────────
127
+ lines.push(
128
+ `#EXT-X-STREAM-INF:BANDWIDTH=${bitrate},` +
129
+ `RESOLUTION=${width}x${height},` +
130
+ `FRAME-RATE=${fps},` +
131
+ `CODECS="avc1.640028,mp4a.40.2",` +
132
+ `AUDIO="audio"`
133
+ );
134
+ lines.push('video/stream.m3u8');
135
+ lines.push('');
136
+
137
+ const masterPath = path.join(outputDir, 'master.m3u8');
138
+ await fs.writeFile(masterPath, lines.join('\n'), 'utf8');
139
+ return masterPath;
140
+ }
141
+
142
+ // ─── MAIN ENCODE FUNCTION ─────────────────────────────────────────────────────
143
+ async function encodeHLS(inputPath, outputDir, segmentTime = 6) {
144
+ await fs.ensureDir(outputDir);
145
+
146
+ log.step(`Analizando: ${path.basename(inputPath)}`);
147
+ const meta = await probeFile(inputPath);
148
+ const audioStreams = getAudioStreams(meta);
149
+ const duration = meta.format.duration || 0;
150
+
151
+ const vs = meta.streams.find((s) => s.codec_type === 'video');
152
+ log.info(`ResoluciΓ³n : ${vs ? vs.width + 'x' + vs.height : 'desconocida'}`);
153
+ log.info(`DuraciΓ³n : ${Math.round(duration)}s`);
154
+ log.info(`Pistas de audio: ${audioStreams.length}`);
155
+ audioStreams.forEach((a) =>
156
+ log.dim(` [${a.streamIndex}] lang=${a.lang} tΓ­tulo="${a.title}"`)
157
+ );
158
+ sep();
159
+
160
+ // ── ENCODE VIDEO ──────────────────────────────────────────────────────────
161
+ log.step('Procesando video (copy, sin audio)...');
162
+ await encodeVideo(inputPath, outputDir, segmentTime, null, duration);
163
+ log.ok('Video listo');
164
+
165
+ // ── ENCODE AUDIOS ─────────────────────────────────────────────────────────
166
+ const { createMultiBar } = require('./ui');
167
+ const multibar = createMultiBar();
168
+ const audioBars = {};
169
+
170
+ for (const a of audioStreams) {
171
+ audioBars[a.lang] = multibar.add(100, 0, { label: `Audio[${a.lang}]` });
172
+ }
173
+
174
+ const audioPromises = audioStreams.map((a) =>
175
+ encodeAudio(inputPath, outputDir, a, segmentTime, (lang, pct) => {
176
+ if (audioBars[lang]) audioBars[lang].update(Math.min(Math.round(pct), 99));
177
+ }).then((p) => {
178
+ if (audioBars[a.lang]) audioBars[a.lang].update(100);
179
+ return p;
180
+ })
181
+ );
182
+
183
+ await Promise.all(audioPromises);
184
+ multibar.stop();
185
+ log.ok('Todos los audios listos');
186
+
187
+ // ── MASTER M3U8 ───────────────────────────────────────────────────────────
188
+ sep();
189
+ log.step('Generando master.m3u8...');
190
+ const masterPath = await buildMasterPlaylist(outputDir, audioStreams, meta);
191
+ log.ok(`master.m3u8 creado β†’ ${masterPath}`);
192
+
193
+ return { masterPath, audioStreams, meta };
194
+ }
195
+
196
+ module.exports = { encodeHLS, probeFile, getAudioStreams };
c/github.js ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+ const axios = require('axios');
3
+ const simpleGit = require('simple-git');
4
+ const fs = require('fs-extra');
5
+ const path = require('path');
6
+ const { log, createBar, sep } = require('./ui');
7
+ const chalk = require('chalk');
8
+
9
+ // ─── VALIDATE TOKEN + GET USER ─────────────────────────────────────────────────
10
+ async function getGitHubUser(token) {
11
+ const { data } = await axios.get('https://api.github.com/user', {
12
+ headers: { Authorization: `token ${token}` },
13
+ });
14
+ return data.login;
15
+ }
16
+
17
+ // ─── CREATE REPO ──────────────────────────────────────────────────────────────
18
+ async function createRepo(token, repoName, isPrivate = true) {
19
+ try {
20
+ await axios.post(
21
+ 'https://api.github.com/user/repos',
22
+ { name: repoName, private: isPrivate, auto_init: false },
23
+ { headers: { Authorization: `token ${token}` } }
24
+ );
25
+ log.ok(`Repositorio '${repoName}' creado en GitHub`);
26
+ } catch (e) {
27
+ if (e.response && e.response.status === 422) {
28
+ log.warn(`El repositorio '${repoName}' ya existe, se usarΓ‘ tal cual`);
29
+ } else {
30
+ throw e;
31
+ }
32
+ }
33
+ }
34
+
35
+ // ─── COLLECT ALL FILES RECURSIVELY ────────────────────────────────────────────
36
+ function collectFiles(dir) {
37
+ const result = [];
38
+ function walk(current) {
39
+ const entries = fs.readdirSync(current, { withFileTypes: true });
40
+ for (const entry of entries) {
41
+ const full = path.join(current, entry.name);
42
+ if (entry.isDirectory()) {
43
+ walk(full);
44
+ } else {
45
+ result.push(full);
46
+ }
47
+ }
48
+ }
49
+ walk(dir);
50
+ return result;
51
+ }
52
+
53
+ // ─── PUSH WITH RETRY ──────────────────────────────────────────────────────────
54
+ async function pushWithRetry(git, maxRetries = 10) {
55
+ for (let i = 1; i <= maxRetries; i++) {
56
+ try {
57
+ await git.push('origin', 'main', ['--set-upstream']);
58
+ return;
59
+ } catch (e) {
60
+ log.warn(`Push fallΓ³ (intento ${i}/${maxRetries}). Reintentando en 5s...`);
61
+ await new Promise((r) => setTimeout(r, 5000));
62
+ }
63
+ }
64
+ throw new Error('Push fallΓ³ tras todos los reintentos');
65
+ }
66
+
67
+ // ─── UPLOAD FOLDER TO GITHUB ──────────────────────────────────────────────────
68
+ async function uploadToGitHub({ token, repoName, folderPath, batchSize, isPrivate = true }) {
69
+ sep();
70
+ log.step(`GitHub β†’ Inicializando repo: ${repoName}`);
71
+
72
+ const user = await getGitHubUser(token);
73
+ log.ok(`Autenticado como: ${user}`);
74
+
75
+ await createRepo(token, repoName, isPrivate);
76
+
77
+ // Init git
78
+ const git = simpleGit(folderPath);
79
+ const isRepo = await fs.pathExists(path.join(folderPath, '.git'));
80
+ if (!isRepo) {
81
+ await git.init();
82
+ await git.checkoutLocalBranch('main');
83
+ }
84
+
85
+ await git.addConfig('user.name', user);
86
+ await git.addConfig('user.email', `${user}@users.noreply.github.com`);
87
+
88
+ // Set remote
89
+ const remoteUrl = `https://${token}@github.com/${user}/${repoName}.git`;
90
+ const remotes = await git.getRemotes();
91
+ if (remotes.find((r) => r.name === 'origin')) {
92
+ await git.remote(['set-url', 'origin', remoteUrl]);
93
+ } else {
94
+ await git.addRemote('origin', remoteUrl);
95
+ }
96
+
97
+ // Collect files
98
+ const allFiles = collectFiles(folderPath);
99
+ const total = allFiles.length;
100
+ log.info(`Archivos a subir: ${total} | Lote: ${batchSize}`);
101
+ sep();
102
+
103
+ const bar = createBar('Subiendo ', total);
104
+ let uploaded = 0;
105
+ let batchNum = 0;
106
+ let batchFiles = [];
107
+
108
+ for (let i = 0; i < allFiles.length; i++) {
109
+ const file = allFiles[i];
110
+ await git.add(file);
111
+ batchFiles.push(file);
112
+ uploaded++;
113
+ bar.update(uploaded);
114
+
115
+ const isLast = i === allFiles.length - 1;
116
+ if (batchFiles.length >= batchSize || isLast) {
117
+ batchNum++;
118
+ const msg = isLast && batchFiles.length < batchSize
119
+ ? `Lote final ${batchNum} (${batchFiles.length} archivos)`
120
+ : `Lote ${batchNum} (${batchFiles.length} archivos)`;
121
+
122
+ await git.commit(msg, { '--allow-empty': null });
123
+ await pushWithRetry(git);
124
+ batchFiles = [];
125
+ }
126
+ }
127
+
128
+ bar.stop();
129
+ sep();
130
+ log.ok(`βœ… Subida completa β†’ https://github.com/${user}/${repoName}`);
131
+ return `https://github.com/${user}/${repoName}`;
132
+ }
133
+
134
+ module.exports = { uploadToGitHub, getGitHubUser, createRepo };
c/index.js ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const inquirer = require('inquirer');
5
+ const fs = require('fs-extra');
6
+ const path = require('path');
7
+ const os = require('os');
8
+ const chalk = require('chalk');
9
+
10
+ const { printBanner, section, log, sep } = require('./ui');
11
+ const tmdb = require('./tmdb');
12
+ const { encodeHLS } = require('./encoder');
13
+ const { uploadToGitHub, getGitHubUser } = require('./github');
14
+ const { deployToCloudflare } = require('./cloudflare');
15
+ const { resolveInput, parseBulkList } = require('./input');
16
+
17
+ const TMP_BASE = path.join(os.tmpdir(), 'hls-uploader');
18
+
19
+ // ─── ENTRY POINT ──────────────────────────────────────────────────────────────
20
+ async function main() {
21
+ printBanner();
22
+
23
+ // ── CREDENCIALES ────────────────────────────────────────────────────────────
24
+ section('CONFIGURACIΓ“N');
25
+ const creds = await inquirer.prompt([
26
+ {
27
+ type: 'input',
28
+ name: 'tmdbKey',
29
+ message: '🎬 TMDB API Key:',
30
+ validate: (v) => v.trim().length > 0 || 'Requerido',
31
+ },
32
+ {
33
+ type: 'password',
34
+ name: 'githubToken',
35
+ message: 'πŸ”‘ GitHub Personal Access Token (PAT):',
36
+ mask: '*',
37
+ validate: (v) => v.trim().length > 0 || 'Requerido',
38
+ },
39
+ {
40
+ type: 'number',
41
+ name: 'batchSize',
42
+ message: 'πŸ“¦ Archivos por lote GitHub (ej: 50):',
43
+ default: 50,
44
+ validate: (v) => (v > 0 && v <= 500) || 'Entre 1 y 500',
45
+ },
46
+ {
47
+ type: 'number',
48
+ name: 'segmentTime',
49
+ message: '⏱ Duración de segmento HLS en segundos (ej: 6):',
50
+ default: 6,
51
+ validate: (v) => v > 0 || 'Debe ser mayor a 0',
52
+ },
53
+ ]);
54
+
55
+ // Validar token GitHub
56
+ let githubUser;
57
+ try {
58
+ githubUser = await getGitHubUser(creds.githubToken);
59
+ log.ok(`GitHub: autenticado como ${chalk.bold(githubUser)}`);
60
+ } catch {
61
+ log.error('Token de GitHub invΓ‘lido o sin permisos. Saliendo.');
62
+ process.exit(1);
63
+ }
64
+
65
+ // ── TIPO DE CONTENIDO ────────────────────────────────────────────────────────
66
+ section('TIPO DE CONTENIDO');
67
+ const { contentType } = await inquirer.prompt([
68
+ {
69
+ type: 'list',
70
+ name: 'contentType',
71
+ message: 'ΒΏQuΓ© tipo de contenido vas a subir?',
72
+ choices: [
73
+ { name: '🎬 Película', value: 'movie' },
74
+ { name: 'πŸ“Ί Serie (episodios)', value: 'series' },
75
+ ],
76
+ },
77
+ ]);
78
+
79
+ // ── BÚSQUEDA TMDB ─────────────────────────────────────────────────────────
80
+ section('BÚSQUEDA EN TMDB');
81
+ const { tmdbQuery } = await inquirer.prompt([
82
+ {
83
+ type: 'input',
84
+ name: 'tmdbQuery',
85
+ message: `πŸ” Busca la ${contentType === 'movie' ? 'pelΓ­cula' : 'serie'} en TMDB:`,
86
+ validate: (v) => v.trim().length > 0 || 'Requerido',
87
+ },
88
+ ]);
89
+
90
+ const results = await tmdb.searchTMDB(creds.tmdbKey, tmdbQuery, contentType === 'movie' ? 'movie' : 'tv');
91
+ if (!results.length) {
92
+ log.error('No se encontraron resultados en TMDB.');
93
+ process.exit(1);
94
+ }
95
+
96
+ const choices = results.slice(0, 8).map((r) => ({
97
+ name: contentType === 'movie'
98
+ ? `${r.title} (${(r.release_date || '').substring(0, 4)}) β€” id:${r.id}`
99
+ : `${r.name} (${(r.first_air_date || '').substring(0, 4)}) β€” id:${r.id}`,
100
+ value: r,
101
+ }));
102
+
103
+ const { selectedItem } = await inquirer.prompt([
104
+ {
105
+ type: 'list',
106
+ name: 'selectedItem',
107
+ message: 'Selecciona el resultado correcto:',
108
+ choices,
109
+ },
110
+ ]);
111
+
112
+ // ── CONFIGURACIΓ“N DE SERIE ─────────────────────────────────────────────────
113
+ let seriesConfig = null;
114
+ if (contentType === 'series') {
115
+ section('CONFIGURACIΓ“N DE SERIE');
116
+ const tvDetail = await tmdb.getTVDetail(creds.tmdbKey, selectedItem.id);
117
+ log.info(`Serie: ${tvDetail.name} | Temporadas: ${tvDetail.number_of_seasons}`);
118
+
119
+ seriesConfig = await inquirer.prompt([
120
+ {
121
+ type: 'number',
122
+ name: 'season',
123
+ message: 'πŸ“… Temporada (nΓΊmero):',
124
+ validate: (v) => v > 0 || 'Debe ser mayor a 0',
125
+ },
126
+ {
127
+ type: 'number',
128
+ name: 'startEpisode',
129
+ message: 'β–Ά Episodio inicial:',
130
+ default: 1,
131
+ validate: (v) => v > 0 || 'Debe ser mayor a 0',
132
+ },
133
+ ]);
134
+ seriesConfig.tvDetail = tvDetail;
135
+ }
136
+
137
+ // ── MODO BULK o SINGLE ──────────────────────────────────────────────────���────
138
+ section('MODO DE PROCESAMIENTO');
139
+ const { mode } = await inquirer.prompt([
140
+ {
141
+ type: 'list',
142
+ name: 'mode',
143
+ message: 'ΒΏCuΓ‘ntos archivos vas a procesar?',
144
+ choices: [
145
+ { name: '1️⃣ Un solo archivo', value: 'single' },
146
+ { name: 'πŸ“š Bulk (varios archivos)', value: 'bulk' },
147
+ ],
148
+ },
149
+ ]);
150
+
151
+ // ── RECOPILAR INPUTS ──────────────────────────────────────────────────────
152
+ let inputList = [];
153
+ if (mode === 'single') {
154
+ const { inputSrc } = await inquirer.prompt([
155
+ {
156
+ type: 'input',
157
+ name: 'inputSrc',
158
+ message: 'πŸ“ Ruta del archivo o URL del video:',
159
+ validate: (v) => v.trim().length > 0 || 'Requerido',
160
+ },
161
+ ]);
162
+ inputList = [inputSrc.trim()];
163
+ } else {
164
+ log.info('Ingresa las rutas o URLs, una por lΓ­nea.');
165
+ log.info('Cuando termines, escribe "FIN" y presiona Enter.');
166
+ sep();
167
+
168
+ const lines = [];
169
+ const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
170
+ await new Promise((resolve) => {
171
+ const ask = () => {
172
+ rl.question(chalk.cyan(` [${lines.length + 1}] > `), (ans) => {
173
+ if (ans.trim().toUpperCase() === 'FIN') {
174
+ rl.close();
175
+ resolve();
176
+ } else if (ans.trim()) {
177
+ lines.push(ans.trim());
178
+ ask();
179
+ } else {
180
+ ask();
181
+ }
182
+ });
183
+ };
184
+ ask();
185
+ });
186
+ inputList = lines;
187
+ }
188
+
189
+ if (inputList.length === 0) {
190
+ log.error('No se ingresaron archivos. Saliendo.');
191
+ process.exit(1);
192
+ }
193
+
194
+ // ── DESTINO DE SUBIDA ───────────────────────────────────────────────────────
195
+ section('DESTINO DE SUBIDA');
196
+ const { uploadTargets } = await inquirer.prompt([
197
+ {
198
+ type: 'checkbox',
199
+ name: 'uploadTargets',
200
+ message: 'ΒΏDΓ³nde deseas subir el resultado?',
201
+ choices: [
202
+ { name: 'πŸ™ GitHub (con lotes)', value: 'github', checked: true },
203
+ { name: '☁️ Cloudflare Pages', value: 'cloudflare' },
204
+ ],
205
+ validate: (v) => v.length > 0 || 'Selecciona al menos uno',
206
+ },
207
+ ]);
208
+
209
+ // ── NOMBRES DE REPO / PROJECT ────────────────────────────────────────────────
210
+ let githubRepoName = null;
211
+ let cloudflareProject = null;
212
+
213
+ if (uploadTargets.includes('github')) {
214
+ section('GITHUB');
215
+ const ghAns = await inquirer.prompt([
216
+ {
217
+ type: 'input',
218
+ name: 'repoName',
219
+ message: 'πŸ“¦ Nombre del repositorio GitHub (puedes usar nombre TMDB sugerido o el tuyo):',
220
+ default: contentType === 'movie'
221
+ ? tmdb.toRepoName(tmdb.formatMovieName(selectedItem))
222
+ : tmdb.toRepoName(selectedItem.name || selectedItem.title),
223
+ validate: (v) => v.trim().length > 0 || 'Requerido',
224
+ },
225
+ {
226
+ type: 'confirm',
227
+ name: 'isPrivate',
228
+ message: 'πŸ”’ ΒΏRepo privado?',
229
+ default: true,
230
+ },
231
+ ]);
232
+ githubRepoName = ghAns.repoName.trim();
233
+
234
+ // En bulk: para series, el nombre base se usa y se aΓ±ade S01E01 automΓ‘ticamente
235
+ // Para pelΓ­cula en bulk: repo ΓΊnico con sufijo numΓ©rico si hay mΓ‘s de 1
236
+ }
237
+
238
+ if (uploadTargets.includes('cloudflare')) {
239
+ section('CLOUDFLARE PAGES');
240
+ const cfAns = await inquirer.prompt([
241
+ {
242
+ type: 'input',
243
+ name: 'projectName',
244
+ message: '🌐 Nombre del proyecto Cloudflare Pages:',
245
+ default: contentType === 'movie'
246
+ ? tmdb.toRepoName(tmdb.formatMovieName(selectedItem))
247
+ : tmdb.toRepoName(selectedItem.name || selectedItem.title),
248
+ validate: (v) => v.trim().length > 0 || 'Requerido',
249
+ },
250
+ ]);
251
+ cloudflareProject = cfAns.projectName.trim();
252
+ }
253
+
254
+ // ─────────────────────────────────────────────────────────────────────────────
255
+ // PROCESAMIENTO PRINCIPAL
256
+ // ─────────────────────────────────────────────────────────────────────────────
257
+ section(`PROCESANDO ${inputList.length} ARCHIVO(S)`);
258
+
259
+ const results_summary = [];
260
+ const tmpDownloads = path.join(TMP_BASE, 'downloads');
261
+
262
+ for (let i = 0; i < inputList.length; i++) {
263
+ const inputSrc = inputList[i];
264
+ const itemNumber = i + 1;
265
+
266
+ // ── Nombre del Γ­tem ─────────────────────────────────────────────────────
267
+ let itemName;
268
+ let repoForThisItem = githubRepoName;
269
+ let pagesForThisItem = cloudflareProject;
270
+
271
+ if (contentType === 'movie') {
272
+ const friendlyName = tmdb.formatMovieName(selectedItem);
273
+ itemName = inputList.length > 1
274
+ ? `${friendlyName} - Part ${itemNumber}`
275
+ : friendlyName;
276
+ if (inputList.length > 1) {
277
+ repoForThisItem = `${githubRepoName}-part-${itemNumber}`;
278
+ pagesForThisItem = `${cloudflareProject}-part-${itemNumber}`;
279
+ }
280
+ } else {
281
+ // Serie: auto-incrementar episodio
282
+ const season = seriesConfig.season;
283
+ const episode = seriesConfig.startEpisode + i;
284
+ let epDetail = null;
285
+ try {
286
+ epDetail = await tmdb.getEpisodeDetail(creds.tmdbKey, selectedItem.id, season, episode);
287
+ } catch { /* sin datos de episodio */ }
288
+
289
+ itemName = tmdb.formatEpisodeName(
290
+ seriesConfig.tvDetail, season, episode, epDetail
291
+ );
292
+ const s = String(season).padStart(2, '0');
293
+ const e = String(episode).padStart(2, '0');
294
+ repoForThisItem = `${githubRepoName}-s${s}e${e}`;
295
+ pagesForThisItem = `${cloudflareProject}-s${s}e${e}`;
296
+ }
297
+
298
+ sep();
299
+ log.step(`[${itemNumber}/${inputList.length}] ${itemName}`);
300
+
301
+ // ── Resolver input ────────────────────────────────────────────────────
302
+ let localFile;
303
+ try {
304
+ localFile = await resolveInput(inputSrc, tmpDownloads);
305
+ } catch (e) {
306
+ log.error(`No se pudo resolver el input: ${e.message}`);
307
+ results_summary.push({ name: itemName, status: 'ERROR', error: e.message });
308
+ continue;
309
+ }
310
+
311
+ // ── Carpeta de salida ─────────────────────────────────────────────────
312
+ const outputDir = path.join(TMP_BASE, 'output', tmdb.sanitizeName(itemName));
313
+ await fs.ensureDir(outputDir);
314
+
315
+ // ── Encodear HLS ─────────────────────────────────────────────────────
316
+ try {
317
+ await encodeHLS(localFile, outputDir, creds.segmentTime);
318
+ } catch (e) {
319
+ log.error(`Error al encodear: ${e.message}`);
320
+ results_summary.push({ name: itemName, status: 'ERROR', error: e.message });
321
+ continue;
322
+ }
323
+
324
+ const uploadResult = { name: itemName, status: 'OK', github: null, cloudflare: null };
325
+
326
+ // ── GitHub ────────────────────────────────────────────────────────────
327
+ if (uploadTargets.includes('github') && repoForThisItem) {
328
+ try {
329
+ const url = await uploadToGitHub({
330
+ token: creds.githubToken,
331
+ repoName: repoForThisItem,
332
+ folderPath: outputDir,
333
+ batchSize: creds.batchSize,
334
+ isPrivate: true,
335
+ });
336
+ uploadResult.github = url;
337
+ } catch (e) {
338
+ log.error(`Error en GitHub: ${e.message}`);
339
+ uploadResult.github = `ERROR: ${e.message}`;
340
+ }
341
+ }
342
+
343
+ // ── Cloudflare Pages ──────────────────────────────────────────────────
344
+ if (uploadTargets.includes('cloudflare') && pagesForThisItem) {
345
+ try {
346
+ const url = await deployToCloudflare({
347
+ folderPath: outputDir,
348
+ projectName: pagesForThisItem,
349
+ });
350
+ uploadResult.cloudflare = url;
351
+ } catch (e) {
352
+ log.error(`Error en Cloudflare: ${e.message}`);
353
+ uploadResult.cloudflare = `ERROR: ${e.message}`;
354
+ }
355
+ }
356
+
357
+ results_summary.push(uploadResult);
358
+ log.ok(`βœ… ${itemName} completado`);
359
+ }
360
+
361
+ // ─────────────────────────────────────────────────────────────────────────────
362
+ // RESUMEN FINAL
363
+ // ─────────────────────────────────────────────────────────────────────────────
364
+ section('RESUMEN FINAL');
365
+ console.log(chalk.bold.white(' Item'.padEnd(50) + 'GitHub'.padEnd(50) + 'Cloudflare'));
366
+ console.log(chalk.gray(' ' + '─'.repeat(130)));
367
+
368
+ for (const r of results_summary) {
369
+ const status = r.status === 'OK' ? chalk.green('βœ”') : chalk.red('βœ–');
370
+ const gh = r.github || chalk.gray('β€”');
371
+ const cf = r.cloudflare || chalk.gray('β€”');
372
+ const name = r.name.substring(0, 45).padEnd(48);
373
+ console.log(` ${status} ${chalk.white(name)} ${String(gh).substring(0, 45).padEnd(48)} ${cf}`);
374
+ }
375
+
376
+ sep();
377
+ log.ok('Β‘Todo terminado! πŸŽ‰');
378
+ }
379
+
380
+ main().catch((e) => {
381
+ console.error(chalk.red('\n βœ– Error fatal: ' + e.message));
382
+ process.exit(1);
383
+ });
c/input.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+ const fs = require('fs-extra');
3
+ const path = require('path');
4
+ const fetch = require('node-fetch');
5
+ const { log, createBar } = require('./ui');
6
+
7
+ // ─── DETECT IF INPUT IS URL ────────────────────────────────────────────────────
8
+ function isURL(str) {
9
+ try {
10
+ const u = new URL(str);
11
+ return u.protocol === 'http:' || u.protocol === 'https:';
12
+ } catch {
13
+ return false;
14
+ }
15
+ }
16
+
17
+ // ─── DOWNLOAD FILE FROM URL ────────────────────────────────────────────────────
18
+ async function downloadFile(url, destDir, filename) {
19
+ await fs.ensureDir(destDir);
20
+ const destPath = path.join(destDir, filename);
21
+
22
+ log.step(`Descargando: ${url}`);
23
+ const response = await fetch(url);
24
+ if (!response.ok) throw new Error(`HTTP ${response.status} al descargar ${url}`);
25
+
26
+ const total = parseInt(response.headers.get('content-length') || '0', 10);
27
+ const bar = total > 0 ? createBar('Descarga ', total) : null;
28
+
29
+ const fileStream = fs.createWriteStream(destPath);
30
+ let downloaded = 0;
31
+
32
+ await new Promise((resolve, reject) => {
33
+ response.body.on('data', (chunk) => {
34
+ downloaded += chunk.length;
35
+ if (bar) bar.update(Math.min(downloaded, total));
36
+ });
37
+ response.body.pipe(fileStream);
38
+ response.body.on('error', reject);
39
+ fileStream.on('finish', () => {
40
+ if (bar) bar.update(total);
41
+ resolve();
42
+ });
43
+ });
44
+
45
+ log.ok(`Descargado β†’ ${destPath}`);
46
+ return destPath;
47
+ }
48
+
49
+ // ─── RESOLVE INPUT TO LOCAL FILE PATH ────────────────────────────────────────
50
+ async function resolveInput(input, tmpDir) {
51
+ if (isURL(input)) {
52
+ // Obtener nombre del archivo de la URL
53
+ const urlObj = new URL(input);
54
+ const basename = path.basename(urlObj.pathname) || 'input.mkv';
55
+ return await downloadFile(input, tmpDir, basename);
56
+ }
57
+
58
+ // Es una ruta local
59
+ if (!fs.existsSync(input)) throw new Error(`El archivo no existe: ${input}`);
60
+ return path.resolve(input);
61
+ }
62
+
63
+ // ─── PARSE BULK INPUT LIST ─────────────────────────────────────────────────────
64
+ // Acepta rutas o URLs, una por lΓ­nea
65
+ function parseBulkList(text) {
66
+ return text
67
+ .split('\n')
68
+ .map((l) => l.trim())
69
+ .filter((l) => l.length > 0 && !l.startsWith('#'));
70
+ }
71
+
72
+ module.exports = { isURL, downloadFile, resolveInput, parseBulkList };
c/package.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "hls-uploader",
3
+ "version": "1.0.0",
4
+ "description": "HLS encoder + GitHub + Cloudflare Pages uploader",
5
+ "main": "src/index.js",
6
+ "type": "commonjs",
7
+ "scripts": {
8
+ "start": "node src/index.js"
9
+ },
10
+ "dependencies": {
11
+ "axios": "^1.6.0",
12
+ "chalk": "^4.1.2",
13
+ "cli-progress": "^3.12.0",
14
+ "figlet": "^1.7.0",
15
+ "fluent-ffmpeg": "^2.1.3",
16
+ "fs-extra": "^11.2.0",
17
+ "inquirer": "^8.2.6",
18
+ "node-fetch": "^2.7.0",
19
+ "ora": "^5.4.1",
20
+ "simple-git": "^3.22.0",
21
+ "which": "^3.0.1"
22
+ }
23
+ }
c/tmdb.js ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+ const axios = require('axios');
3
+ const { log } = require('./ui');
4
+
5
+ const BASE = 'https://api.themoviedb.org/3';
6
+
7
+ // ─── SEARCH ───────────────────────────────────────────────────────────────────
8
+ async function searchTMDB(apiKey, query, type) {
9
+ const endpoint = type === 'movie' ? '/search/movie' : '/search/tv';
10
+ const { data } = await axios.get(BASE + endpoint, {
11
+ params: { api_key: apiKey, query, language: 'es-ES', page: 1 },
12
+ });
13
+ return data.results || [];
14
+ }
15
+
16
+ // ─── MOVIE DETAIL ─────────────────────────────────────────────────────────────
17
+ async function getMovieDetail(apiKey, id) {
18
+ const { data } = await axios.get(`${BASE}/movie/${id}`, {
19
+ params: { api_key: apiKey, language: 'es-ES' },
20
+ });
21
+ return data;
22
+ }
23
+
24
+ // ─── TV SEASON ────────────────────────────────────────────────────────────────
25
+ async function getSeasonDetail(apiKey, seriesId, season) {
26
+ const { data } = await axios.get(`${BASE}/tv/${seriesId}/season/${season}`, {
27
+ params: { api_key: apiKey, language: 'es-ES' },
28
+ });
29
+ return data;
30
+ }
31
+
32
+ // ─── TV EPISODE ───────────────────────────────────────────────────────────────
33
+ async function getEpisodeDetail(apiKey, seriesId, season, episode) {
34
+ const { data } = await axios.get(`${BASE}/tv/${seriesId}/season/${season}/episode/${episode}`, {
35
+ params: { api_key: apiKey, language: 'es-ES' },
36
+ });
37
+ return data;
38
+ }
39
+
40
+ // ─── TV SHOW DETAIL ───────────────────────────────────────────────────────────
41
+ async function getTVDetail(apiKey, id) {
42
+ const { data } = await axios.get(`${BASE}/tv/${id}`, {
43
+ params: { api_key: apiKey, language: 'es-ES' },
44
+ });
45
+ return data;
46
+ }
47
+
48
+ // ─── FORMAT MOVIE NAME ────────────────────────────────────────────────────────
49
+ function formatMovieName(movie) {
50
+ const year = movie.release_date ? movie.release_date.substring(0, 4) : '';
51
+ return sanitizeName(`${movie.title} (${year})`);
52
+ }
53
+
54
+ // ─── FORMAT SERIES EPISODE NAME ──────────────────────────────────────────────
55
+ function formatEpisodeName(series, season, episode, ep) {
56
+ const epTitle = ep ? ep.name : '';
57
+ const s = String(season).padStart(2, '0');
58
+ const e = String(episode).padStart(2, '0');
59
+ return sanitizeName(`${series.name} S${s}E${e}${epTitle ? ' - ' + epTitle : ''}`);
60
+ }
61
+
62
+ // ─── SANITIZE ─────────────────────────────────────────────────────────────────
63
+ function sanitizeName(name) {
64
+ return name
65
+ .replace(/[<>:"/\\|?*]/g, '')
66
+ .replace(/\s+/g, ' ')
67
+ .trim()
68
+ .substring(0, 100);
69
+ }
70
+
71
+ // ─── SAFE REPO NAME ───────────────────────────────────────────────────────────
72
+ function toRepoName(name) {
73
+ return name
74
+ .toLowerCase()
75
+ .replace(/[^a-z0-9\-_\.]/g, '-')
76
+ .replace(/-+/g, '-')
77
+ .replace(/^-|-$/g, '')
78
+ .substring(0, 100);
79
+ }
80
+
81
+ module.exports = {
82
+ searchTMDB,
83
+ getMovieDetail,
84
+ getSeasonDetail,
85
+ getEpisodeDetail,
86
+ getTVDetail,
87
+ formatMovieName,
88
+ formatEpisodeName,
89
+ sanitizeName,
90
+ toRepoName,
91
+ };
c/ui.js ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+ const chalk = require('chalk');
3
+ const figlet = require('figlet');
4
+ const cliProgress = require('cli-progress');
5
+
6
+ // ─── BANNER ───────────────────────────────────────────────────────────────────
7
+ function printBanner() {
8
+ const text = figlet.textSync('HLS UPLOADER', {
9
+ font: 'ANSI Shadow',
10
+ horizontalLayout: 'default',
11
+ });
12
+ console.log(chalk.cyan(text));
13
+ console.log(
14
+ chalk.gray(' ─────────────────────────────────────────────────────────────\n') +
15
+ chalk.bold.white(' 🎬 HLS Encoder β†’ GitHub β†’ Cloudflare Pages\n') +
16
+ chalk.gray(' Video: copy (sin re-encodear) | Audio: MP3 separado por pista\n') +
17
+ chalk.gray(' ─────────────────────────────────────────────────────────────\n')
18
+ );
19
+ }
20
+
21
+ // ─── SECTION HEADER ───────────────────────────────────────────────────────────
22
+ function section(title) {
23
+ console.log('\n' + chalk.bgCyan.black.bold(` ${title} `) + '\n');
24
+ }
25
+
26
+ // ─── LOG HELPERS ──────────────────────────────────────────────────────────────
27
+ const log = {
28
+ info: (msg) => console.log(chalk.cyan(' β„Ή ') + chalk.white(msg)),
29
+ ok: (msg) => console.log(chalk.green(' βœ” ') + chalk.white(msg)),
30
+ warn: (msg) => console.log(chalk.yellow(' ⚠ ') + chalk.yellow(msg)),
31
+ error: (msg) => console.log(chalk.red(' βœ– ') + chalk.red(msg)),
32
+ step: (msg) => console.log(chalk.magenta(' β–Ά ') + chalk.bold.white(msg)),
33
+ dim: (msg) => console.log(chalk.gray(' ' + msg)),
34
+ };
35
+
36
+ // ─── PROGRESS BAR ─────────────────────────────────────────────────────────────
37
+ function createBar(label, total) {
38
+ const bar = new cliProgress.SingleBar({
39
+ format:
40
+ chalk.cyan(' ' + label + ' ') +
41
+ chalk.cyan('[') +
42
+ chalk.bold.cyan('{bar}') +
43
+ chalk.cyan(']') +
44
+ chalk.white(' {percentage}%') +
45
+ chalk.gray(' | {value}/{total}') +
46
+ chalk.gray(' | {eta_formatted}'),
47
+ barCompleteChar: 'β–ˆ',
48
+ barIncompleteChar: 'β–‘',
49
+ hideCursor: true,
50
+ clearOnComplete: false,
51
+ stopOnComplete: true,
52
+ }, cliProgress.Presets.shades_classic);
53
+ bar.start(total, 0);
54
+ return bar;
55
+ }
56
+
57
+ // ─── MULTI-BAR ────────────────────────────────────────────────────────────────
58
+ function createMultiBar() {
59
+ return new cliProgress.MultiBar({
60
+ format:
61
+ chalk.cyan(' {label} ') +
62
+ chalk.cyan('[') +
63
+ chalk.bold.cyan('{bar}') +
64
+ chalk.cyan(']') +
65
+ chalk.white(' {percentage}%') +
66
+ chalk.gray(' {value}/{total}'),
67
+ barCompleteChar: 'β–ˆ',
68
+ barIncompleteChar: 'β–‘',
69
+ hideCursor: true,
70
+ clearOnComplete: false,
71
+ stopOnComplete: false,
72
+ autopadding: true,
73
+ }, cliProgress.Presets.shades_classic);
74
+ }
75
+
76
+ // ─── SEPARATOR ────────────────────────────────────────────────────────────────
77
+ function sep() {
78
+ console.log(chalk.gray(' ─────────────────────────────────────────────────────────────'));
79
+ }
80
+
81
+ module.exports = { printBanner, section, log, createBar, createMultiBar, sep };