Merge pull request #59 from arabcoders/dev

README update
This commit is contained in:
Abdulmohsen 2024-01-11 19:14:53 +03:00 committed by GitHub
commit 3acf910b72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 8 deletions

3
.vscode/launch.json vendored
View file

@ -26,8 +26,7 @@
"type": "python",
"request": "launch",
"program": "app/main.py",
"console": "integratedTerminal",
"justMyCode": true,
"console": "internalConsole",
"env": {
"YTP_CONFIG_PATH": "${workspaceFolder}/var/config",
"YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads",

View file

@ -65,10 +65,10 @@ Certain values can be set via environment variables, using the `-e` parameter on
* __YTP_CONFIG_PATH__: path to where the queue persistence files will be saved. Defaults to `/config` in the docker image, and `./var/config` otherwise.
* __YTP_DOWNLOAD_PATH__: path to where the downloads will be saved. Defaults to `/downloads` in the docker image, and `./var/downloads` otherwise.
* __YTP_TEMP_PATH__: path where intermediary download files will be saved. Defaults to `/tmp` in the docker image, and `./var/tmp` otherwise.
* __YTP_TEMP_KEEP__: Whether to keep the Individual video temp directory or remove it. Useful for live streams that don't keep archive. Defaults to `false`.
* __YTP_TEMP_KEEP__: Whether to keep the Individual video temp directory or remove it. Defaults to `false`.
* __YTP_URL_PREFIX__: base path for the web server (for use when hosting behind a reverse proxy). Defaults to `/`.
* __YTP_OUTPUT_TEMPLATE__: the template for the filenames of the downloaded videos, formatted according to [this spec](https://github.com/yt-dlp/yt-dlp/blob/master/README.md#output-template). Defaults to `%(title)s.%(ext)s`. This will be the default for all downloads unless the request include output template.
* __YTP_KEEP_ARCHIVE__: Whether to keep history of downloaded videos to prevent downloading same file multiple times. Defaults to `false`.
* __YTP_KEEP_ARCHIVE__: Whether to keep history of downloaded videos to prevent downloading same file multiple times. Defaults to `true`.
* __YTP_YTDL_DEBUG__: Whether to turn debug logging for the internal `yt-dlp` package. Defaults to `false`.
* __YTP_ALLOW_MANIFESTLESS__: Allow `yt-dlp` to download live streams videos which are yet to be processed by YouTube. Defaults to `false`
* __YTP_HOST__: Which ip address to bind to. Defaults to `0.0.0.0`.

View file

@ -29,6 +29,7 @@ class Download:
tempPath: str = None
notifier: Notifier = None
canceled: bool = False
is_live: bool = False
_ytdlp_fields: tuple = (
'tmpfilename',
@ -73,6 +74,7 @@ class Download:
config = Config.get_instance()
self.max_workers = int(config.max_workers)
self.tempKeep = bool(config.temp_keep)
self.is_live = bool(info.is_live) or info.live_in is not None
def _progress_hook(self, data: dict):
dicto = {k: v for k, v in data.items() if k in self._ytdlp_fields}
@ -209,7 +211,7 @@ class Download:
if self.tempKeep is True or not self.tempPath:
return
if self.info.status != 'finished' and (self.info.live_in or self.info.is_live):
if self.info.status != 'finished' and self.is_live:
log.warning(
f'Keeping live temp directory: {self.tempPath}, as the reported status is not finished [{self.info.status}].')
return

View file

@ -130,7 +130,7 @@ class DownloadQueue:
output_template=output_template if output_template else self.config.output_template,
datetime=formatdate(time.time()),
error=error,
is_live=entry.get('is_live', None),
is_live=entry.get('is_live', None) or live_in is not None,
live_in=live_in,
)

View file

@ -328,6 +328,10 @@ const clearFailed = () => {
emits('deleteItem', 'completed', keys);
}
const setIcon = (item) => {
if (item.status === 'finished' && item.is_live) {
return 'fa-solid fa-globe';
}
if (item.status === 'finished') {
return 'fa-solid fa-circle-check';
}

View file

@ -6,7 +6,7 @@ import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import {
faCog, faTrash, faLink, faPlus, faTrashCan, faCircleXmark, faCircleCheck, faRotateRight, faDownload, faUpRightFromSquare,
faSpinner, faArrowUp, faArrowDown, faTasks, faCalendar, faArrowUpAZ, faArrowDownAZ, faEject
faSpinner, faArrowUp, faArrowDown, faTasks, faCalendar, faArrowUpAZ, faArrowDownAZ, faEject, faGlobe
} from '@fortawesome/free-solid-svg-icons'
import { faSquare, faSquareCheck } from '@fortawesome/free-regular-svg-icons'
@ -18,7 +18,7 @@ import './assets/css/style.css'
import 'floating-vue/dist/style.css'
library.add(faCog, faTrash, faLink, faPlus, faTrashCan, faCircleXmark, faCircleCheck, faRotateRight, faDownload, faUpRightFromSquare,
faSquare, faSquareCheck, faSpinner, faArrowUp, faArrowDown, faTasks, faCalendar, faArrowUpAZ, faArrowDownAZ, faEject)
faSquare, faSquareCheck, faSpinner, faArrowUp, faArrowDown, faTasks, faCalendar, faArrowUpAZ, faArrowDownAZ, faEject, faGlobe)
const app = createApp(App);
app.config.globalProperties.capitalize = s => s && s[0].toUpperCase() + s.slice(1);