Skip to content

Commit eed78e5

Browse files
committed
Require Last.fm to be configured and working to start
1 parent 65b0c5e commit eed78e5

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* Suppress Spotify API HTTP errors from flooding console output
44
* Change default volume from 80% to 100%
5+
* Require Last.fm to be configured and working to start
56

67
### 1.0.10: 2026-01-07
78

omnishuffle/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,19 +368,20 @@ def _init_sources(self):
368368
console.print("[green]✓[/green] YouTube Music available")
369369

370370
def _init_scrobbler(self):
371-
"""Initialize Last.fm scrobbler."""
371+
"""Initialize Last.fm scrobbler. Exits if Last.fm fails."""
372372
lastfm_config = self.config.get("lastfm", {})
373373
api_key = lastfm_config.get("api_key")
374374
api_secret = lastfm_config.get("api_secret")
375375
username = lastfm_config.get("username")
376376
password = lastfm_config.get("password")
377377

378378
if not all([api_key, api_secret, username, password]):
379-
return
379+
console.print("[red]✗[/red] Last.fm not configured (required)")
380+
sys.exit(1)
380381

381382
if not PYLAST_AVAILABLE:
382-
console.print("[yellow]![/yellow] pylast not installed, scrobbling disabled")
383-
return
383+
console.print("[red]✗[/red] pylast not installed (required for Last.fm)")
384+
sys.exit(1)
384385

385386
password_hash = pylast.md5(password)
386387
self.scrobbler = Scrobbler(api_key, api_secret, username, password_hash)
@@ -390,6 +391,7 @@ def _init_scrobbler(self):
390391
else:
391392
error = getattr(self.scrobbler, '_last_error', 'unknown error')
392393
console.print(f"[red]✗[/red] Last.fm: {error}")
394+
sys.exit(1)
393395

394396
def _setup_callbacks(self):
395397
"""Set up player callbacks."""

0 commit comments

Comments
 (0)