Update Linux app to use Firefox and auto-install dependencies
This commit is contained in:
1 parent
ce5175d8db
commit
5e891ad139
2 files changed
+16
-12
No files matched your search
Regular → Executable
+10
-4
@@ -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
|
||||
python3 journey_fm_app.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)
|
||||
|
||||
Reference in new issue
Block a user