Skip to content

Commit

Permalink
Adds CEC support and minor dependency refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vpetersson committed Jan 8, 2021
1 parent 89a00dd commit 5ee4e2d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
1 change: 1 addition & 0 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN apt-get update && \
git \
git-core \
ifupdown \
libcec-dev \
libffi-dev \
libraspberrypi0 \
libssl-dev \
Expand Down
20 changes: 11 additions & 9 deletions lib/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import netifaces
import os
import sh
import cec
import socket
import sqlite3
import re
Expand All @@ -13,6 +14,8 @@
from datetime import datetime


cec.init()

def parse_cpu_info():
cpu_info = {
'cpu_count': 0
Expand Down Expand Up @@ -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():
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements.host.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ansible==2.8.8
docker==4.3.1
docker-compose==1.26.2
17 changes: 8 additions & 9 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions templates/system-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ <h5 class="page-header">
<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>
<th scope="row">Raspberry Model</th>
<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>
Expand Down

0 comments on commit 5ee4e2d

Please sign in to comment.