doodlezucc / dungeonclub

A cool little website for playing Dungeons & Dragons together!
https://dungeonclub.net
MIT License
71 stars 12 forks source link

How to go about building and adding music? #12

Closed senatormailman closed 1 year ago

senatormailman commented 1 year ago

Hey there, love the tool.

I am trying to see if I can build this out via docker and I am struggling with how to add tracks locally. When I place the tracks in ambience/tracks, what happens next? I see the ambience player mostly uses Youtube URLS, so I don't understand the format to get this to work.

I have played around with the meta.json and source.json files and I have been able to get the packaged release to include extra music, but I had some issue with how I set the playlist up, so my json files went back to it's original state (my fault for messing with it)!

Let me know what I am missing, thanks!

doodlezucc commented 1 year ago

Hi there!

The background music of Dungeon Club is fetched from actual YouTube playlists which contain audio tracks licensed under Creative Commons (or similar).

It's not documented anywhere right now (don't worry about being confused), but ambience/meta.json is an automatically generated file. It includes information about each track's name and duration, as well as all source YouTube IDs.

If you want to add your own tracks, I'd suggest modifying the ambience/source.json file. That's where you'll find the IDs to all playlists which are downloaded. You can include new videos by adding any valid YouTube ID to the include field of a playlist.

{
    "playlists": {
        // ...

        // This playlist is titled "Ethereal" in Dungeon Club
        "PL4K_2Hl-nCuVDGnP6JX39cdqT63R1eyI1": {
            "include": [
                "XPZL2yFOeA8" // <-- Your newly added video ID
            ]
        },

        // ...
    }
}

Download the music-bundle.zip

All default music included in the public version of Dungeon Club is available as a compressed ZIP file. This "music bundle" contains all linked YouTube videos, converted to normalized MP3 files. I recommend downloading this bundle and unzipping the audio files into ambience/tracks/. Essentially, this replaces the step of fetching/converting all default tracks yourself, which may take a while.

Manual download/conversion

There are two command line tools required for downloading and converting the youtube playlists from ambience/source.json yourself: yt-dlp and ffmpeg. After installing, you can start your Dungeon Club server with the music player feature enabled by running ./server.exe --music. You should be able to see download progress of your newly added video IDs.

Updating ambience meta...
Downloading...  95.24%
Downloading... 100.00%
Downloaded track 21/21
Loaded music playlists

Dungeon Club is ready!
  - Local:   http://localhost:7070
  - Network: http://192.168.178.43:7070

Navigate to http://localhost:7070 and launch a campaign session. You should now be able to find your custom audio tracks when skipping through the audio player.

Thanks for trying out the self hosted version. If you encounter any problems, I'm always happy to help!

Cheers!

senatormailman commented 1 year ago

Aha! That explains my confusion with meta.json!

Apologies, I have been quite busy these past couple of weeks. I will have to try this out now! I will go ahead and close this. Thank you again! :smiley: