swingmx / swingmusic

Swing Music is a beautiful, self-hosted music player for your local audio files. Like a cooler Spotify ... but bring your own music.
https://swingmx.com
MIT License
666 stars 41 forks source link

Issue with scanning all the time with docker #215

Closed nesticle8bit closed 1 week ago

nesticle8bit commented 1 month ago

Hello friends, I loved this project, I've been using it for over a week and it has helped me listen to my music on different devices. I've even shared it with my family. I have more than 300k songs on an NTFS hard drive in Zorin OS, mounted as follows:

UUID=66025D8C025D625B /mnt/Music ntfs-3g uid=1000,gid=1000,umask=0022 0 0

When reviewing the pod in Docker, I see that it keeps rescanning and rescanning all day long, over and over again.

image

image

I have set up SwingMusic with a Docker-compose like this:

  swingmusic:
    image: ghcr.io/swingmx/swingmusic:latest
    container_name: swingmusic
    volumes:
      - /mnt/Music:/music
      - ./config:/config
    ports:
      - "1970:1970"
    restart: unless-stopped

I would like to know if this is a configuration issue on my part. Additionally, every time I restart my PC, I have to click on Settings -> Rescan library because initially the app appears empty. What can I do? Thank you very much.

cwilvx commented 1 month ago

Hello @nesticle8bit

Thank you for using Swing Music and recommending it to your family. Appreciated.

You can disable the periodic scan using the -nps flag. Try this on your docker compose:

  swingmusic:
    image: ghcr.io/swingmx/swingmusic:latest
    container_name: swingmusic
+   command: -nps
    volumes:
      - /mnt/Music:/music
      - ./config:/config
    ports:
      - "1970:1970"
    restart: unless-stopped

About the other issue, with 300k songs it may take a few to load all the song metadata for viewing. Try waiting a little bit after starting the app.

Also confirm that your drive mounts before swing music is run. The app deletes records that can't be found on the disk. It asssumes they these tracks are deleted and this might cause the app to be empty like you said.

When you start the app look for a "Loading tracks ..." text on your terminal. After it prints "Done", your music should be accessible via the web client. If that is not working, please share the logs you see when you start the app. Keep an eye on areas that might seem like an error.

Thank you.

nesticle8bit commented 1 month ago

Thank you for the detailed explanation, I added the command: -nps but Im getting an error trying to execute the docker-compose up -d:

Recreating debac4249e68_swingmusic ... 

ERROR: for debac4249e68_swingmusic  'ContainerConfig'

ERROR: for swingmusic  'ContainerConfig'
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 81, in main
  File "compose/cli/main.py", line 203, in perform_command
  File "compose/metrics/decorator.py", line 18, in wrapper
  File "compose/cli/main.py", line 1186, in up
  File "compose/cli/main.py", line 1182, in up
  File "compose/project.py", line 702, in up
  File "compose/parallel.py", line 108, in parallel_execute
  File "compose/parallel.py", line 206, in producer
  File "compose/project.py", line 688, in do
  File "compose/service.py", line 581, in execute_convergence_plan
  File "compose/service.py", line 503, in _execute_convergence_recreate
  File "compose/parallel.py", line 108, in parallel_execute
  File "compose/parallel.py", line 206, in producer
  File "compose/service.py", line 496, in recreate
  File "compose/service.py", line 615, in recreate_container
  File "compose/service.py", line 334, in create_container
  File "compose/service.py", line 922, in _get_container_create_options
  File "compose/service.py", line 962, in _build_container_volume_options
  File "compose/service.py", line 1549, in merge_volume_bindings
  File "compose/service.py", line 1579, in get_container_data_volumes
KeyError: 'ContainerConfig'
[591747] Failed to execute script docker-compose

I will do what you mentioned regarding mounting the hard drives and ensure they mount before starting Docker. Thank you again.

cwilvx commented 1 month ago

Hi @nesticle8bit

Looks like it's a docker compose error. I think my previous compose file suggestion was wrong.

Please check out this issue and let me know how it goes.

https://github.com/swingmx/swingmusic/issues/202

nesticle8bit commented 1 week ago

Thanks a lot!, this is the docker-compose:

services:
  swingmusic:
    image: ghcr.io/swingmx/swingmusic:vv2.0.0.beta1
    command: ["--no-periodic-scan"]
    container_name: swingmusic
    volumes:
      - /mnt/Musica/Music:/music
      - ./config:/config
    ports:
      - "1970:1970"
    restart: unless-stopped

Then just execute:

docker-compose down
docker-compose up -d

And it works!