~cycle-five/cracktunes

A hassle-free, highly performant, host-it-yourself Discord music bot with YouTube and Spotify support. Powered by yt-dlp and crack.

fdeecb2 asdf

a month ago

e2d8081 dep udpates

a month ago

CrackTunes

A hassle-free, highly performant, host-it-yourself, cracking smoking Discord music bot

builds.sr.ht status GitHub CI workflow status Dependency status MIT License Rust Version

#Aknowledgements

Thanks to the guys over at alwaysdata for hosting the website, web portal, email, etc for this project for free, in their Open Source program.

#Deployment

#Usage

  • Create a bot account
  • Copy the token and application id to a .env with the DISCORD_TOKEN and DISCORD_APP_ID environment variables respectively.
  • Define DATABASE_URL, PG_USER, PG_PASSWORD for the Postgres database.
  • Optional define SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET for Spotify support.
  • Optional define OPENAI_API_KEY for chatgpt support.
  • Optional define VIRUSTOTAL_API_KEY for osint URL checking.
  • Use .env.example as a starting point.

#Docker FIXME

docker run -d --env-file .env --restart unless-stopped --name cracktunes ghcr.io/cycle-five/cracktunes:latest

#Development

Make sure you've installed Rust. You can install Rust and its package manager, cargo by following the instructions on https://rustup.rs/. After installing the requirements below, simply run cargo run.

#Linux/MacOS FIXME

The commands below install a C compiler, GNU autotools and FFmpeg, as well as yt-dlp through Python's package manager, pip.

#Linux FIXME
apt install build-essential autoconf automake libtool ffmpeg
pip install -U yt-dlp
#MacOS FIXME
brew install autoconf automake libtool ffmpeg
pip install -U yt-dlp

#Windows FIXME

If you are using the MSVC toolchain, a prebuilt DLL for Opus is already provided for you.
You will only need to download FFmpeg, and install yt-dlp which can be done through Python's package manager, pip.

pip install -U yt-dlp

If you are using Windows Subsystem for Linux (WSL), you should follow the Linux/MacOS guide, and, in addition to the other required packages, install pkg-config, which you may do by running:

apt install -y pkg-config

#Testing

The following command will run all tests:

cargo +nightly test --all-features --workspace

Some tests are available inside the src/tests folder, others are in their respective files. It's recommended that you run the tests before submitting a Pull Request. Increasing the test coverage is also welcome. Test coverage is tracked using tarpaulin.

cargo +nightly tarpaulin --all-features --workspace

#Linting

cargo +nightly clippy --profile=release --all-features --workspace -- -D warnings -D clippy:all

#Build

cargo +nightly build --profile=release --features crack-osint,crack-bf,crack-fpt --workspace --locked

#Distribution

cargo dist init --hosting github
# make change `pr-run-mode = "upload"`
git add .
git commit -am "chore: cargo-dist"
cargo dist build --profile=release --features crack-gpt,crack-bf,crack-osint

#Release

git tag vX.X.X
git push --tags

# publish to crates.io (optional)
cargo publish

#Docker Compose

Within the project folder, simply run the following:

docker build -t cracktunes .
docker compose up -d

Originally forked from Parrot