63 lines
2.4 KiB
Python
Executable File
63 lines
2.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import sys
|
|
import json
|
|
|
|
# Add the signage_player directory to path
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'signage_player'))
|
|
|
|
from get_playlists import (
|
|
send_playlist_check_feedback,
|
|
send_playlist_restart_feedback,
|
|
send_playing_status_feedback
|
|
)
|
|
|
|
def load_config():
|
|
config_path = os.path.join(os.path.dirname(__file__), 'signage_player', 'main_data', 'app_config.txt')
|
|
with open(config_path, 'r') as f:
|
|
return json.load(f)
|
|
|
|
def get_current_playlist_version():
|
|
"""Get the actual current playlist version from the system"""
|
|
playlist_dir = os.path.join(os.path.dirname(__file__), 'signage_player', 'static_data', 'playlist')
|
|
try:
|
|
if os.path.exists(playlist_dir):
|
|
playlist_files = [f for f in os.listdir(playlist_dir) if f.startswith('server_playlist_v') and f.endswith('.json')]
|
|
if playlist_files:
|
|
versions = [int(f.split('_v')[-1].split('.json')[0]) for f in playlist_files]
|
|
return max(versions)
|
|
return 1 # Default version if no files found
|
|
except Exception as e:
|
|
print(f"Error getting playlist version: {e}")
|
|
return 1
|
|
|
|
def test_feedback():
|
|
print("=== Testing Complete Feedback System ===")
|
|
|
|
config = load_config()
|
|
current_version = get_current_playlist_version()
|
|
|
|
print(f"Current actual playlist version: v{current_version}")
|
|
|
|
print("\n1. Server Interrogation Feedback:")
|
|
result1 = send_playlist_check_feedback(config, current_version)
|
|
print(f" Result: {'✓ Success' if result1 else '❌ Failed'}")
|
|
|
|
print("\n2. Playlist Starting Feedback:")
|
|
result2 = send_playing_status_feedback(config, current_version, "intro1.mp4")
|
|
print(f" Result: {'✓ Success' if result2 else '❌ Failed'}")
|
|
|
|
print("\n3. Playlist Working in Loop Feedback:")
|
|
result3 = send_playlist_restart_feedback(config, current_version)
|
|
print(f" Result: {'✓ Success' if result3 else '❌ Failed'}")
|
|
|
|
success_count = sum([result1, result2, result3])
|
|
print(f"\n=== Dynamic Version Feedback ===")
|
|
print(f"✓ Using actual playlist version: v{current_version}")
|
|
print("✓ Version updates automatically when playlist changes")
|
|
print("✓ Server gets real-time version information")
|
|
print(f"\nResults: {success_count}/3 successful")
|
|
|
|
if __name__ == "__main__":
|
|
test_feedback()
|