mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-03-24 16:55:50 +05:30
refactor: switched to self-contained yt-dlp on flatpak
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
],
|
],
|
||||||
"externalBin": [
|
"externalBin": [
|
||||||
|
"binaries/yt-dlp",
|
||||||
"binaries/deno",
|
"binaries/deno",
|
||||||
"binaries/neodlp-pot"
|
"binaries/neodlp-pot"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ export default function App({ children }: { children: React.ReactNode }) {
|
|||||||
const isFlatpak = await invoke<boolean>('is_flatpak');
|
const isFlatpak = await invoke<boolean>('is_flatpak');
|
||||||
const xdgDataDir = await dataDir();
|
const xdgDataDir = await dataDir();
|
||||||
const command = isFlatpak
|
const command = isFlatpak
|
||||||
? Command.create('sh', ['-c', `${xdgDataDir}/pip/bin/yt-dlp --version`])
|
? Command.create('sh', ['-c', `${xdgDataDir}/yt-dlp/yt-dlp --version`])
|
||||||
: Command.sidecar('binaries/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) {
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ export default function useDownloader() {
|
|||||||
const isFlatpak = await invoke<boolean>('is_flatpak');
|
const isFlatpak = await invoke<boolean>('is_flatpak');
|
||||||
const xdgDataDir = await dataDir();
|
const xdgDataDir = await dataDir();
|
||||||
const command = isFlatpak
|
const command = isFlatpak
|
||||||
? Command.create('sh', ['-c', `${xdgDataDir}/pip/bin/yt-dlp ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`])
|
? Command.create('sh', ['-c', `${xdgDataDir}/yt-dlp/yt-dlp ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`])
|
||||||
: Command.sidecar('binaries/yt-dlp', args);
|
: Command.sidecar('binaries/yt-dlp', args);
|
||||||
|
|
||||||
let jsonOutput = '';
|
let jsonOutput = '';
|
||||||
@@ -573,7 +573,7 @@ export default function useDownloader() {
|
|||||||
const isFlatpak = await invoke<boolean>('is_flatpak');
|
const isFlatpak = await invoke<boolean>('is_flatpak');
|
||||||
const xdgDataDir = await dataDir();
|
const xdgDataDir = await dataDir();
|
||||||
const command = isFlatpak
|
const command = isFlatpak
|
||||||
? Command.create('sh', ['-c', `${xdgDataDir}/pip/bin/yt-dlp ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`])
|
? Command.create('sh', ['-c', `${xdgDataDir}/yt-dlp/yt-dlp ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`])
|
||||||
: Command.sidecar('binaries/yt-dlp', args);
|
: Command.sidecar('binaries/yt-dlp', args);
|
||||||
|
|
||||||
command.on('close', async (data) => {
|
command.on('close', async (data) => {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export function useLinuxRegisterer() {
|
|||||||
// { source: 'firefox.json', destination: '.mozilla/native-messaging-hosts/com.neosubhamoy.neodlp.json', dir: '.mozilla/native-messaging-hosts/', content: JSON.stringify(flatpakFirefoxManifestContent) },
|
// { source: 'firefox.json', destination: '.mozilla/native-messaging-hosts/com.neosubhamoy.neodlp.json', dir: '.mozilla/native-messaging-hosts/', content: JSON.stringify(flatpakFirefoxManifestContent) },
|
||||||
// { source: 'neodlp-msghost', destination: '.local/bin/neodlp-msghost', dir: '.local/bin/' },
|
// { source: 'neodlp-msghost', destination: '.local/bin/neodlp-msghost', dir: '.local/bin/' },
|
||||||
|
|
||||||
|
{ source: 'yt-dlp', destination: '.var/app/com.neosubhamoy.neodlp/data/yt-dlp/yt-dlp', dir: '.var/app/com.neosubhamoy.neodlp/data/yt-dlp/' },
|
||||||
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
|
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
|
||||||
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
|
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
|
||||||
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
|
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
|
||||||
|
|||||||
@@ -23,9 +23,10 @@ export function useYtDlpUpdater() {
|
|||||||
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
|
const command = currentPlatform === 'linux' && isFlatpak
|
||||||
? ytDlpUpdateChannel === 'nightly'
|
// ? ytDlpUpdateChannel === 'nightly'
|
||||||
? Command.create('sh', ['-c', `PYTHONUSERBASE=${xdgDataDir}/pip python3 -m pip install --user --upgrade --pre "yt-dlp[default,curl-cffi]"`])
|
// ? Command.create('sh', ['-c', `PYTHONUSERBASE=${xdgDataDir}/pip python3 -m pip install --user --upgrade --pre "yt-dlp[default,curl-cffi]"`])
|
||||||
: Command.create('sh', ['-c', `PYTHONUSERBASE=${xdgDataDir}/pip python3 -m pip install --user --upgrade "yt-dlp[default,curl-cffi]"`])
|
// : Command.create('sh', ['-c', `PYTHONUSERBASE=${xdgDataDir}/pip python3 -m pip install --user --upgrade "yt-dlp[default,curl-cffi]"`])
|
||||||
|
? Command.create('sh', ['-c', `${xdgDataDir}/yt-dlp/yt-dlp --update-to ${ytDlpUpdateChannel}`])
|
||||||
: currentPlatform === 'linux'
|
: currentPlatform === 'linux'
|
||||||
? Command.create('pkexec', ['yt-dlp', '--update-to', ytDlpUpdateChannel])
|
? Command.create('pkexec', ['yt-dlp', '--update-to', ytDlpUpdateChannel])
|
||||||
: Command.sidecar('binaries/yt-dlp', ['--update-to', ytDlpUpdateChannel]);
|
: Command.sidecar('binaries/yt-dlp', ['--update-to', ytDlpUpdateChannel]);
|
||||||
|
|||||||
Reference in New Issue
Block a user