From 4d2788f3ae75898df5343bce75e08f012559bfd9 Mon Sep 17 00:00:00 2001 From: Pierre F <41551115+quichef@users.noreply.github.com> Date: Sun, 31 Dec 2023 16:23:32 +0100 Subject: [PATCH 1/8] Update README.md Update readme.md to point out python version requirements. I've randomly tried out with python 3.7 which was installed by default on by Raspberry and it failed :) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e3bd7806..34e1b11f 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ Install git, if you haven't already. Install python3/pip3 (usually raspberry pi OS already has it, run `python3 --version` to check): https://www.python.org/downloads/ +Python >= 3.8 is necessary Clone this repo: From c10348d73a8656f412bc5035e45c3b5faa93a74e Mon Sep 17 00:00:00 2001 From: Vicwomg Date: Thu, 4 Jan 2024 11:12:13 -0500 Subject: [PATCH 2/8] Update constants.py --- constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/constants.py b/constants.py index 9a8138ee..49bb2b2a 100644 --- a/constants.py +++ b/constants.py @@ -1,6 +1,6 @@ -VERSION = "1.1.2" +VERSION = "1.2" LANGUAGES = { "en": "English", "zh_CN": "Chinese", "pt_BR": "Brazilian Portuguese", -} \ No newline at end of file +} From 1c016f62d04a8d346e377554813e377c38f44170 Mon Sep 17 00:00:00 2001 From: Vic Wong Date: Sun, 7 Jan 2024 13:04:58 -0500 Subject: [PATCH 3/8] #312 - default to IP url, fix Flask deps, fix ubuntu detection --- README.md | 6 ++++-- app.py | 26 +++++--------------------- karaoke.py | 12 ++++++------ requirements.txt | 2 +- setup.sh | 2 +- 5 files changed, 17 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 34e1b11f..07fe5547 100644 --- a/README.md +++ b/README.md @@ -91,11 +91,13 @@ Run the setup script to install dependencies and set up the python env: If you're on a raspberry pi or debian system the setup script should have handled installing ffmpeg via apt. -If you're on OSX or another Linux distro, manually install FFMPEG from here: https://ffmpeg.org/download.html +If you're on OSX or another Linux distro, manually install FFMPEG 6.0 or greater from here: https://ffmpeg.org/download.html + +On Ubuntu, apt seemed to keep installing an old 4.X version of ffmpeg. I found better luck grabbing a pre-built version of ffmpeg 6.0+ and manually copying it to /usr/bin/. Pre-built releases were obtained from this repo: https://github.com/BtbN/FFmpeg-Builds/releases ### Windows -Manually install ffmpeg https://ffmpeg.org/download.html +Manually install ffmpeg 6.0 or greater https://ffmpeg.org/download.html Run the setup script to install python dependencies: diff --git a/app.py b/app.py index d62cd040..81d911f1 100644 --- a/app.py +++ b/app.py @@ -616,23 +616,6 @@ def get_default_youtube_dl_path(platform): if platform == "windows": return os.path.join(os.path.dirname(__file__), ".venv\Scripts\yt-dlp.exe") return os.path.join(os.path.dirname(__file__), ".venv/bin/yt-dlp") - # if platform == "windows": - # choco_ytdl_path = r"C:\ProgramData\chocolatey\bin\yt-dlp.exe" - # scoop_ytdl_path = os.path.expanduser(r"~\scoop\shims\yt-dlp.exe") - # if os.path.isfile(choco_ytdl_path): - # return choco_ytdl_path - # if os.path.isfile(scoop_ytdl_path): - # return scoop_ytdl_path - # return r"C:\Program Files\yt-dlp\yt-dlp.exe" - # default_ytdl_unix_path = "/usr/local/bin/yt-dlp" - # if platform == "osx": - # if os.path.isfile(default_ytdl_unix_path): - # return default_ytdl_unix_path - # else: - # # just a guess based on the default python 3 install in OSX monterey - # return "/Library/Frameworks/Python.framework/Versions/3.10/bin/yt-dlp" - # else: - # return default_ytdl_unix_path def get_default_dl_dir(platform): @@ -661,7 +644,7 @@ def get_default_dl_dir(platform): default_splash_delay = 3 default_screensaver_delay = 300 default_log_level = logging.INFO - default_prefer_ip = False + default_prefer_hostname = False default_dl_dir = get_default_dl_dir(platform) default_youtubedl_path = get_default_youtube_dl_path(platform) @@ -736,9 +719,10 @@ def get_default_dl_dir(platform): required=False, ) parser.add_argument( - "--prefer-ip", + "--prefer-hostname", action="store_true", - help=f"Show the IP instead of the fully qualified local domain name. Default: {default_prefer_ip}", + help=f"Use the local hostname instead of the IP as the connection URL. Use at your discretion: mDNS is not guaranteed to work on all LAN configurations. Defaults to {default_prefer_hostname}", + default=default_prefer_hostname, required=False, ) parser.add_argument( @@ -833,7 +817,7 @@ def get_default_dl_dir(platform): hide_overlay=args.hide_overlay, screensaver_timeout=args.screensaver_timeout, url=args.url, - prefer_ip=args.prefer_ip + prefer_hostname=args.prefer_hostname ) # Start the CherryPy WSGI web server diff --git a/karaoke.py b/karaoke.py index 85dfc454..b88f69e9 100644 --- a/karaoke.py +++ b/karaoke.py @@ -75,7 +75,7 @@ def __init__( hide_overlay=False, screensaver_timeout = 300, url=None, - prefer_ip=False + prefer_hostname=True ): # override with supplied constructor args if provided @@ -93,7 +93,7 @@ def __init__( self.hide_overlay = hide_overlay self.screensaver_timeout = screensaver_timeout self.url_override = url - self.prefer_ip = prefer_ip + self.prefer_hostname = prefer_hostname # other initializations self.platform = get_platform() @@ -110,7 +110,7 @@ def __init__( http port: {self.port} ffmpeg port {self.ffmpeg_port} hide URL: {self.hide_url} - prefer IP: {self.prefer_ip} + prefer hostname: {self.prefer_hostname} url override: {self.url_override} hide RaspiWiFi instructions: {self.hide_raspiwifi_instructions} headless (hide splash): {self.hide_splash_screen} @@ -146,10 +146,10 @@ def __init__( logging.debug("Overriding URL with " + self.url_override) self.url = self.url_override else: - if (self.prefer_ip): - self.url = f"http://{self.ip}:{self.port}" - else: + if (self.prefer_hostname): self.url = f"http://{socket.getfqdn().lower()}:{self.port}" + else: + self.url = f"http://{self.ip}:{self.port}" self.url_parsed = urlparse(self.url) # get songs from download_path diff --git a/requirements.txt b/requirements.txt index 427cce04..0ae75548 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ CherryPy -Flask +Flask==2.2.5 qrcode psutil unidecode diff --git a/setup.sh b/setup.sh index ce8fc2b5..8d47e424 100755 --- a/setup.sh +++ b/setup.sh @@ -6,7 +6,7 @@ if [ $REPLY = "y" ] ## setup stuff -if [[ $(cat /etc/os-release | grep -i debian) != "" ]]; then +if [[ $(cat /etc/os-release | grep ^ID= | grep -i debian) != "" ]]; then echo "Client is a Debian-based system. Installing binaries"; echo echo "*** RUNNING APT-GET UPDATE ***" From 6b12fcdfa44f96a29371f8fd82d3cf2db5356eea Mon Sep 17 00:00:00 2001 From: Vicwomg Date: Sun, 7 Jan 2024 13:38:31 -0500 Subject: [PATCH 4/8] Fix outdated help output in README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 07fe5547..b2fb848a 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,8 @@ options: -l LOG_LEVEL, --log-level LOG_LEVEL Logging level int value (DEBUG: 10, INFO: 20, WARNING: 30, ERROR: 40, CRITICAL: 50). (default: 20 ) --hide-url Hide URL and QR code from the splash screen. - --prefer-ip Show the IP instead of the fully qualified local domain name. Default: False + --prefer-hostname Use the local hostname instead of the IP as the connection URL. Use at your discretion: mDNS is not guaranteed to work on all + LAN configurations. Defaults to False --hide-raspiwifi-instructions Hide RaspiWiFi setup instructions from the splash screen. --hide-splash-screen, --headless From 9cd74cde2b6facfd6efbb3a0bd902dd400430d0b Mon Sep 17 00:00:00 2001 From: Vic Wong Date: Fri, 19 Jan 2024 11:18:03 -0500 Subject: [PATCH 5/8] Fix incorrect debian/raspbian detection --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 8d47e424..f85042a9 100755 --- a/setup.sh +++ b/setup.sh @@ -6,7 +6,7 @@ if [ $REPLY = "y" ] ## setup stuff -if [[ $(cat /etc/os-release | grep ^ID= | grep -i debian) != "" ]]; then +if [[ $(cat /etc/os-release | grep ^ID= | grep -i 'debian\|raspbian') != "" ]]; then echo "Client is a Debian-based system. Installing binaries"; echo echo "*** RUNNING APT-GET UPDATE ***" From 5c325da83fad32ef756bcd75b1eeb25d459c4b4c Mon Sep 17 00:00:00 2001 From: wesleong <127645363+wesleong@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:42:30 -0500 Subject: [PATCH 6/8] Add command line arguments to specify splash width and height --- app.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app.py b/app.py index 81d911f1..fc37e670 100644 --- a/app.py +++ b/app.py @@ -659,6 +659,18 @@ def get_default_dl_dir(platform): default=default_port, required=False, ) + parser.add_argument( + "--width", + help="Desired window width in pixels", + default=0, + required=False, + ) + parser.add_argument( + "--height", + help="Desired window height in pixels", + default=0, + required=False, + ) parser.add_argument( "-f", "--ffmpeg-port", @@ -841,6 +853,11 @@ def get_default_dl_dir(platform): else: service = None options = Options() + + if args.width and args.height: + options.add_argument("--window-size=%s,%s" % (args.width,args.height)) + options.add_argument("--window-position=0,0") + options.add_argument("--kiosk") options.add_argument("--start-maximized") options.add_experimental_option("excludeSwitches", ['enable-automation']) From 00a5a5fdc0667bf7351ecceb29b69ed2f23296dc Mon Sep 17 00:00:00 2001 From: wesleong <127645363+wesleong@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:42:32 -0500 Subject: [PATCH 7/8] Change window geometry parameter to specify width/height as a single input --- app.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index fc37e670..0711e5fc 100644 --- a/app.py +++ b/app.py @@ -660,14 +660,8 @@ def get_default_dl_dir(platform): required=False, ) parser.add_argument( - "--width", - help="Desired window width in pixels", - default=0, - required=False, - ) - parser.add_argument( - "--height", - help="Desired window height in pixels", + "--window-size", + help="Desired window geometry in pixels, specified as width,height", default=0, required=False, ) @@ -854,8 +848,8 @@ def get_default_dl_dir(platform): service = None options = Options() - if args.width and args.height: - options.add_argument("--window-size=%s,%s" % (args.width,args.height)) + if args.window_size: + options.add_argument("--window-size=%s" % (args.window_size)) options.add_argument("--window-position=0,0") options.add_argument("--kiosk") From f10034dc88aca3547d0744f615bb3aa5876c62c5 Mon Sep 17 00:00:00 2001 From: wesleong <127645363+wesleong@users.noreply.github.com> Date: Fri, 16 Feb 2024 17:12:33 -0500 Subject: [PATCH 8/8] Add the new --window-size option to the README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b2fb848a..104e9389 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ May not be up to date, run `python3 app.py --help` for the latest: ``` usage: app.py [-h] [-p PORT] [-f FFMPEG_PORT] [-d DOWNLOAD_PATH] [-y YOUTUBEDL_PATH] [-v VOLUME] [-s SPLASH_DELAY] [-t SCREENSAVER_TIMEOUT] [-l LOG_LEVEL] [--hide-url] [--prefer-ip] [--hide-raspiwifi-instructions] [--hide-splash-screen] [--dual-screen] [--high-quality] - [--logo-path LOGO_PATH] [-u URL] [--hide-overlay] [--admin-password ADMIN_PASSWORD] + [--logo-path LOGO_PATH] [-u URL] [--hide-overlay] [--admin-password ADMIN_PASSWORD] [--window-size WIDTH,HEIGHT] options: -h, --help show this help message and exit @@ -184,6 +184,8 @@ options: --admin-password ADMIN_PASSWORD Administrator password, for locking down certain features of the web UI such as queue editing, player controls, song editing, and system shutdown. If unspecified, everyone is an admin. + --window-size WIDTH,HEIGHT + Explicitly set the width and height of the splash screen, where the WIDTH and HEIGHT values are specified in pixels. ``` ## Troubleshooting