API update, #build
Changed: - API: Added Task get view - Added is_locked method for redis lock check - Updaded base and libs
This commit is contained in:
commit
f7f4ca7728
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
# First stage to build python wheel
|
# First stage to build python wheel
|
||||||
FROM python:3.10.4-slim-bullseye AS builder
|
FROM python:3.10.5-slim-bullseye AS builder
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
@ -14,7 +14,7 @@ COPY ./tubearchivist/requirements.txt /requirements.txt
|
||||||
RUN pip install --user -r requirements.txt
|
RUN pip install --user -r requirements.txt
|
||||||
|
|
||||||
# build final image
|
# build final image
|
||||||
FROM python:3.10.4-slim-bullseye as tubearchivist
|
FROM python:3.10.5-slim-bullseye as tubearchivist
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG INSTALL_DEBUG
|
ARG INSTALL_DEBUG
|
||||||
|
|
|
@ -202,6 +202,20 @@ When valid returns message with user id:
|
||||||
```
|
```
|
||||||
|
|
||||||
## Task View
|
## Task View
|
||||||
|
GET /api/task/
|
||||||
|
POST /api/task/
|
||||||
|
|
||||||
|
Check if there is an ongoing task:
|
||||||
|
GET /api/task/
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"rescan": false,
|
||||||
|
"downloading": false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Start a background task
|
Start a background task
|
||||||
POST /api/task/
|
POST /api/task/
|
||||||
```json
|
```json
|
||||||
|
|
|
@ -452,9 +452,20 @@ class LoginApiView(ObtainAuthToken):
|
||||||
|
|
||||||
class TaskApiView(ApiBaseView):
|
class TaskApiView(ApiBaseView):
|
||||||
"""resolves to /api/task/
|
"""resolves to /api/task/
|
||||||
|
GET: check if ongoing background task
|
||||||
POST: start a new background task
|
POST: start a new background task
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get(request):
|
||||||
|
"""handle get request"""
|
||||||
|
|
||||||
|
response = {"rescan": False, "downloading": False}
|
||||||
|
for key in response.keys():
|
||||||
|
response[key] = RedisArchivist().is_locked(key)
|
||||||
|
|
||||||
|
return Response(response)
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
"""handle post request"""
|
"""handle post request"""
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,12 @@ class RedisArchivist(RedisBase):
|
||||||
redis_lock = self.conn.lock(self.NAME_SPACE + lock_key)
|
redis_lock = self.conn.lock(self.NAME_SPACE + lock_key)
|
||||||
return redis_lock
|
return redis_lock
|
||||||
|
|
||||||
|
def is_locked(self, lock_key):
|
||||||
|
"""check if lock is set"""
|
||||||
|
lock_name = self.NAME_SPACE + lock_key
|
||||||
|
lock_status = bool(self.conn.execute_command("GET", lock_name))
|
||||||
|
return lock_status
|
||||||
|
|
||||||
def get_progress(self):
|
def get_progress(self):
|
||||||
"""get a list of all progress messages"""
|
"""get a list of all progress messages"""
|
||||||
all_messages = []
|
all_messages = []
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
beautifulsoup4==4.11.1
|
beautifulsoup4==4.11.1
|
||||||
celery==5.2.7
|
celery==5.2.7
|
||||||
Django==4.0.4
|
Django==4.0.5
|
||||||
django-cors-headers==3.12.0
|
django-cors-headers==3.13.0
|
||||||
djangorestframework==3.13.1
|
djangorestframework==3.13.1
|
||||||
Pillow==9.1.1
|
Pillow==9.1.1
|
||||||
redis==4.3.1
|
redis==4.3.3
|
||||||
requests==2.27.1
|
requests==2.28.0
|
||||||
ryd-client==0.0.3
|
ryd-client==0.0.3
|
||||||
uWSGI==2.0.20
|
uWSGI==2.0.20
|
||||||
whitenoise==6.1.0
|
whitenoise==6.2.0
|
||||||
yt_dlp==2022.5.18
|
yt_dlp==2022.5.18
|
||||||
|
|
Loading…
Reference in New Issue