mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-03-22 09:05:49 +05:30
refactor: use pip3 yt-dlp in flatpak
This commit is contained in:
@@ -37,7 +37,6 @@
|
|||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
],
|
],
|
||||||
"externalBin": [
|
"externalBin": [
|
||||||
"binaries/yt-dlp",
|
|
||||||
"binaries/deno"
|
"binaries/deno"
|
||||||
],
|
],
|
||||||
"resources": {
|
"resources": {
|
||||||
|
|||||||
@@ -257,7 +257,10 @@ export default function App({ children }: { children: React.ReactNode }) {
|
|||||||
const fetchYtDlpVersion = async () => {
|
const fetchYtDlpVersion = async () => {
|
||||||
setIsFetchingYtDlpVersion(true);
|
setIsFetchingYtDlpVersion(true);
|
||||||
try {
|
try {
|
||||||
const command = Command.sidecar('binaries/yt-dlp', ['--version']);
|
const isFlatpak = await invoke<boolean>('is_flatpak');
|
||||||
|
const command = isFlatpak
|
||||||
|
? Command.create('sh', ['-c', `yt-dlp --version`])
|
||||||
|
: Command.sidecar('binaries/yt-dlp', ['--version']);
|
||||||
const output = await command.execute();
|
const output = await command.execute();
|
||||||
if (output.code === 0) {
|
if (output.code === 0) {
|
||||||
const version = output.stdout.trim();
|
const version = output.stdout.trim();
|
||||||
|
|||||||
@@ -196,7 +196,10 @@ export default function useDownloader() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const command = Command.sidecar('binaries/yt-dlp', args);
|
const isFlatpak = await invoke<boolean>('is_flatpak');
|
||||||
|
const command = isFlatpak
|
||||||
|
? Command.create('sh', ['-c', `yt-dlp ${args.map(arg => arg.includes(' ') ? `"${arg}"` : arg).join(' ')}`])
|
||||||
|
: Command.sidecar('binaries/yt-dlp', args);
|
||||||
|
|
||||||
let jsonOutput = '';
|
let jsonOutput = '';
|
||||||
|
|
||||||
@@ -557,7 +560,10 @@ export default function useDownloader() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('Starting download with args:', args);
|
console.log('Starting download with args:', args);
|
||||||
const command = Command.sidecar('binaries/yt-dlp', args);
|
const isFlatpak = await invoke<boolean>('is_flatpak');
|
||||||
|
const command = isFlatpak
|
||||||
|
? Command.create('sh', ['-c', `yt-dlp ${args.map(arg => arg.includes(' ') ? `"${arg}"` : arg).join(' ')}`])
|
||||||
|
: Command.sidecar('binaries/yt-dlp', args);
|
||||||
|
|
||||||
command.on('close', async (data) => {
|
command.on('close', async (data) => {
|
||||||
if (data.code !== 0) {
|
if (data.code !== 0) {
|
||||||
|
|||||||
@@ -21,7 +21,13 @@ export function useYtDlpUpdater() {
|
|||||||
setIsUpdatingYtDlp(true);
|
setIsUpdatingYtDlp(true);
|
||||||
LOG.info('NEODLP', 'Updating yt-dlp to latest version');
|
LOG.info('NEODLP', 'Updating yt-dlp to latest version');
|
||||||
try {
|
try {
|
||||||
const command = currentPlatform === 'linux' && !isFlatpak ? Command.create('pkexec', ['yt-dlp', '--update-to', ytDlpUpdateChannel]) : Command.sidecar('binaries/yt-dlp', ['--update-to', ytDlpUpdateChannel]);
|
const command = currentPlatform === 'linux' && isFlatpak
|
||||||
|
? ytDlpUpdateChannel === 'nightly'
|
||||||
|
? Command.create('sh', ['-c', 'pip3 install -U --pre "yt-dlp[default,curl-cffi]"'])
|
||||||
|
: Command.create('sh', ['-c', 'pip3 install -U "yt-dlp[default,curl-cffi]"'])
|
||||||
|
: currentPlatform === 'linux'
|
||||||
|
? Command.create('pkexec', ['yt-dlp', '--update-to', ytDlpUpdateChannel])
|
||||||
|
: Command.sidecar('binaries/yt-dlp', ['--update-to', ytDlpUpdateChannel]);
|
||||||
const output = await command.execute();
|
const output = await command.execute();
|
||||||
if (output.code === 0) {
|
if (output.code === 0) {
|
||||||
console.log("yt-dlp updated successfully:", output.stdout);
|
console.log("yt-dlp updated successfully:", output.stdout);
|
||||||
|
|||||||
Reference in New Issue
Block a user