Merge 0b3af35123
into e0f1828d9c
This commit is contained in:
commit
d3b1d18ef6
|
@ -10,7 +10,7 @@ from api.src.aggs import (
|
|||
WatchProgress,
|
||||
)
|
||||
from api.src.search_processor import SearchProcess
|
||||
from home.src.download.queue import PendingInteract
|
||||
from home.src.download.queue import PendingInteract, PendingList
|
||||
from home.src.download.subscriptions import (
|
||||
ChannelSubscription,
|
||||
PlaylistSubscription,
|
||||
|
@ -680,15 +680,25 @@ class DownloadApiListView(ApiBaseView):
|
|||
return Response({"message": message}, status=400)
|
||||
|
||||
pending = [i["youtube_id"] for i in to_add if i["status"] == "pending"]
|
||||
url_str = " ".join(pending)
|
||||
try:
|
||||
youtube_ids = Parser(url_str).parse()
|
||||
except ValueError:
|
||||
message = f"failed to parse: {url_str}"
|
||||
print(message)
|
||||
return Response({"message": message}, status=400)
|
||||
if pending:
|
||||
url_str = " ".join(pending)
|
||||
try:
|
||||
youtube_ids = Parser(url_str).parse()
|
||||
except ValueError:
|
||||
message = f"failed to parse: {url_str}"
|
||||
print(message)
|
||||
return Response({"message": message}, status=400)
|
||||
extrac_dl.delay(youtube_ids, auto_start=auto_start)
|
||||
|
||||
extrac_dl.delay(youtube_ids, auto_start=auto_start)
|
||||
ignore = [
|
||||
{"type": "video", "url": i["youtube_id"]}
|
||||
for i in to_add
|
||||
if i["status"] == "ignore"
|
||||
]
|
||||
if ignore:
|
||||
pending = PendingList(youtube_ids=ignore)
|
||||
pending.parse_url_list()
|
||||
pending.add_to_pending(status="ignore")
|
||||
|
||||
return Response(data)
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
{% if request.user|has_group:"admin" or request.user.is_staff %}
|
||||
<button onclick="deleteConfirm()" id="delete-item">Delete Video</button>
|
||||
<div class="delete-confirm" id="delete-button">
|
||||
<span>Are you sure? </span><button class="danger-button" onclick="deleteVideo(this)" data-id="{{ video.youtube_id }}" data-redirect = "{{ video.channel.channel_id }}">Delete</button> <button onclick="cancelDelete()">Cancel</button>
|
||||
<span>Are you sure? </span><button class="danger-button" onclick="deleteVideo(this)" data-id="{{ video.youtube_id }}" data-redirect = "{{ video.channel.channel_id }}">Delete</button> <button class="danger-button" onclick="deleteAndIgnoreVideo(this)" data-id="{{ video.youtube_id }}" data-redirect = "{{ video.channel.channel_id }}">Delete and Ignore</button> <button onclick="cancelDelete()">Cancel</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button id="{{ video.youtube_id }}-button" data-id="{{ video.youtube_id }}" data-context="video" onclick="showAddToPlaylistMenu(this)">Add To Playlist</button>
|
||||
|
|
|
@ -512,6 +512,19 @@ function deleteVideo(button) {
|
|||
}, 1000);
|
||||
}
|
||||
|
||||
function deleteAndIgnoreVideo(button) {
|
||||
let to_delete = button.getAttribute('data-id');
|
||||
let to_redirect = button.getAttribute('data-redirect');
|
||||
let endpointDelete = '/api/video/' + to_delete + '/';
|
||||
apiRequest(endpointDelete, 'DELETE');
|
||||
let endpointDownload = '/api/download/';
|
||||
apiRequest(endpointDownload, 'POST', { data: [{ youtube_id: to_delete, status: 'ignore' }] });
|
||||
setTimeout(function () {
|
||||
let redirect = '/channel/' + to_redirect;
|
||||
window.location.replace(redirect);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function deleteChannel(button) {
|
||||
let to_delete = button.getAttribute('data-id');
|
||||
let apiEndpoint = '/api/channel/' + to_delete + '/';
|
||||
|
|
Loading…
Reference in New Issue