updated logs and players page
This commit is contained in:
@@ -5,7 +5,7 @@ from werkzeug.utils import secure_filename
|
||||
from pdf2image import convert_from_path
|
||||
from extensions import db
|
||||
from models import Content, Player, Group
|
||||
from utils.logger import log_upload, log_process
|
||||
from utils.logger import log_content_added, log_upload, log_process
|
||||
|
||||
# Function to add image to playlist
|
||||
def add_image_to_playlist(app, file, filename, duration, target_type, target_id):
|
||||
@@ -24,19 +24,16 @@ def add_image_to_playlist(app, file, filename, duration, target_type, target_id)
|
||||
for player in group.players:
|
||||
new_content = Content(file_name=filename, duration=duration, player_id=player.id)
|
||||
db.session.add(new_content)
|
||||
player.playlist_version += 1
|
||||
group.playlist_version += 1
|
||||
# Log the action
|
||||
log_upload('image', filename, 'group', group.name)
|
||||
log_content_added(filename, target_type, group.name)
|
||||
elif target_type == 'player':
|
||||
player = Player.query.get_or_404(target_id)
|
||||
new_content = Content(file_name=filename, duration=duration, player_id=target_id)
|
||||
db.session.add(new_content)
|
||||
player.playlist_version += 1
|
||||
# Log the action
|
||||
log_upload('image', filename, 'player', player.username)
|
||||
log_content_added(filename, target_type, player.username)
|
||||
|
||||
db.session.commit()
|
||||
log_upload('image', filename, target_type, target_id)
|
||||
return True
|
||||
|
||||
# Video conversion functions
|
||||
def convert_video(input_file, output_folder):
|
||||
|
||||
Reference in New Issue
Block a user