Skip to content

Commit

Permalink
fix: broken upgrade path for --break-system-packages users (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicwomg authored Nov 5, 2024
1 parent 35e63ba commit 27d732a
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions pikaraoke/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from flask_babel import Babel
from flask_paginate import Pagination, get_page_parameter
from selenium import webdriver
from selenium.common.exceptions import SessionNotCreatedException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
Expand Down Expand Up @@ -939,13 +940,21 @@ def main():
options.add_argument("--kiosk")
options.add_argument("--start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
driver = webdriver.Chrome(service=service, options=options)
driver.get(f"{k.url}/splash")
driver.add_cookie({"name": "user", "value": "PiKaraoke-Host"})
# Clicking this counts as an interaction, which will allow the browser to autoplay audio
wait = WebDriverWait(driver, 60)
elem = wait.until(EC.element_to_be_clickable((By.ID, "permissions-button")))
elem.click()
try:
driver = webdriver.Chrome(service=service, options=options)
driver.get(f"{k.url}/splash")
driver.add_cookie({"name": "user", "value": "PiKaraoke-Host"})
# Clicking this counts as an interaction, which will allow the browser to autoplay audio
wait = WebDriverWait(driver, 60)
elem = wait.until(EC.element_to_be_clickable((By.ID, "permissions-button")))
elem.click()
except SessionNotCreatedException as e:
print(str(e))
print(
f"\n[ERROR] Error starting splash screen. If you're running headed mode over SSH, you may need to run `export DISPLAY=:0.0` first to target the host machine's screen. Example: `export DISPLAY=:0.0; pikaraoke`\n"
)
cherrypy.engine.exit()
sys.exit()

# Start the karaoke process
k.run()
Expand Down

0 comments on commit 27d732a

Please sign in to comment.