From ee3720c59ec6c62e35916fddb9b4dc926160b2dc Mon Sep 17 00:00:00 2001 From: JRK Date: Mon, 26 Aug 2024 12:02:59 +0200 Subject: [PATCH 1/7] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f19685d..51ab3b5 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,13 @@ Add Content Modal: If you value this project, please think about awarding it a ⭐. Thanks ! πŸ™ +## πŸ—ΊοΈ Short-term roadmap +- New `Composition` content type: Check out a [video demo here](https://demo.obscreen.io/data/uploads/compositions.mp4) +- New `Text` Content Type: Display text with customizable styles, including options for scrolling effects. +- New `HTML` Content Type: Display HTML snippets for more powerful text customization, giving you full control over the content. +- Fleet Studio Management: Reviving a legacy feature +- Remote Player Server: An new way to manage a player from the studio without needing SSH access to player + ## πŸ›Ÿ Discussion / Need help ? ### Join our Discord From e5f88d40024d1268aa0b350025bbc4c109141857 Mon Sep 17 00:00:00 2001 From: JRK Date: Mon, 26 Aug 2024 12:07:47 +0200 Subject: [PATCH 2/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 51ab3b5..1882892 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ If you value this project, please think about awarding it a ⭐. Thanks ! πŸ™ - New `Text` Content Type: Display text with customizable styles, including options for scrolling effects. - New `HTML` Content Type: Display HTML snippets for more powerful text customization, giving you full control over the content. - Fleet Studio Management: Reviving a legacy feature -- Remote Player Server: An new way to manage a player from the studio without needing SSH access to player +- Remote Player Server: A new way to manage a player from the studio without needing SSH access to player ## πŸ›Ÿ Discussion / Need help ? From 98dc34358bc3b1bdc21d2733ad6e360319d7ff43 Mon Sep 17 00:00:00 2001 From: jr-k Date: Tue, 27 Aug 2024 00:41:16 +0200 Subject: [PATCH 3/7] add setup py --- .gitignore | 5 ++++- MANIFEST.in | 4 ++++ setup.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 MANIFEST.in create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 04d3dcb..deb3a62 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,7 @@ tmp.py /data/www/plugins/* !/data/www/plugins/.gitkeep /var/run/storage/* -!/var/run/storage/.gitkeep \ No newline at end of file +!/var/run/storage/.gitkeep +*.egg-info +/build/ +/dist/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..e560295 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include README.md +include LICENSE +docs/setup-run-on-rpi.md +docs/setup-run-headless.md diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6b90203 --- /dev/null +++ b/setup.py @@ -0,0 +1,51 @@ +# obscreen +# --------------- +# A fancy self-hosted digital signage tool. Free, simple and working. +# +# Author: jr-k (c) 2024 +# Website: https://github.com/jr-k/obscreen +# License: GPLv2 (see LICENSE file) + +import sys +import logging + +from setuptools import setup, find_packages + +common_dependencies = [ + 'flask==2.3.3', + 'flask-restx==1.3.0', + 'python-dotenv', + 'cron-descriptor', + 'waitress', + 'flask-login', + 'psutil', + 'pysqlite3', +] + +if sys.platform == "win32": + common_dependencies.remove('pysqlite3') + +if sys.platform == "darwin": + common_dependencies.remove('pysqlite3') + +setup( + name='obscreen', + version=open('version.txt').read(), + description='A fancy self-hosted digital signage tool. Free, simple and working.', + long_description=open('README.md').read(), + long_description_content_type='text/markdown', + author='JRK', + author_email='jrk@jierka.com', + url='https://github.com/jr-k/obscreen', + packages=find_packages(), + platforms='any', + classifiers=[ + 'Programming Language :: Python :: 3', + 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', + 'Operating System :: OS Independent', + 'Topic :: Desktop Environment :: Screen Savers', + 'Topic :: Multimedia :: Graphics' + ], + python_requires='>=3.6', + install_requires=common_dependencies, +) From 1ada29c5e91e79d896baf4a1382b2f3486394532 Mon Sep 17 00:00:00 2001 From: jr-k Date: Tue, 27 Aug 2024 00:46:13 +0200 Subject: [PATCH 4/7] setup script --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.py b/setup.py index 6b90203..b666648 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ # Website: https://github.com/jr-k/obscreen # License: GPLv2 (see LICENSE file) +import os import sys import logging @@ -28,6 +29,9 @@ if sys.platform == "win32": if sys.platform == "darwin": common_dependencies.remove('pysqlite3') +os.environ['PYTHONUTF8'] = '1' +os.environ['PYTHONIOENCODING'] = 'utf-8' + setup( name='obscreen', version=open('version.txt').read(), From b829fc026a7283cd6d5634f1751f7aa0c0c6126b Mon Sep 17 00:00:00 2001 From: jr-k Date: Tue, 27 Aug 2024 01:08:27 +0200 Subject: [PATCH 5/7] fix video check --- src/util/UtilVideo.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/util/UtilVideo.py b/src/util/UtilVideo.py index 8f5dc70..4343b9c 100644 --- a/src/util/UtilVideo.py +++ b/src/util/UtilVideo.py @@ -1,18 +1,35 @@ import struct +import logging +import subprocess +import json +from pymediainfo import MediaInfo def mp4_duration_with_ffprobe(filename): - import subprocess, json + try: + result = subprocess.check_output(f'ffprobe -v quiet -show_streams -select_streams v:0 -of json "{filename}"', shell=True).decode() + fields = json.loads(result)['streams'][0] + duration = 0 - result = subprocess.check_output( - f'ffprobe -v quiet -show_streams -select_streams v:0 -of json "{filename}"', - shell=True).decode() - fields = json.loads(result)['streams'][0] + if 'tags' in fields and 'DURATION' in fields['tags']: + duration = round(float(fields['tags']['DURATION']), 2) + elif 'duration' in fields: + duration = round(float(fields['duration']), 2) - if 'tags' in fields and 'DURATION' in fields['tags']: - return round(float(fields['tags']['DURATION']), 2) + return duration + except (subprocess.CalledProcessError, FileNotFoundError): + logging.warn("ffprobe not found or an error occurred. Using pymediainfo instead.") - if 'duration' in fields: - return round(float(fields['duration']), 2) + try: + media_info = MediaInfo.parse(filename) + for track in media_info.tracks: + if track.track_type == "Video": + duration = round(track.duration / 1000, 2) if track.duration else None + + return duration + except OSError: + logging.warn("Fail to get video metadata from pymediainfo.") + except json.JSONDecodeError: + logging.warn("Fail to get video metadata from ffprobe.") return 0 From 0b51c9825d9799ffd8b4c1ffe14cfc8db3063a1b Mon Sep 17 00:00:00 2001 From: jr-k Date: Tue, 27 Aug 2024 01:10:51 +0200 Subject: [PATCH 6/7] add pymediaonfo to deps --- requirements.txt | 1 + setup.py | 1 + 2 files changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index 35696ad..dfe3667 100755 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ waitress flask-login pysqlite3 psutil +pymediainfo diff --git a/setup.py b/setup.py index b666648..f6fbb63 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ common_dependencies = [ 'waitress', 'flask-login', 'psutil', + 'pymediainfo', 'pysqlite3', ] From 9d8b915905a1f4aa2b85e6cc66adbe9a266cafca Mon Sep 17 00:00:00 2001 From: jr-k Date: Tue, 27 Aug 2024 01:19:22 +0200 Subject: [PATCH 7/7] add windows & macos doc --- docs/setup-run-headless.md | 10 ++++++++++ docs/setup-run-on-rpi.md | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/setup-run-headless.md b/docs/setup-run-headless.md index ab1515b..f45848b 100644 --- a/docs/setup-run-headless.md +++ b/docs/setup-run-headless.md @@ -62,10 +62,20 @@ docker compose up --detach --pull=always #### Install - Install studio by executing following script +##### Linux ```bash curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-studio.sh -o /tmp/install-studio.sh && chmod +x /tmp/install-studio.sh && sudo /bin/bash /tmp/install-studio.sh $USER $HOME sudo reboot ``` +##### Windows & MacOS +```bash +git clone https://github.com/jr-k/obscreen.git +cd obscreen +python3 -m venv venv +source ./venv/bin/activate +pip install . +cp .env.dist .env +``` #### Configure - Server configuration is editable in `.env` file. diff --git a/docs/setup-run-on-rpi.md b/docs/setup-run-on-rpi.md index 0417d44..6b3e463 100644 --- a/docs/setup-run-on-rpi.md +++ b/docs/setup-run-on-rpi.md @@ -20,10 +20,20 @@ #### Install - Install studio by executing following script +##### Linux ```bash curl -fsSL https://raw.githubusercontent.com/jr-k/obscreen/master/system/install-studio.sh -o /tmp/install-studio.sh && chmod +x /tmp/install-studio.sh && sudo /bin/bash /tmp/install-studio.sh $USER $HOME sudo reboot ``` +##### Windows & MacOS +```bash +git clone https://github.com/jr-k/obscreen.git +cd obscreen +python3 -m venv venv +source ./venv/bin/activate +pip install . +cp .env.dist .env +``` #### Configure - Server configuration is editable in `.env` file.