blastbeng / spotisub

Spotify to subsonic Playlist Generator and Importer
MIT License
105 stars 6 forks source link

can't get it to work #7

Closed rantanlan closed 2 months ago

rantanlan commented 2 months ago

First, thanks for this, love the idea behind it and was waiting for something like this.

But I can't make it work… not sure what the issue is, looks to me, I don't have a proper Spotify access. Also, I'm not sure what to put in the SPOTIPY_REDIRECT_URI variable... when I initialized the first_run I was prompted once by Spotify to grant access, then I'll get an error in the browser due to the 127.0.0.1 redirect, but the entries in the spotipy_cache look valid.

when i trigger the artist recommendation endpoint i get the following output:

subtify  | Traceback (most recent call last):
subtify  |   File "/home/user/subtify/./generate_playlists.py", line 123, in write_playlist
subtify  |     for playlist in pysonic.getPlaylists()["playlists"]["playlist"]:
subtify  | KeyError: 'playlist'

docker compose is the following:

services:
  navidrome:
    image: deluan/navidrome:latest
    container_name: navidome
    user: 1000:1000
    ports:
      - 4533:4533
    restart: unless-stopped
    volumes:
      - /srv/navidrome:/data
      - /storage/media/music:/music:ro
    environment:
      - ND_SCANSCHEDULE=168h
      - ND_LOGLEVEL=info
      - ND_SESSIONTIMEOUT=24h
      - ND_BASEURL=
      - ND_AUTHREQUESTLIMIT=3
      - ND_AUTHWINDOWLENGTH=60s
      - ND_LASTFM_ENABLED=true
      - ND_LASTFM_APIKEY=xxx
      - ND_LASTFM_SECRET=xxx
      - ND_SPOTIFY_ID=xxx
      - ND_SPOTIFY_SECRET=xxx
    networks:
      - media
  subtify:
    container_name: subtify
    image: blastbeng/subtify:latest
    restart: always
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - SPOTIPY_CLIENT_ID=xxx
      - SPOTIPY_CLIENT_SECRET=xxx
      - SPOTIPY_REDIRECT_URI=http://127.0.0.1:8080/
      - SUBSONIC_API_HOST=http://192.168.1.130
      - SUBSONIC_API_PORT=4533
      - SUBSONIC_API_USER=xxx
      - SUBSONIC_API_PASS=xxx
      - SUBSONIC_API_BASE_URL=/
      - SCHEDULER_ENABLED=1
      - ITEMS_PER_PLAYLIST=100
      - NUM_USER_PLAYLISTS=5
      - ARTIST_GEN_SCHED=1
      - RECCOMEND_GEN_SCHED=4
      - PLAYLIST_GEN_SCHED=3
      - SAVED_GEN_SCHED=2
      - LOG_LEVEL=40
    volumes:
      - /srv/navidrome/cache:/home/user/subtify/cache
    ports:
      - 50811:50811
    networks:
      - media
networks:
  media:
    external: true
blastbeng commented 2 months ago

First, thanks for this, love the idea behind it and was waiting for something like this.

But I can't make it work… not sure what the issue is, looks to me, I don't have a proper Spotify access. Also, I'm not sure what to put in the SPOTIPY_REDIRECT_URI variable... when I initialized the first_run I was prompted once by Spotify to grant access, then I'll get an error in the browser due to the 127.0.0.1 redirect, but the entries in the spotipy_cache look valid.

when i trigger the artist recommendation endpoint i get the following output:

subtify  | Traceback (most recent call last):
subtify  |   File "/home/user/subtify/./generate_playlists.py", line 123, in write_playlist
subtify  |     for playlist in pysonic.getPlaylists()["playlists"]["playlist"]:
subtify  | KeyError: 'playlist'

docker compose is the following:

services:
  navidrome:
    image: deluan/navidrome:latest
    container_name: navidome
    user: 1000:1000
    ports:
      - 4533:4533
    restart: unless-stopped
    volumes:
      - /srv/navidrome:/data
      - /storage/media/music:/music:ro
    environment:
      - ND_SCANSCHEDULE=168h
      - ND_LOGLEVEL=info
      - ND_SESSIONTIMEOUT=24h
      - ND_BASEURL=
      - ND_AUTHREQUESTLIMIT=3
      - ND_AUTHWINDOWLENGTH=60s
      - ND_LASTFM_ENABLED=true
      - ND_LASTFM_APIKEY=xxx
      - ND_LASTFM_SECRET=xxx
      - ND_SPOTIFY_ID=xxx
      - ND_SPOTIFY_SECRET=xxx
    networks:
      - media
  subtify:
    container_name: subtify
    image: blastbeng/subtify:latest
    restart: always
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - SPOTIPY_CLIENT_ID=xxx
      - SPOTIPY_CLIENT_SECRET=xxx
      - SPOTIPY_REDIRECT_URI=http://127.0.0.1:8080/
      - SUBSONIC_API_HOST=http://192.168.1.130
      - SUBSONIC_API_PORT=4533
      - SUBSONIC_API_USER=xxx
      - SUBSONIC_API_PASS=xxx
      - SUBSONIC_API_BASE_URL=/
      - SCHEDULER_ENABLED=1
      - ITEMS_PER_PLAYLIST=100
      - NUM_USER_PLAYLISTS=5
      - ARTIST_GEN_SCHED=1
      - RECCOMEND_GEN_SCHED=4
      - PLAYLIST_GEN_SCHED=3
      - SAVED_GEN_SCHED=2
      - LOG_LEVEL=40
    volumes:
      - /srv/navidrome/cache:/home/user/subtify/cache
    ports:
      - 50811:50811
    networks:
      - media
networks:
  media:
    external: true

Can be an issue in the code, it happens because you have no playlists in your Navidrome,

Just to confirm this, can you manually create a new playlist in navidrome (empty playlist is good) and try to hit artist recommendation endpoint again?

If that's the case, it will be solved today in release v 0.1.2

EDIT: I replicated it. Got the same error. I will release the fix in v0.1.2 in an hour.

blastbeng commented 2 months ago

Solved in RELEASE 0.1.2

Pull the latest image or the 0.1.2 tag to solve this error.