mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Replacing icon property when icon has been requested.
Creating <APIButton/> which handles success/failure/pending during API calls.
This commit is contained in:
parent
237b429cbf
commit
59c4ab2502
24 changed files with 483 additions and 334 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import asyncio
|
||||
from http import HTTPStatus
|
||||
|
||||
from sanic import response, Request
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ from wrolpi.captions import FFMPEG_BIN
|
|||
from wrolpi.cmd import FFPROBE_BIN
|
||||
from wrolpi.common import logger, get_media_directory
|
||||
from wrolpi.db import get_db_session, get_db_curs
|
||||
from .errors import ChannelNameConflict, ChannelURLConflict, ChannelDirectoryConflict, ChannelSourceIdConflict
|
||||
from wrolpi.vars import DEFAULT_FILE_PERMISSIONS
|
||||
from .errors import ChannelNameConflict, ChannelURLConflict, ChannelDirectoryConflict, ChannelSourceIdConflict
|
||||
from .models import Channel
|
||||
|
||||
logger = logger.getChild(__name__)
|
||||
|
|
@ -80,9 +80,10 @@ def check_for_channel_conflicts(session: Session, id_=None, url=None, name=None,
|
|||
raise ChannelSourceIdConflict()
|
||||
|
||||
# Assure that this Channel's directory is not in another Channel's directory.
|
||||
directory_str = str(directory)
|
||||
directory = f'{directory}/'
|
||||
for channel in session.query(Channel).filter(Channel.id != id_):
|
||||
if directory_str.startswith(str(channel.directory)) or str(channel.directory).startswith(directory_str):
|
||||
channel_directory = f'{channel.directory}/'
|
||||
if directory.startswith(channel_directory) or channel_directory.startswith(directory):
|
||||
raise ChannelDirectoryConflict()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import asyncio
|
||||
from http import HTTPStatus
|
||||
|
||||
from sanic import response, Blueprint
|
||||
|
|
@ -60,7 +61,7 @@ async def search(_: Request, body: schema.VideoSearchRequest):
|
|||
@openapi.response(HTTPStatus.NOT_FOUND, JSONErrorResponse)
|
||||
@wrol_mode_check
|
||||
@run_after(lib.save_channels_config)
|
||||
def video_delete(_: Request, video_ids: str):
|
||||
async def video_delete(_: Request, video_ids: str):
|
||||
try:
|
||||
video_ids = [int(i) for i in str(video_ids).split(',')]
|
||||
except Exception:
|
||||
|
|
@ -69,4 +70,4 @@ def video_delete(_: Request, video_ids: str):
|
|||
lib.delete_videos(*video_ids)
|
||||
|
||||
Events.send_deleted(f'Deleted {len(video_ids)} videos')
|
||||
return response.raw('', HTTPStatus.NO_CONTENT)
|
||||
return response.empty()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue