Adds CEC support and minor dependency refactoring

This commit is contained in:
Viktor Petersson
2021-01-08 11:55:05 +00:00
parent 89a00ddfd6
commit 5ee4e2d40a
6 changed files with 24 additions and 21 deletions

View File

@@ -9,6 +9,7 @@ RUN apt-get update && \
git \
git-core \
ifupdown \
libcec-dev \
libffi-dev \
libraspberrypi0 \
libssl-dev \

View File

@@ -3,6 +3,7 @@
import netifaces
import os
import sh
import cec
import socket
import sqlite3
import re
@@ -13,6 +14,8 @@ from uptime import uptime
from datetime import datetime
cec.init()
def parse_cpu_info():
cpu_info = {
'cpu_count': 0
@@ -63,16 +66,15 @@ def get_monitor_status():
def get_display_power():
"""
Queries the TV using CEC
"""
tv = cec.Device(cec.CECDEVICE_TV)
try:
display_status = sh.vcgencmd('display_power').stdout.strip().split('=')
if display_status[1] == '1':
return 'On'
elif display_status[1] == '0':
return 'Off'
else:
return 'Unknown'
except Exception:
return 'Unable to determine display power.'
tv_status = tv.is_on()
except IOError:
return 'Unknown'
return tv_status
def get_network_interfaces():

View File

@@ -1,2 +1,3 @@
ansible==2.8.8
docker==4.3.1
docker-compose==1.26.2

View File

@@ -1,30 +1,30 @@
ansible==2.8.8
Flask-Cors==3.0.9
Flask==1.1.2
Jinja2==2.11.2
Mako==1.1.3
MarkupSafe==1.1.1
Werkzeug==1.0.1
cec==0.2.7
celery==4.4.7
certifi==2020.6.20
cffi==1.14.3
click==7.1.2
configparser==4.0.2
cryptography==3.2.1
docker-py==1.10.6
Flask-Cors==3.0.9
flask-restful-swagger-2==0.35
flask-swagger-ui==3.36.0
Flask==1.1.2
futures==3.3.0
gevent-websocket==0.10.1
gevent==20.9.0
gunicorn==19.10.0
hurry.filesize==0.9
Jinja2==2.11.2
kombu==4.6.11
Mako==1.1.3
MarkupSafe==1.1.1
mixpanel==4.7.0
netifaces==0.10.9
psutil==5.7.3
pyOpenSSL==19.1.0
pyasn1==0.4.8
pydbus==0.6.0
pyOpenSSL==19.1.0
python-dateutil==2.8.1
pytz==2020.1
pyzmq==19.0.2
@@ -35,5 +35,4 @@ six==1.15.0
uptime==3.0.1
urllib3==1.25.11
vine==1.3.0
Werkzeug==1.0.1
youtube_dl>=2020.9.20

View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
__author__ = "Screenly, Inc"
__copyright__ = "Copyright 2012-2020, Screenly, Inc"
__copyright__ = "Copyright 2012-2021, Screenly, Inc"
__license__ = "Dual License: GPLv2 and Commercial License"
import json

View File

@@ -44,7 +44,7 @@
<td>{{ context.display_info }}</td>
</tr>
<tr>
<th scope="row">Display Power</th>
<th scope="row">Display Power (CEC)</th>
<td>{{ context.display_power }}</td>
</tr>
<tr>
@@ -52,7 +52,7 @@
<td>{{ context.raspberry_model }}</td>
</tr>
<tr>
<th scope="row">Screenly Version</th>
<th scope="row">Screenly OSE Version</th>
<td>{{ context.screenly_version }}</td>
</tr>
<tr>