mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-18 08:11:29 +03:00
Electron almost boots, but errors presumably due to a filesystem issue (missing folder?)
This commit is contained in:
@@ -28,12 +28,22 @@ const { spawn } = require('child_process')
|
|||||||
const read_last_lines = require('read-last-lines');
|
const read_last_lines = require('read-last-lines');
|
||||||
var ps = require('ps-node');
|
var ps = require('ps-node');
|
||||||
|
|
||||||
// needed if bin/details somehow gets deleted
|
const using_electron = process.versions['electron'];
|
||||||
const DETAILS_BIN_PATH = 'node_modules/youtube-dl/bin/details'
|
|
||||||
if (!fs.existsSync(DETAILS_BIN_PATH)) fs.writeJSONSync(DETAILS_BIN_PATH, {"version":"2000.06.06","path":"node_modules\\youtube-dl\\bin\\youtube-dl.exe","exec":"youtube-dl.exe","downloader":"youtube-dl"})
|
// youtube-dl consts
|
||||||
|
const YOUTUBE_DL_PATH = using_electron ? 'youtube-dl' : 'node_modules/youtube-dl/bin';
|
||||||
|
const DETAILS_BIN_PATH = path.join(YOUTUBE_DL_PATH, 'details');
|
||||||
|
const DEFAULT_BIN_JSON = {"version":"2000.06.06","path": path.join(YOUTUBE_DL_PATH, "youtube-dl.exe"),"exec":"youtube-dl.exe","downloader":"youtube-dl"};
|
||||||
|
if (!fs.existsSync(DETAILS_BIN_PATH)) fs.writeJSONSync(DETAILS_BIN_PATH, DEFAULT_BIN_JSON);
|
||||||
|
|
||||||
var youtubedl = require('youtube-dl');
|
var youtubedl = require('youtube-dl');
|
||||||
|
|
||||||
|
if (using_electron) {
|
||||||
|
youtubedl.setYtdlBinary(YOUTUBE_DL_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// local APIs
|
||||||
|
|
||||||
var config_api = require('./config.js');
|
var config_api = require('./config.js');
|
||||||
var subscriptions_api = require('./subscriptions')
|
var subscriptions_api = require('./subscriptions')
|
||||||
var categories_api = require('./categories');
|
var categories_api = require('./categories');
|
||||||
@@ -1372,8 +1382,8 @@ async function autoUpdateYoutubeDL() {
|
|||||||
let stored_binary_path = current_app_details['path'];
|
let stored_binary_path = current_app_details['path'];
|
||||||
if (!stored_binary_path || typeof stored_binary_path !== 'string') {
|
if (!stored_binary_path || typeof stored_binary_path !== 'string') {
|
||||||
// logger.info(`INFO: Failed to get youtube-dl binary path at location: ${DETAILS_BIN_PATH}, attempting to guess actual path...`);
|
// logger.info(`INFO: Failed to get youtube-dl binary path at location: ${DETAILS_BIN_PATH}, attempting to guess actual path...`);
|
||||||
const guessed_base_path = 'node_modules/youtube-dl/bin/';
|
const guessed_base_path = YOUTUBE_DL_PATH;
|
||||||
const guessed_file_path = guessed_base_path + 'youtube-dl' + (is_windows ? '.exe' : '');
|
const guessed_file_path = path.join(guessed_base_path, 'youtube-dl' + (is_windows ? '.exe' : ''));
|
||||||
if (fs.existsSync(guessed_file_path)) {
|
if (fs.existsSync(guessed_file_path)) {
|
||||||
stored_binary_path = guessed_file_path;
|
stored_binary_path = guessed_file_path;
|
||||||
// logger.info('INFO: Guess successful! Update process continuing...')
|
// logger.info('INFO: Guess successful! Update process continuing...')
|
||||||
@@ -1424,7 +1434,7 @@ async function downloadLatestYoutubeDLBinary(new_version) {
|
|||||||
const file_ext = is_windows ? '.exe' : '';
|
const file_ext = is_windows ? '.exe' : '';
|
||||||
|
|
||||||
const download_url = `https://github.com/ytdl-org/youtube-dl/releases/latest/download/youtube-dl${file_ext}`;
|
const download_url = `https://github.com/ytdl-org/youtube-dl/releases/latest/download/youtube-dl${file_ext}`;
|
||||||
const output_path = `node_modules/youtube-dl/bin/youtube-dl${file_ext}`;
|
const output_path = path.join(YOUTUBE_DL_PATH, `youtube-dl${file_ext}`);
|
||||||
|
|
||||||
await fetchFile(download_url, output_path, `youtube-dl ${new_version}`);
|
await fetchFile(download_url, output_path, `youtube-dl ${new_version}`);
|
||||||
|
|
||||||
@@ -1435,7 +1445,7 @@ async function downloadLatestYoutubeDLCBinary(new_version) {
|
|||||||
const file_ext = is_windows ? '.exe' : '';
|
const file_ext = is_windows ? '.exe' : '';
|
||||||
|
|
||||||
const download_url = `https://github.com/blackjack4494/yt-dlc/releases/latest/download/youtube-dlc${file_ext}`;
|
const download_url = `https://github.com/blackjack4494/yt-dlc/releases/latest/download/youtube-dlc${file_ext}`;
|
||||||
const output_path = `node_modules/youtube-dl/bin/youtube-dl${file_ext}`;
|
const output_path = path.join(YOUTUBE_DL_PATH, `youtube-dl${file_ext}`);
|
||||||
|
|
||||||
await fetchFile(download_url, output_path, `youtube-dlc ${new_version}`);
|
await fetchFile(download_url, output_path, `youtube-dlc ${new_version}`);
|
||||||
|
|
||||||
@@ -1446,7 +1456,8 @@ async function downloadLatestYoutubeDLPBinary(new_version) {
|
|||||||
const file_ext = is_windows ? '.exe' : '';
|
const file_ext = is_windows ? '.exe' : '';
|
||||||
|
|
||||||
const download_url = `https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp${file_ext}`;
|
const download_url = `https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp${file_ext}`;
|
||||||
const output_path = `node_modules/youtube-dl/bin/youtube-dl${file_ext}`;
|
const output_path = path.join(YOUTUBE_DL_PATH, `youtube-dl${file_ext}`);
|
||||||
|
|
||||||
|
|
||||||
await fetchFile(download_url, output_path, `yt-dlp ${new_version}`);
|
await fetchFile(download_url, output_path, `yt-dlp ${new_version}`);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const { app, BrowserWindow } = require('electron');
|
const { app, BrowserWindow } = require('electron');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
|
const server = require('./app');
|
||||||
|
|
||||||
let win;
|
let win;
|
||||||
|
|
||||||
@@ -8,13 +9,7 @@ function createWindow() {
|
|||||||
win = new BrowserWindow({ width: 800, height: 600 });
|
win = new BrowserWindow({ width: 800, height: 600 });
|
||||||
|
|
||||||
// load the dist folder from Angular
|
// load the dist folder from Angular
|
||||||
win.loadURL(
|
win.loadURL('http://localhost:17442') //ADD THIS
|
||||||
url.format({
|
|
||||||
pathname: path.join(__dirname, `/dist/index.html`),
|
|
||||||
protocol: 'file:',
|
|
||||||
slashes: true
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// The following is optional and will open the DevTools:
|
// The following is optional and will open the DevTools:
|
||||||
// win.webContents.openDevTools()
|
// win.webContents.openDevTools()
|
||||||
1578
backend/package-lock.json
generated
1578
backend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,11 +2,14 @@
|
|||||||
"name": "backend",
|
"name": "backend",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "backend for YoutubeDL-Material",
|
"description": "backend for YoutubeDL-Material",
|
||||||
"main": "index.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "nodemon app.js",
|
"start": "nodemon app.js",
|
||||||
"debug": "set YTDL_MODE=debug && node app.js"
|
"debug": "set YTDL_MODE=debug && node app.js",
|
||||||
|
"electron": "electron main.js",
|
||||||
|
"pack": "electron-builder --dir",
|
||||||
|
"dist": "electron-builder"
|
||||||
},
|
},
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
"ignore": [
|
"ignore": [
|
||||||
@@ -19,6 +22,13 @@
|
|||||||
"restart_general.json"
|
"restart_general.json"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"build": {
|
||||||
|
"appId": "youtubedl.material",
|
||||||
|
"mac": {
|
||||||
|
"category": "public.app-category.utilities"
|
||||||
|
},
|
||||||
|
"files": ["!audio/*", "!video/*", "!users/*", "!subscriptions/*", "!appdata/*"]
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": ""
|
"url": ""
|
||||||
@@ -65,5 +75,9 @@
|
|||||||
"uuidv4": "^6.0.6",
|
"uuidv4": "^6.0.6",
|
||||||
"winston": "^3.2.1",
|
"winston": "^3.2.1",
|
||||||
"youtube-dl": "^3.0.2"
|
"youtube-dl": "^3.0.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"electron": "^13.1.7",
|
||||||
|
"electron-builder": "^22.11.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user