Management
Anthias’s management is centered around the concept of Assets
, which are the primary units of content displayed by the system. These assets can be images, videos, or webpages. The management system enables scheduling, playback control, and other essential operations for these assets.
Scheduling: Assets can be scheduled to display within specific timeframes defined by
start_date
andend_date
. This allows for dynamic content updates based on time-specific requirements.Example: A promotional video can be set to play between 9am and 5pm every weekday.
Code:
anthias_app/models.py
class Asset(models.Model): # ... other fields ... start_date = models.DateTimeField(blank=True, null=True) end_date = models.DateTimeField(blank=True, null=True) # ...
Playback Control: Assets can be enabled or disabled using the
is_enabled
field. This provides granular control over which assets are currently displayed.Example: A slideshow can be paused by disabling the
is_enabled
flag for each image.Code:
anthias_app/models.py
class Asset(models.Model): # ... other fields ... is_enabled = models.BooleanField(default=False) # ...
Duration: Assets can be configured with a specific
duration
to control how long they are displayed. This allows for precise control over the pace of content rotation.Example: A welcome message can be set to display for 10 seconds.
Code:
anthias_app/models.py
class Asset(models.Model): # ... other fields ... duration = models.BigIntegerField(blank=True, null=True) # ...
Order: The
play_order
field determines the order in which assets are displayed within a schedule.Example: Multiple advertisements can be displayed in a specific sequence.
Code:
anthias_app/models.py
class Asset(models.Model): # ... other fields ... play_order = models.IntegerField(default=0) # ...
Caching: The
nocache
field allows for controlling caching behavior for assets. This can be useful for ensuring the latest versions of dynamic content are displayed.Example: An asset like a webpage can be set to disable caching to ensure that the latest content is displayed.
Code:
anthias_app/models.py
class Asset(models.Model): # ... other fields ... nocache = models.BooleanField(default=False) # ...
Asset Check: The
skip_asset_check
field allows for bypassing the asset check process. This can be useful for specific assets where the check is not required.Example: A local image may not require an asset check.
Code:
anthias_app/models.py
class Asset(models.Model): # ... other fields ... skip_asset_check = models.BooleanField(default=False) # ...
The management system relies on a combination of technologies to ensure smooth operation. Key components include:
- WebSocket (
anthias-websocket
): This component facilitates communication between the NGINX web server and the backend. - Redis (
redis
): Serves as the primary database, cache, and message broker. - SQLite: Used for storing the
assets
data.
The system offers a user-friendly interface accessible through a web browser. This interface provides a comprehensive view of scheduled assets, allowing users to manage and modify the content playback.
Code:
templates/system-info.html
<div class="system-info"> <h2>System Information</h2> <div class="info-block"> <h3>Memory</h3> <p>Total: {{ memory.total }} / Used: {{ memory.used }} / Free: {{ memory.free }} / Shared: {{ memory.shared }} / Buff: {{ memory.buff }} / Available: {{ memory.available }}</p> </div> <div class="info-block"> <h3>Uptime</h3> <p>{{ uptime.days }} days and {{ uptime.hours }} hours</p> </div> </div>
Important: This is a simplified overview of the management system in Anthias. For more detailed information, please refer to the code repository.
Top-Level Directory Explanations
.github/ - This directory contains GitHub-specific configuration files and workflows for the project.
.github/workflows/ - This directory contains YAML files defining continuous integration and deployment workflows for GitHub Actions.
ansible/ - Ansible is an open-source configuration management and automation tool. This directory contains Ansible playbooks and roles for managing and configuring the project.
ansible/roles/ - This directory contains Ansible roles, which are reusable collections of tasks and configurations for managing specific aspects of a system.
ansible/roles/network/ - This role manages network configurations.
ansible/roles/screenly/ - This role is specific to the Screenly project and likely contains configurations and tasks related to it.
ansible/roles/system/ - This role manages system-level configurations.
anthias_app/ - This directory contains the main application codebase for the project, likely written in Django.
anthias_app/migrations/ - This directory contains database migration files for the Django application.
anthias_django/ - This directory may contain additional Django-specific configuration files and code.
api/ - This directory contains the API codebase for the project.
api/serializers/ - This directory contains Django REST Framework serializers for converting data between Python objects and JSON.
api/views/ - This directory contains Django views for handling HTTP requests and rendering responses.
bin/ - This directory contains executable scripts for the project.
lib/ - This directory contains reusable Python modules and libraries for the project.
static/ - This directory contains static files, such as images, CSS, and JavaScript, that are served directly to the user by the web server.
static/js/ - This directory contains JavaScript files.
static/spec/ - This directory contains test files for the static files.
static/spec/jasmine/ - This directory contains Jasmine test files.
templates/ - This directory contains HTML templates used to render dynamic content.
tests/ - This directory contains test files for the project.
tools/ - This directory contains tools and scripts used to develop and maintain the project.
tools/image_builder/ - This tool likely builds and optimizes images for the project.
website/ - This directory contains the website codebase.
website/assets/ - This directory contains website assets, such as images, CSS, and JavaScript.
website/assets/styles/ - This directory contains website styles.