OpenSrcerer / supersonic

A bot for Discord that allows you to stream music through a subsonic server.
GNU General Public License v3.0
20 stars 3 forks source link

How to install / configure #16

Closed Sacha-Ringenbach closed 2 years ago

Sacha-Ringenbach commented 2 years ago

I'm installing this project via docker-compose, I find it interesting.

The documentation doesn't exist yet tho :X how can I configure the subsonic url / user / password ?

CarbonMac commented 2 years ago

Same here, I assume there is stuff in the .env I can specify but I get the feeling the project doesn't even have a working subsonic example. I am able to get the bot to join and connect and play music. But it isn't "my" music.

Code-Slave commented 2 years ago

Thirded

OpenSrcerer commented 2 years ago

Hi everyone, thanks for your interest! This project is still in very early development, and the music server is one that I'm hosting, currently hardcoded. I've been improving the event handling system to a good point before I start implementing features.

Currently there's still a need for:

I don't have much time nowadays because of school and work, feel free to contribute! Short answer: The feature hasn't been added yet. You can only play music from my server at this point if you just want to use the already existing bot.

Longer Macgyver Answer: If you really want this bot to work for you at this experimental stage, you can follow these steps:

  1. Clone the repository to your machine
  2. Import it as a Gradle project
  3. Go to the file src/main/kotlin/personal/opensrcerer/client/cache/SubsonicCache.kt and replace the original values with your Subsonic API compliant server credentials
  4. Run the Gradle task "shadowJar" to build a fat-jar.
  5. Use java -jar yourJarName.jar to run the bot.
Code-Slave commented 2 years ago

Thanks for the info. I know zero java so not much help. It seems all the subsonic discord bots are in a similiar phase. I only found 6 on gh

Code-Slave commented 2 years ago

will the docker build recompile everything ?

CarbonMac commented 2 years ago

@OpenSrcerer Thank you so much! This is awesome!!! Got it connected to my docker instance over the bridge. Navidrome support required that I edit (I'm sorry for opening this additional can of worms but seems to work great so far): src\main\kotlin\personal\opensrcerer\responses\subsonic\SubsonicResponse.kt

With the following to ignore some more values that Navidrome spits out:

open class SubsonicResponse {
    val status: String = ""
    val version: String = ""
    val type: String = ""
    val serverVersion: String = ""
    val xmlns: String = ""
    val error: SubsonicError? = null
    private var requestTime: Long = 0

For the noobs like me that don't know what importing a gradle project is and running Winblows, install IntelliJ IDEA (Jetbrains), import the project, in the Run Anything menu (double click Ctrl) run gradle shadowJar and it'll be in build/lib after building the file if you've done things properly. Replace the jar and restart the application.

will the docker build recompile everything ?

If you are using Docker, you can make these changes on the fly to the files in docker, delete your current supersonic image, and let it rebuild it entirely on recreation.

Side note: Would it be possible to just add these values as docker environment values? Will be playing with this grabbing Kotlin env variables (I have zero knowledge of either but this seems easy enough)

CarbonMac commented 2 years ago

Okay, side note has also been achieved by editing src/main/kotlin/personal/opensrcerer/client/cache/SubsonicCache.kt. This allows me to add sub_url, sub_port, sub_user, sub_pass, and sub_version to the .env file so that when I am building the image it will compile with those values.

package personal.opensrcerer.client.cache

object SubsonicCache {
    private val cacheMap: MutableMap<String, SubsonicConfig>
    private val url = System.getenv("sub_url") ?: "adefaultdomain.com"
    private val port = System.getenv("sub_port").toIntOrNull() ?: 4040
    private val user = System.getenv("sub_user") ?: "thedefaultusername"
    private val pass = System.getenv("sub_pass") ?: "thedefaultpassword"
    private val version = System.getenv("sub_version") ?: "1.15.0"

    init {
        cacheMap = HashMap()
        cacheMap["824772718800666645"] = SubsonicConfig(
            url,
            port,
            user,
            pass,
            version
        )
    }

    fun get(guildId: String): SubsonicConfig? {
        return cacheMap[guildId] ?: cacheMap["824772718800666645"]
    }
}
TritonKing commented 2 years ago

Wasn't sure where else to talk. New to Git and programing but I have been starting to work with Linux lately setting up my servers trying to shift away from Windows.

This is a great Project and I would like to help if I can. I run my own Subsonic server already, I use Discord and would like to see this project take off.

What do I need to get/DL and what exactly can I do to help?

Thank you in advance for even starting this project and to all the others helping out. :)

OpenSrcerer commented 2 years ago

@TritonKing Hey! I appreciate that you're interested in helping. All you need is your favorite IDE and to clone this repository. If you wish to talk more you can visit the server mentioned in the README and we can chat more freely about what exactly needs some work at the moment. I can give you a project tour and some pointers whenever you'll be available.