Merge branch 'linux'
This commit is contained in:
commit
d357405fb7
3 files changed
+86
-5
No files matched your search
Executable
+63
@@ -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"
|
||||||
Regular → Executable
+16
-4
@@ -4,11 +4,23 @@
|
|||||||
# Get the directory where this script is located
|
# Get the directory where this script is located
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
|
||||||
# Activate virtual environment if it exists
|
# Create virtual environment if it doesn't exist
|
||||||
if [ -d "$DIR/.venv" ]; then
|
if [ ! -d "$DIR/.venv" ]; then
|
||||||
source "$DIR/.venv/bin/activate"
|
python3 -m venv "$DIR/.venv"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate virtual environment
|
||||||
|
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
|
fi
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
python journey_fm_app.py
|
python3 journey_fm_app.py
|
||||||
@@ -12,6 +12,7 @@ from selenium import webdriver
|
|||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.chrome.options import Options
|
||||||
from selenium.webdriver.chrome.service import Service
|
from selenium.webdriver.chrome.service import Service
|
||||||
from webdriver_manager.chrome import ChromeDriverManager
|
from webdriver_manager.chrome import ChromeDriverManager
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import os
|
import os
|
||||||
from plexapi.myplex import MyPlexAccount
|
from plexapi.myplex import MyPlexAccount
|
||||||
@@ -33,7 +34,12 @@ def scrape_recently_played():
|
|||||||
options.add_argument("--no-sandbox")
|
options.add_argument("--no-sandbox")
|
||||||
options.add_argument("--disable-dev-shm-usage")
|
options.add_argument("--disable-dev-shm-usage")
|
||||||
options.add_argument("--disable-gpu")
|
options.add_argument("--disable-gpu")
|
||||||
service = Service(ChromeDriverManager().install())
|
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)
|
driver = webdriver.Chrome(service=service, options=options)
|
||||||
|
|
||||||
url = 'https://www.myjourneyfm.com/recently-played/'
|
url = 'https://www.myjourneyfm.com/recently-played/'
|
||||||
|
|||||||
Reference in new issue
Block a user