Fix: double video in archive message
This commit is contained in:
parent
01eecbffad
commit
2ae5f7e3c8
2 changed files with 15 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from aiohttp.web import Request, Response
|
from aiohttp.web import Request, Response
|
||||||
|
|
@ -375,15 +375,18 @@ async def items_add(request: Request, queue: DownloadQueue, encoder: Encoder) ->
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return web.json_response(data={"error": str(e), "data": item}, status=web.HTTPBadRequest.status_code)
|
return web.json_response(data={"error": str(e), "data": item}, status=web.HTTPBadRequest.status_code)
|
||||||
|
|
||||||
status: list = await asyncio.wait_for(
|
status: list[dict] = await asyncio.wait_for(
|
||||||
fut=asyncio.gather(*[queue.add(item=item) for item in items]),
|
fut=asyncio.gather(*[queue.add(item=item) for item in items]),
|
||||||
timeout=None,
|
timeout=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
response: list = []
|
response: list[dict[str, Any]] = []
|
||||||
|
|
||||||
for i, item in enumerate(items):
|
for i, item in enumerate(items):
|
||||||
response.append({"item": item, "status": "ok" == status[i].get("status"), "msg": status[i].get("msg")})
|
it = {"item": item, "status": "ok" == status[i].get("status"), "msg": status[i].get("msg")}
|
||||||
|
if status[i].get("hidden"):
|
||||||
|
it["hidden"] = True
|
||||||
|
response.append(it)
|
||||||
|
|
||||||
return web.json_response(data=response, status=web.HTTPOk.status_code, dumps=encoder.encode)
|
return web.json_response(data=response, status=web.HTTPOk.status_code, dumps=encoder.encode)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<span class="icon"><i class="fa-solid fa-link" /></span>
|
<span class="icon"><i class="fa-solid fa-link" /></span>
|
||||||
<span class="has-tooltip" v-tooltip="'Use Shift+Enter to switch to multiline input mode.'">
|
<span class="has-tooltip" v-tooltip="'Use Shift+Enter to switch to multiline input mode.'">
|
||||||
URLs separated by newlines or <span class="is-bold is-lowercase">{{ getSeparatorsName(separator)
|
URLs separated by newlines or <span class="is-bold is-lowercase">{{ getSeparatorsName(separator)
|
||||||
}}</span>
|
}}</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
|
|
@ -474,8 +474,14 @@ const addDownload = async () => {
|
||||||
if (false !== item.status) {
|
if (false !== item.status) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
toast.error(`Error: ${item.msg || 'Failed to add download.'}`)
|
|
||||||
had_errors = true
|
had_errors = true
|
||||||
|
|
||||||
|
if (item?.hidden) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
toast.error(`Error: ${item.msg || 'Failed to add download.'}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (false === had_errors) {
|
if (false === had_errors) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue