You've already forked amazing-ytdlp-archive
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
38f6f04260 |
@@ -26,6 +26,7 @@ def create_app(test_config=None):
|
|||||||
config['CELERY']['beat_schedule'] = {}
|
config['CELERY']['beat_schedule'] = {}
|
||||||
config['CELERY']['beat_schedule']['Renew WebSub endpoints'] = {'task': 'ayta.tasks.websub_renew_expiring', 'schedule': 4000}
|
config['CELERY']['beat_schedule']['Renew WebSub endpoints'] = {'task': 'ayta.tasks.websub_renew_expiring', 'schedule': 4000}
|
||||||
config['CELERY']['beat_schedule']['Process WebSub data'] = {'task': 'ayta.tasks.websub_process_data', 'schedule': 100}
|
config['CELERY']['beat_schedule']['Process WebSub data'] = {'task': 'ayta.tasks.websub_process_data', 'schedule': 100}
|
||||||
|
config['CELERY']['beat_schedule']['Queue up new videos in static channel playlists'] = {'task': 'ayta.tasks.playlist_to_queue', 'schedule': 5000}
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_mapping(config)
|
app.config.from_mapping(config)
|
||||||
|
@@ -2,7 +2,7 @@ from flask import Blueprint, render_template, request, redirect, url_for, flash,
|
|||||||
from ..nosql import get_nosql
|
from ..nosql import get_nosql
|
||||||
from ..dlp import checkChannelId, getChannelInfo
|
from ..dlp import checkChannelId, getChannelInfo
|
||||||
from ..decorators import login_required
|
from ..decorators import login_required
|
||||||
from ..tasks import test_sleep, websub_subscribe_callback, websub_unsubscribe_callback, video_download, video_queue
|
from ..tasks import test_sleep, websub_subscribe_callback, websub_unsubscribe_callback, video_download, video_queue, playlist_to_queue
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from secrets import token_urlsafe
|
from secrets import token_urlsafe
|
||||||
|
|
||||||
@@ -30,6 +30,9 @@ def channels():
|
|||||||
generic = {}
|
generic = {}
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
task = request.form.get('task', None)
|
||||||
|
|
||||||
|
if task == 'subscribe-websub':
|
||||||
channelId = request.form.get('channel_id', None)
|
channelId = request.form.get('channel_id', None)
|
||||||
originalName = request.form.get('original_name', None)
|
originalName = request.form.get('original_name', None)
|
||||||
addedDate = request.form.get('added_date', None)
|
addedDate = request.form.get('added_date', None)
|
||||||
@@ -47,6 +50,10 @@ def channels():
|
|||||||
|
|
||||||
return redirect(url_for('admin.channel', channelId=channelId))
|
return redirect(url_for('admin.channel', channelId=channelId))
|
||||||
|
|
||||||
|
elif task == 'playlist-queue':
|
||||||
|
task = playlist_to_queue.delay()
|
||||||
|
flash(f'Task playlist-queue has been queued: {task.id}')
|
||||||
|
|
||||||
generic['currentDate'] = datetime.utcnow()
|
generic['currentDate'] = datetime.utcnow()
|
||||||
channelIds = get_nosql().list_all_channels()
|
channelIds = get_nosql().list_all_channels()
|
||||||
|
|
||||||
|
@@ -164,6 +164,19 @@ def websub_renew_expiring(hours=6):
|
|||||||
if count >= 256:
|
if count >= 256:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@shared_task()
|
||||||
|
def playlist_to_queue(hours=6):
|
||||||
|
from .nosql import get_nosql
|
||||||
|
|
||||||
|
channels = get_nosql().list_all_channels(active=True)
|
||||||
|
|
||||||
|
for channel in channels:
|
||||||
|
info = get_nosql().get_channel_info()
|
||||||
|
|
||||||
|
for item in info['playlist']['entries']:
|
||||||
|
videoId = item['id']
|
||||||
|
get_nosql().queue_insertQueue(videoId, 'Playlist mirroring')
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# TASK MODULES #
|
# TASK MODULES #
|
||||||
##########################################
|
##########################################
|
||||||
|
@@ -15,6 +15,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col s12 l4 m-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-content">
|
||||||
|
<span class="card-title">Direct actions</span>
|
||||||
|
<form class="mt-4" method="post">
|
||||||
|
<button class="btn mb-2 green" type="submit" name="task" value="playlist-queue">Playlist to Queue</button>
|
||||||
|
<br>
|
||||||
|
<span class="supporting-text">Forcerun playlist to queue task</span>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col s12 l4 m-4">
|
<div class="col s12 l4 m-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
@@ -38,7 +50,7 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn mt-4" type="submit" name="action" value="add_channel">Add</button>
|
<button class="btn mt-4" type="submit" name="task" value="add_channel">Add</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
<div class="col s12 m-4">
|
<div class="col s12 m-4">
|
||||||
<h5>Reserved tasks per worker</h5>
|
<h5>Reserved tasks per worker</h5>
|
||||||
<p>Usually 4 tasks per worker</p>
|
<p>Usually 4 tasks per worker</p>
|
||||||
|
{% if reserved is none %}
|
||||||
|
<h6>No workers with reserved tasks, are there any workers with stuck tasks or are they even online?</h6>
|
||||||
|
{% else %}
|
||||||
{% for worker in reserved %}
|
{% for worker in reserved %}
|
||||||
<span>{{ worker }}</span>
|
<span>{{ worker }}</span>
|
||||||
<table class="striped highlight responsive-table" style=" border: 1px solid black;">
|
<table class="striped highlight responsive-table" style=" border: 1px solid black;">
|
||||||
@@ -43,9 +46,13 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col s12 m-4">
|
<div class="col s12 m-4">
|
||||||
<h5>Current workers and processing tasks</h5>
|
<h5>Current workers and processing tasks</h5>
|
||||||
|
{% if tasks is none %}
|
||||||
|
<h6>No workers with running tasks, are there any workers with stuck tasks or are they even online?</h6>
|
||||||
|
{% else %}
|
||||||
{% for worker in tasks %}
|
{% for worker in tasks %}
|
||||||
<span>{{ worker }}</span>
|
<span>{{ worker }}</span>
|
||||||
<table class="striped highlight responsive-table" style=" border: 1px solid black;">
|
<table class="striped highlight responsive-table" style=" border: 1px solid black;">
|
||||||
@@ -67,6 +74,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
@@ -3,6 +3,8 @@
|
|||||||
flask
|
flask
|
||||||
flask-caching
|
flask-caching
|
||||||
flask-limiter
|
flask-limiter
|
||||||
|
flask-sqlalchemy
|
||||||
|
flask-migrate
|
||||||
pymongo
|
pymongo
|
||||||
yt-dlp
|
yt-dlp
|
||||||
gunicorn
|
gunicorn
|
||||||
|
Reference in New Issue
Block a user