From 5e891ad1397622918117989b6692c35b7926ddbe Mon Sep 17 00:00:00 2001 From: nmemmert Date: Mon, 17 Nov 2025 08:24:50 -0500 Subject: [PATCH 1/3] Update Linux app to use Firefox and auto-install dependencies --- journey_fm_app.sh | 14 ++++++++++---- main.py | 14 ++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) mode change 100644 => 100755 journey_fm_app.sh diff --git a/journey_fm_app.sh b/journey_fm_app.sh old mode 100644 new mode 100755 index 8628070..d20f55c --- a/journey_fm_app.sh +++ b/journey_fm_app.sh @@ -4,11 +4,17 @@ # Get the directory where this script is located DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -# Activate virtual environment if it exists -if [ -d "$DIR/.venv" ]; then - source "$DIR/.venv/bin/activate" +# Create virtual environment if it doesn't exist +if [ ! -d "$DIR/.venv" ]; then + python3 -m venv "$DIR/.venv" fi +# Activate virtual environment +source "$DIR/.venv/bin/activate" + +# Install dependencies +pip install -r "$DIR/requirements.txt" + # Run the application cd "$DIR" -python journey_fm_app.py \ No newline at end of file +python3 journey_fm_app.py \ No newline at end of file diff --git a/main.py b/main.py index 39e61fa..71b361f 100644 --- a/main.py +++ b/main.py @@ -9,9 +9,10 @@ creates a playlist of matching songs, and imports it into Plex. import time from selenium import webdriver -from selenium.webdriver.chrome.options import Options -from selenium.webdriver.chrome.service import Service -from webdriver_manager.chrome import ChromeDriverManager +from selenium.webdriver.firefox.options import Options +from selenium.webdriver.firefox.service import Service +from webdriver_manager.firefox import GeckoDriverManager +from selenium.webdriver.common.by import By from bs4 import BeautifulSoup import os from plexapi.myplex import MyPlexAccount @@ -30,11 +31,8 @@ def scrape_recently_played(): """Scrape recently played songs from myjourneyfm.com using Selenium""" options = Options() options.add_argument("--headless") - options.add_argument("--no-sandbox") - options.add_argument("--disable-dev-shm-usage") - options.add_argument("--disable-gpu") - service = Service(ChromeDriverManager().install()) - driver = webdriver.Chrome(service=service, options=options) + service = Service(GeckoDriverManager().install()) + driver = webdriver.Firefox(service=service, options=options) url = 'https://www.myjourneyfm.com/recently-played/' driver.get(url) From 9b63031c1ea059408482aee9b242552b1a172d89 Mon Sep 17 00:00:00 2001 From: nmemmert Date: Mon, 17 Nov 2025 09:18:32 -0500 Subject: [PATCH 2/3] Add Linux installer script --- install.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..4b83116 --- /dev/null +++ b/install.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# Journey FM Playlist Creator - Linux Installer + +echo "Journey FM Playlist Creator - Linux Installer" +echo "==============================================" + +# Get the directory where this script is located +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +echo "Installing in: $DIR" + +# Check if Python 3 is installed +if ! command -v python3 > /dev/null 2>&1; then + echo "Python 3 not found. Installing Python 3..." + sudo apt update && sudo apt install -y python3 python3-pip python3-venv +fi + +# Create virtual environment +echo "Creating virtual environment..." +python3 -m venv "$DIR/.venv" + +# Activate virtual environment +source "$DIR/.venv/bin/activate" + +# Install Python dependencies +echo "Installing Python dependencies..." +pip install -r "$DIR/requirements.txt" + +# Install Chromium browser +if ! command -v chromium-browser > /dev/null 2>&1; then + echo "Installing Chromium browser..." + sudo apt update && sudo apt install -y chromium-browser +fi + +# Create application icon +echo "Creating application icon..." +python3 "$DIR/create_icon.py" + +# Create desktop entry +echo "Creating desktop entry..." +mkdir -p ~/.local/share/applications + +cat > ~/.local/share/applications/journey-fm.desktop << EOF +[Desktop Entry] +Name=Journey FM Playlist +Exec=$DIR/journey_fm_app.sh +Icon=$DIR/icon.png +Type=Application +Categories=Utility; +EOF + +chmod +x ~/.local/share/applications/journey-fm.desktop + +# Update desktop database +echo "Updating desktop database..." +update-desktop-database ~/.local/share/applications + +# Make scripts executable +chmod +x "$DIR/journey_fm_app.sh" + +echo "Installation complete!" +echo "You can now find 'Journey FM Playlist' in your applications menu." +echo "Or run: $DIR/journey_fm_app.sh" \ No newline at end of file From 5f88cdd92b3be9bc062bf75f46494ff0aa9eff54 Mon Sep 17 00:00:00 2001 From: nmemmert Date: Mon, 17 Nov 2025 09:24:16 -0500 Subject: [PATCH 3/3] Fix ChromeDriver compatibility and update desktop icon --- journey_fm_app.sh | 6 ++++++ main.py | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/journey_fm_app.sh b/journey_fm_app.sh index d20f55c..b86494a 100755 --- a/journey_fm_app.sh +++ b/journey_fm_app.sh @@ -15,6 +15,12 @@ source "$DIR/.venv/bin/activate" # Install dependencies pip install -r "$DIR/requirements.txt" +# Check if Chromium is installed, install if not +if ! command -v chromium-browser > /dev/null 2>&1; then + echo "Chromium not found. Installing Chromium..." + sudo apt update && sudo apt install -y chromium-browser +fi + # Run the application cd "$DIR" python3 journey_fm_app.py \ No newline at end of file diff --git a/main.py b/main.py index 71b361f..98848d9 100644 --- a/main.py +++ b/main.py @@ -9,9 +9,9 @@ creates a playlist of matching songs, and imports it into Plex. import time from selenium import webdriver -from selenium.webdriver.firefox.options import Options -from selenium.webdriver.firefox.service import Service -from webdriver_manager.firefox import GeckoDriverManager +from selenium.webdriver.chrome.options import Options +from selenium.webdriver.chrome.service import Service +from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By from bs4 import BeautifulSoup import os @@ -31,8 +31,16 @@ def scrape_recently_played(): """Scrape recently played songs from myjourneyfm.com using Selenium""" options = Options() options.add_argument("--headless") - service = Service(GeckoDriverManager().install()) - driver = webdriver.Firefox(service=service, options=options) + options.add_argument("--no-sandbox") + options.add_argument("--disable-dev-shm-usage") + options.add_argument("--disable-gpu") + options.add_argument("--remote-debugging-port=9222") + options.add_argument("--user-data-dir=/tmp/chromium") + options.add_argument("--no-first-run") + options.add_argument("--disable-extensions") + options.binary_location = "/usr/bin/chromium-browser" + service = Service() + driver = webdriver.Chrome(service=service, options=options) url = 'https://www.myjourneyfm.com/recently-played/' driver.get(url)