mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-03-22 05:45:50 +05:30
refactor: use pip3 yt-dlp in flatpak
This commit is contained in:
@@ -66,9 +66,9 @@
|
||||
"args": true
|
||||
},
|
||||
{
|
||||
"name": "sh",
|
||||
"cmd": "sh",
|
||||
"args": true
|
||||
"name": "sh",
|
||||
"cmd": "sh",
|
||||
"args": true
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -131,9 +131,9 @@
|
||||
"args": true
|
||||
},
|
||||
{
|
||||
"name": "sh",
|
||||
"cmd": "sh",
|
||||
"args": true
|
||||
"name": "sh",
|
||||
"cmd": "sh",
|
||||
"args": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"externalBin": [
|
||||
"binaries/yt-dlp",
|
||||
"binaries/deno"
|
||||
],
|
||||
"resources": {
|
||||
|
||||
@@ -257,7 +257,10 @@ export default function App({ children }: { children: React.ReactNode }) {
|
||||
const fetchYtDlpVersion = async () => {
|
||||
setIsFetchingYtDlpVersion(true);
|
||||
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();
|
||||
if (output.code === 0) {
|
||||
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 = '';
|
||||
|
||||
@@ -557,7 +560,10 @@ export default function useDownloader() {
|
||||
}
|
||||
|
||||
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) => {
|
||||
if (data.code !== 0) {
|
||||
|
||||
@@ -21,7 +21,13 @@ export function useYtDlpUpdater() {
|
||||
setIsUpdatingYtDlp(true);
|
||||
LOG.info('NEODLP', 'Updating yt-dlp to latest version');
|
||||
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();
|
||||
if (output.code === 0) {
|
||||
console.log("yt-dlp updated successfully:", output.stdout);
|
||||
|
||||
Reference in New Issue
Block a user