This commit is contained in:
grimhilt 2023-09-02 15:18:54 +02:00
parent fcf906a8da
commit cf06816d9b
4 changed files with 82 additions and 14 deletions

38
README.md Normal file
View File

@ -0,0 +1,38 @@
# Artemio (server)
# Deployment (from source)
- ``git clone https://github.com/grimhilt/artemio-server.git``
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
# Documentation
## API
/api/login
/api/logout
### Playlists (*/api/playlists*)
The user need to be logged in for every routes
| Method | Endpoint | Permission | Description
| --- | --- | --- | --- |
| POST | ``/api/playlists`` | CREATE_PLAYLIST |
| GET | ``/api/playlists`` | |
| GET | ``/api/playlists/:id`` | VIEW_PLAYLIST |
| POST | ``/api/playlists/:id`` | EDIT_PLAYLIST | Add file to playlist
| POST | ``/api/playlists/:id/order`` | EDIT_PLAYLIST | Change file order
| POST | ``/api/playlists/:id/seconds`` | EDIT_PLAYLIST | Change display time of a file
| POST | ``/api/playlists/:id/remove_file`` | EDIT_PLAYLIST |
| PUT | ``/api/playlists/:id/update`` | OWN_PLAYLIST |
| POST | ``/api/playlists/:id/activate`` | ACTIVATE_PLAYLIST |
| POST | ``/api/playlists/:id/disactivate`` | ACTIVATE_PLAYLIST |
### Users
### Roles
###

View File

@ -1,11 +1,11 @@
pandas=2.0.3
requests=2.31.0
tkinter=3.11.4
mpv=1.0.4
Pillow=10.0.0
opencv-python=4.8.0.76
Flask=2.3.3
Flask-SQLAlchemy=3.0.5
Flask-Login=0.6.2
Flask-Cors=4.0.0
imageio=2.31.2
pandas==2.0.3
requests==2.31.0
tkinter==3.11.4
mpv==1.0.4
Pillow==10.0.0
opencv-python==4.8.0.76
Flask==2.3.3
Flask-SQLAlchemy==3.0.5
Flask-Login==0.6.2
Flask-Cors==4.0.0
imageio==2.31.2

View File

@ -1,10 +1,35 @@
from api import create_api
from screen.ScreenManager import ScreenManager
api = create_api()
screen_manager = ScreenManager().getInstance()
#api = create_api()
#screen_manager = ScreenManager().getInstance()
if __name__ == '__main__':
#api.run(host="0.0.0.0", port=5500, debug=True)
api.run(host="0.0.0.0", port=5500)
#api.run(host="0.0.0.0", port=5500)
from screen.SlideShow import SlideShow
import tkinter as tk
import mpv
import imageio
#player = mpv.MPV(ytdl=True)
#player.play("./data/VID_20230403_143809.mp4")
video_file_path = "./data/VID_20230403_143809.mp4"
video = imageio.get_reader(video_file_path, "ffmpeg")
# Get the number of frames and the frame rate
num_frames = len(video)
frame_rate = video.get_meta_data()['fps']
# Calculate the duration in seconds
duration = num_frames / frame_ratek
print(duration)
root = tk.Tk()
root.title("Slideshow")
files = [
{"name": "VID_20230403_143809.mp4", "type":"video/mp4", "seconds":0},
{"name": "egg.jpg", "type":"image/jpg", "seconds":3},
]
#SlideShow(root, files)
root.mainloop()

View File

@ -79,6 +79,11 @@ class VideoPlayer:
self.parent = parent
self.path = './data/' + self.file['name']
self.mpv_instance = mpv.MPV(wid=str(self.parent.canvas.winfo_id()))
print(self.mpv_instance)
player = mpv.MPV(ytdl=True)
player.play('https://youtu.be/DOmdB7D-pUU')
player.wait_for_playback()
player.metadata
self.cap = cv2.VideoCapture(self.path)