multi-downloads are now fully working

This commit is contained in:
ArabCoders 2024-04-06 00:45:45 +03:00
parent 476d369bd1
commit e7af9ba972
5 changed files with 45 additions and 17 deletions

View file

@ -54,7 +54,9 @@ COPY --chown=app:app ./healthcheck.sh /usr/local/bin/healthcheck
ENV PATH="/opt/python/bin:$PATH" ENV PATH="/opt/python/bin:$PATH"
RUN chown -R app:app /config /downloads && chmod +x /usr/local/bin/healthcheck RUN chown -R app:app /config /downloads && chmod +x /usr/local/bin/healthcheck && \
sed -i 's$#!\/app\/\.venv\/bin\/python$#!/opt/python/bin/python$' /opt/python/bin/* && \
sed -i "s%'\/app\/\.venv'%'/opt/python'%" /opt/python/bin/activate*
VOLUME /config VOLUME /config
VOLUME /downloads VOLUME /downloads

View file

@ -15,7 +15,7 @@ YTPTube started as a fork of [meTube](https://github.com/alexta69/metube), Since
* Support per link, `yt-dlp config` and `cookies`. and `output format`. * Support per link, `yt-dlp config` and `cookies`. and `output format`.
* Tasks Runner. It allow you to queue channels for downloading using simple `json` file. * Tasks Runner. It allow you to queue channels for downloading using simple `json` file.
* Webhook sender. It allow you to add webhook endpoints that receive events related to downloads using simple `json` file. * Webhook sender. It allow you to add webhook endpoints that receive events related to downloads using simple `json` file.
* **Experimental** Multi-downloads support. * Multi-downloads support.
### Tips ### Tips
Your `yt-dlp` config should include the following options for optimal working conditions. Your `yt-dlp` config should include the following options for optimal working conditions.
@ -94,7 +94,7 @@ location /ytptube/ {
} }
``` ```
Note: the extra `proxy_set_header` directives are there to make WebSocket work. Note: the extra `proxy_set_header` directives are there to make web socket connection work.
### Caddy ### Caddy
@ -122,8 +122,9 @@ Before asking a question or submitting an issue for YTPTube, please remember tha
In order to test with the yt-dlp command directly, you can either download it and run it locally, or for a better simulation of its actual conditions, you can run it within the YTPTube container itself. Assuming your YTPTube container is called `YTPTube`, run the following on your Docker host to get a shell inside the container: In order to test with the yt-dlp command directly, you can either download it and run it locally, or for a better simulation of its actual conditions, you can run it within the YTPTube container itself. Assuming your YTPTube container is called `YTPTube`, run the following on your Docker host to get a shell inside the container:
```bash ```bash
docker exec -ti ytptube sh docker exec -ti ytptube bash
cd /downloads cd /downloads
yt-dlp ....
``` ```
Once there, you can use the yt-dlp command freely. Once there, you can use the yt-dlp command freely.
@ -181,23 +182,23 @@ The `config/ytdlp.json`, is a json file which can be used to alter the default `
"subtitleslangs": [ "en", "ar" ], "subtitleslangs": [ "en", "ar" ],
// postprocessors to run on the file // postprocessors to run on the file
"postprocessors": [ "postprocessors": [
// this processor convert the downloaded thumbnail to JPG. // this processor convert the downloaded thumbnail to jpg.
{ {
"key": "FFmpegThumbnailsConvertor", "key": "FFmpegThumbnailsConvertor",
"format": "jpg" "format": "jpg"
}, },
// This processor convert subtitles to SRT // This processor convert subtitles to srt format.
{ {
"key": "FFmpegSubtitlesConvertor", "key": "FFmpegSubtitlesConvertor",
"format": "srt" "format": "srt"
}, },
// This processor embed metadata & info.json file into the final MKV file. // This processor embed metadata & info.json file into the final mkv file.
{ {
"key": "FFmpegMetadata", "key": "FFmpegMetadata",
"add_infojson": true, "add_infojson": true,
"add_metadata": true "add_metadata": true
}, },
// This process embed subtitles into the final file if it doesn't subtitles embedded. // This process embed subtitles into the final file if it doesn't have subtitles embedded.
{ {
"key": "FFmpegEmbedSubtitle", "key": "FFmpegEmbedSubtitle",
"already_have_subtitle": false "already_have_subtitle": false

View file

@ -3,6 +3,7 @@ import logging
import os import os
import re import re
import sys import sys
import time
import coloredlogs import coloredlogs
from version import APP_VERSION from version import APP_VERSION
from dotenv import load_dotenv from dotenv import load_dotenv
@ -50,10 +51,12 @@ class Config:
socket_timeout: int = 30 socket_timeout: int = 30
started: int = 0
ytdlp_version: str = YTDLP_VERSION ytdlp_version: str = YTDLP_VERSION
_int_vars: tuple = ('port', 'max_workers', 'socket_timeout', 'extract_info_timeout',) _int_vars: tuple = ('port', 'max_workers', 'socket_timeout', 'extract_info_timeout',)
_immutable: tuple = ('version', '__instance', 'ytdl_options', 'new_version_available', 'ytdlp_version',) _immutable: tuple = ('version', '__instance', 'ytdl_options', 'new_version_available', 'ytdlp_version', 'started')
_boolean_vars: tuple = ('keep_archive', 'ytdl_debug', 'debug', 'temp_keep', 'allow_manifestless',) _boolean_vars: tuple = ('keep_archive', 'ytdl_debug', 'debug', 'temp_keep', 'allow_manifestless',)
@staticmethod @staticmethod
@ -165,6 +168,8 @@ class Config:
LOG.info(f'Keep temp: {self.temp_keep}') LOG.info(f'Keep temp: {self.temp_keep}')
self.started = time.time()
def _getAttributes(self) -> dict: def _getAttributes(self) -> dict:
attrs: dict = {} attrs: dict = {}
vClass: str = self.__class__ vClass: str = self.__class__

View file

@ -15,8 +15,8 @@
</div> </div>
<button class="modal-close is-large" aria-label="close" @click="video_link = ''"></button> <button class="modal-close is-large" aria-label="close" @click="video_link = ''"></button>
</div> </div>
<PageFooter :app_version="config?.app?.version || 'unknown'" <PageFooter :app_version="config?.app?.version || 'unknown'" :ytdlp_version="config?.app.ytdlp_version || 'unknown'"
:ytdlp_version="config?.app.ytdlp_version || 'unknown'" /> :started="config?.app.started || 0" />
</template> </template>
<script setup> <script setup>

View file

@ -1,16 +1,32 @@
<style>
.user-hint {
user-select: none;
cursor: help;
border-bottom: 1px dotted;
}
</style>
<template> <template>
<div class="columns is-multiline mt-3"> <div class="columns mt-3 is-mobile">
<div class="column has-text-left"> <div class="column is-8-mobile">
© {{ Year }} - <a href="https://github.com/ArabCoders/ytptube" target="_blank">YTPTube</a>@{{ app_version }} <div class="has-text-left" v-if="app_version">
<span class="is-hidden-mobile"> © {{ Year }} - <a v-tooltip="'App Version: ' + app_version" href="https://github.com/ArabCoders/ytptube"
- <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a>@{{ ytdlp_version }} target="_blank">YTPTube</a>
</span> - <a v-tooltip="'yt-dlp Version: ' + ytdlp_version" href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a>
</div>
</div>
<div class="column is-4-mobile" v-if="started > 1">
<div class="has-text-right">
<span class="user-hint" v-tooltip="'App Started: ' + moment.unix(started).format('YYYY-M-DD H:mm Z')">
{{ moment.unix(started).fromNow() }}
</span>
</div>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { defineProps } from 'vue' import { defineProps } from 'vue'
import moment from "moment";
const Year = new Date().getFullYear() const Year = new Date().getFullYear()
@ -23,6 +39,10 @@ defineProps({
type: String, type: String,
required: true, required: true,
}, },
started: {
type: Number,
required: true,
},
}) })
</script> </script>