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
|
# 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
|
fi
|
||||||
|
|
||||||
|
# Activate virtual environment
|
||||||
|
source "$DIR/.venv/bin/activate"
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
pip install -r "$DIR/requirements.txt"
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
cd "$DIR"
|
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
|
import time
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.firefox.options import Options
|
||||||
from selenium.webdriver.chrome.service import Service
|
from selenium.webdriver.firefox.service import Service
|
||||||
from webdriver_manager.chrome import ChromeDriverManager
|
from webdriver_manager.firefox import GeckoDriverManager
|
||||||
|
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
|
||||||
@@ -30,11 +31,8 @@ def scrape_recently_played():
|
|||||||
"""Scrape recently played songs from myjourneyfm.com using Selenium"""
|
"""Scrape recently played songs from myjourneyfm.com using Selenium"""
|
||||||
options = Options()
|
options = Options()
|
||||||
options.add_argument("--headless")
|
options.add_argument("--headless")
|
||||||
options.add_argument("--no-sandbox")
|
service = Service(GeckoDriverManager().install())
|
||||||
options.add_argument("--disable-dev-shm-usage")
|
driver = webdriver.Firefox(service=service, options=options)
|
||||||
options.add_argument("--disable-gpu")
|
|
||||||
service = Service(ChromeDriverManager().install())
|
|
||||||
driver = webdriver.Chrome(service=service, options=options)
|
|
||||||
|
|
||||||
url = 'https://www.myjourneyfm.com/recently-played/'
|
url = 'https://www.myjourneyfm.com/recently-played/'
|
||||||
driver.get(url)
|
driver.get(url)
|
||||||
|
|||||||
Reference in new issue
Block a user