Merge pull request #161 from arabcoders/dev
Fix download audio only preset
This commit is contained in:
commit
fa2fd2970a
6 changed files with 40 additions and 17 deletions
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
|
|
@ -30,17 +30,17 @@
|
||||||
"console": "internalConsole",
|
"console": "internalConsole",
|
||||||
"justMyCode": true,
|
"justMyCode": true,
|
||||||
"env": {
|
"env": {
|
||||||
"PYDEVD_DISABLE_FILE_VALIDATION": "1",
|
|
||||||
"YTP_CONFIG_PATH": "${workspaceFolder}/var/config",
|
"YTP_CONFIG_PATH": "${workspaceFolder}/var/config",
|
||||||
"YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads",
|
"YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads",
|
||||||
"YTP_TEMP_PATH": "${workspaceFolder}/var/tmp",
|
"YTP_TEMP_PATH": "${workspaceFolder}/var/tmp",
|
||||||
|
"PYDEVD_DISABLE_FILE_VALIDATION": "1",
|
||||||
"YTP_URL_HOST": "http://localhost:8081",
|
"YTP_URL_HOST": "http://localhost:8081",
|
||||||
"YTP_LOG_LEVEL": "DEBUG",
|
|
||||||
"YTP_DEBUG": "true",
|
|
||||||
"YTP_YTDL_DEBUG": "true",
|
|
||||||
"YTP_MAX_WORKERS": "2",
|
"YTP_MAX_WORKERS": "2",
|
||||||
"YTP_IGNORE_UI": "true",
|
"YTP_IGNORE_UI": "true",
|
||||||
"YTP_PIP_IGNORE_UPDATES": "true",
|
"YTP_PIP_IGNORE_UPDATES": "true",
|
||||||
|
"YTP_LOG_LEVEL": "DEBUG",
|
||||||
|
"YTP_DEBUG": "true",
|
||||||
|
"YTP_YTDL_DEBUG": "true",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,8 @@ class Download:
|
||||||
f'Downloading pid: {os.getpid()} id="{self.info.id}" title="{self.info.title}" preset="{self.preset}".'
|
f'Downloading pid: {os.getpid()} id="{self.info.id}" title="{self.info.title}" preset="{self.preset}".'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
LOG.debug(f"Params before passing to yt-dlp: {params}")
|
||||||
|
|
||||||
cls = yt_dlp.YoutubeDL(params=params)
|
cls = yt_dlp.YoutubeDL(params=params)
|
||||||
|
|
||||||
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
|
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from .DataStore import DataStore
|
||||||
from .Download import Download
|
from .Download import Download
|
||||||
from .Emitter import Emitter
|
from .Emitter import Emitter
|
||||||
from .ItemDTO import ItemDTO
|
from .ItemDTO import ItemDTO
|
||||||
from .Utils import ExtractInfo, calcDownloadPath, isDownloaded, mergeConfig
|
from .Utils import ExtractInfo, get_opts, calcDownloadPath, isDownloaded, mergeConfig
|
||||||
|
|
||||||
LOG = logging.getLogger("DownloadQueue")
|
LOG = logging.getLogger("DownloadQueue")
|
||||||
TYPE_DONE: str = "done"
|
TYPE_DONE: str = "done"
|
||||||
|
|
@ -264,7 +264,7 @@ class DownloadQueue:
|
||||||
fut=asyncio.get_running_loop().run_in_executor(
|
fut=asyncio.get_running_loop().run_in_executor(
|
||||||
None,
|
None,
|
||||||
ExtractInfo,
|
ExtractInfo,
|
||||||
mergeConfig(self.config.ytdl_options, ytdlp_config),
|
get_opts(preset, mergeConfig(self.config.ytdl_options, ytdlp_config)),
|
||||||
url,
|
url,
|
||||||
bool(self.config.ytdl_debug),
|
bool(self.config.ytdl_debug),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -122,13 +122,16 @@ def ExtractInfo(config: dict, url: str, debug: bool = False) -> dict:
|
||||||
**config,
|
**config,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove keys that are not needed for info extraction as those keys generate files when used with extract_info.
|
# Remove keys that are not needed for info extraction.
|
||||||
for key in (
|
keys: list = [
|
||||||
"writeinfojson",
|
"writeinfojson",
|
||||||
"writethumbnail",
|
"writethumbnail",
|
||||||
"writedescription",
|
"writedescription",
|
||||||
"writeautomaticsub",
|
"writeautomaticsub",
|
||||||
):
|
"postprocessors",
|
||||||
|
]
|
||||||
|
|
||||||
|
for key in keys:
|
||||||
if key in params:
|
if key in params:
|
||||||
params.pop(key)
|
params.pop(key)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,13 @@ class FFStream:
|
||||||
"""
|
"""
|
||||||
Is the stream labelled as a video stream.
|
Is the stream labelled as a video stream.
|
||||||
"""
|
"""
|
||||||
return self.__dict__.get("codec_type", None) == "video"
|
if self.__dict__.get("codec_type", None) != "video":
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.__dict__.get("codec_name", None) in ["png", "mjpeg", "gif", "bmp", "tiff", "webp"]:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def is_subtitle(self):
|
def is_subtitle(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<video ref="video" :poster="previewImageLink" :controls="isControls" :title="title" playsinline>
|
<video ref="video" :data-poster="thumbnail" :controls="isControls" :title="title" playsinline>
|
||||||
<source :src="link" type="application/x-mpegURL" />
|
<source :src="link" type="application/x-mpegURL" />
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -31,10 +31,6 @@ import Plyr from 'plyr'
|
||||||
import 'plyr/dist/plyr.css'
|
import 'plyr/dist/plyr.css'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
previewImageLink: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
link: {
|
link: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
|
@ -109,7 +105,7 @@ const prepareVideoPlayer = () => {
|
||||||
mediaMetadata['artist'] = props.artist
|
mediaMetadata['artist'] = props.artist
|
||||||
}
|
}
|
||||||
|
|
||||||
player = new Plyr(video.value, {
|
let opts = {
|
||||||
debug: false,
|
debug: false,
|
||||||
clickToPlay: true,
|
clickToPlay: true,
|
||||||
keyboard: { focused: true, global: true },
|
keyboard: { focused: true, global: true },
|
||||||
|
|
@ -125,12 +121,28 @@ const prepareVideoPlayer = () => {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
key: 'plyr'
|
key: 'plyr'
|
||||||
},
|
},
|
||||||
|
poster: props.thumbnail,
|
||||||
|
artist: props.artist,
|
||||||
title: props.title,
|
title: props.title,
|
||||||
mediaMetadata: mediaMetadata,
|
mediaMetadata: mediaMetadata,
|
||||||
captions: {
|
captions: {
|
||||||
update: true,
|
update: true,
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (props.artist) {
|
||||||
|
opts.artist = props.artist
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.title) {
|
||||||
|
opts.title = props.title
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.thumbnail) {
|
||||||
|
opts.poster = props.thumbnail
|
||||||
|
}
|
||||||
|
|
||||||
|
player = new Plyr(video.value, opts);
|
||||||
|
|
||||||
hls = new Hls({
|
hls = new Hls({
|
||||||
debug: false,
|
debug: false,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue