mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Merge pull request #388 from ashthespy/dev_process
Update Readme and Contributing to be more consistent
This commit is contained in:
commit
b193e9883a
3 changed files with 144 additions and 119 deletions
114
COMPILING.md
Normal file
114
COMPILING.md
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
# Compiling
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
In order to compile librespot, you will first need to set up a suitable Rust build environment, with the necessary dependencies installed. You will need to have a C compiler, Rust, and the development libraries for the audio backend(s) you want installed. These instructions will walk you through setting up a simple build environment.
|
||||||
|
|
||||||
|
### Install Rust
|
||||||
|
The easiest, and recommended way to get Rust is to use [rustup](https://rustup.rs). On Unix/MacOS You can install `rustup` with this command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl https://sh.rustup.rs -sSf | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Follow any prompts it gives you to install Rust. Once that’s done, Rust's standard tools should be setup and ready to use.
|
||||||
|
|
||||||
|
*Note: The current minimum required Rust version is 1.33.0*
|
||||||
|
|
||||||
|
#### Additional Rust tools - `rustfmt`
|
||||||
|
To ensure a consistent codebase, we utilise [`rustfmt`](https://github.com/rust-lang/rustfmt), which is installed by default with `rustup` these days, else it can be installed manually with:
|
||||||
|
```bash
|
||||||
|
rustup component add rustfmt
|
||||||
|
```
|
||||||
|
Using `rustfmt` is not optional, as our CI checks against this repo's rules.
|
||||||
|
|
||||||
|
### General dependencies
|
||||||
|
Along with Rust, you will also require a C compiler.
|
||||||
|
|
||||||
|
On Debian/Ubuntu, install with:
|
||||||
|
```shell
|
||||||
|
sudo apt-get install build-essential
|
||||||
|
|
||||||
|
```
|
||||||
|
On Fedora systems, install with:
|
||||||
|
```shell
|
||||||
|
sudo dnf install gcc
|
||||||
|
```
|
||||||
|
### Audio library dependencies
|
||||||
|
Depending on the chosen backend, specific development libraries are required.
|
||||||
|
|
||||||
|
*_Note this is an non-exhaustive list, open a PR to add to it!_*
|
||||||
|
|
||||||
|
| Audio backend | Debian/Ubuntu | Fedora | macOS |
|
||||||
|
|--------------------|------------------------------| ------------------------------| -- |
|
||||||
|
|Rodio (default)| `libasound2-dev` | `alsa-lib-devel` |
|
||||||
|
|ALSA| `libasound2-dev, pkg-config` |`alsa-lib-devel` |
|
||||||
|
|PortAudio| `portaudio19-dev`| `portaudio-devel`| `portaudio`
|
||||||
|
|PulseAudio| `libpulse-dev`| `pulseaudio-libs-devel` |
|
||||||
|
|JACK| `libjack-dev` | `jack-audio-connection-kit-devel` |
|
||||||
|
|SDL| `libsdl2-dev`| `SDL2-devel` |
|
||||||
|
|Pipe| - | - | - |
|
||||||
|
|
||||||
|
###### For example, to build an ALSA based backend, you would need to run the following to install the required dependencies:
|
||||||
|
|
||||||
|
On Debian/Ubuntu:
|
||||||
|
```shell
|
||||||
|
sudo apt-get install libasound2-dev pkg-config
|
||||||
|
|
||||||
|
```
|
||||||
|
On Fedora systems:
|
||||||
|
```shell
|
||||||
|
sudo dnf install alsa-lib-devel
|
||||||
|
```
|
||||||
|
|
||||||
|
### Getting the Source
|
||||||
|
|
||||||
|
The recommended method is to first fork the repo, so that you have a copy that you have read/write access to. After that, it’s a simple case of cloning your fork.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone git@github.com:YOURUSERNAME/librespot.git
|
||||||
|
cd librespot
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compiling & Running
|
||||||
|
|
||||||
|
Once your build environment is setup, compiling the code is pretty simple.
|
||||||
|
|
||||||
|
### Compiling
|
||||||
|
|
||||||
|
To build a ```debug``` build with the default backend, from the project root run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo build
|
||||||
|
```
|
||||||
|
|
||||||
|
And for ```release```:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
|
You will most likely want to build debug builds when developing, as they compile faster, and more verbose, and as the name suggests, are for the purposes of debugging. When submitting a bug report, it is recommended to use a debug build to capture stack traces.
|
||||||
|
|
||||||
|
There are also a number of compiler feature flags that you can add, in the event that you want to have certain additional features also compiled. The list of these is available on the [wiki](https://github.com/librespot-org/librespot/wiki/Compiling#addition-features).
|
||||||
|
|
||||||
|
By default, librespot compiles with the ```rodio-backend``` feature. To compile without default features, you can run with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo build --no-default-features
|
||||||
|
```
|
||||||
|
|
||||||
|
Similarly, to build with the ALSA backend:
|
||||||
|
```bash
|
||||||
|
cargo build --no-default-features --features "alsa-backend"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running
|
||||||
|
|
||||||
|
Assuming you just compiled a ```debug``` build, you can run librespot with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./target/debug/librespot -n Librespot
|
||||||
|
```
|
||||||
|
|
||||||
|
There are various runtime options, documented in the wiki, and visible by running librespot with the ```-h``` argument.
|
112
CONTRIBUTING.md
112
CONTRIBUTING.md
|
@ -1,108 +1,5 @@
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
In order to contribute to librespot, you will first need to set up a suitable rust build environment, with the necessary dependenices installed. These instructions will walk you through setting up a simple build environment.
|
|
||||||
|
|
||||||
You will need to have C compiler, rust, and portaudio installed.
|
|
||||||
|
|
||||||
### Install Rust
|
|
||||||
|
|
||||||
The easiest, and recommended way to get rust setu is to use [rustup](https://rustup.rs). You can install rustup with this command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl https://sh.rustup.rs -sSf | sh
|
|
||||||
```
|
|
||||||
|
|
||||||
Follow any prompts it gives you to install rust. Once that’s done, rust is ready to use.
|
|
||||||
|
|
||||||
### Install Other Dependencies
|
|
||||||
On debian / ubuntu, the following command will install these dependencies :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt-get install build-essential portaudio19-dev
|
|
||||||
```
|
|
||||||
|
|
||||||
On Fedora systems, the following command will install these dependencies :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo dnf install portaudio-devel make gcc
|
|
||||||
```
|
|
||||||
|
|
||||||
On macOS, using homebrew :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew install portaudio
|
|
||||||
```
|
|
||||||
|
|
||||||
### Getting the Source
|
|
||||||
|
|
||||||
The recommended method is to first fork the repo, so that you have a copy that you have read/write access to. After that, it’s a simple case of git cloning.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone git@github.com:YOURUSERNAME/librespot.git
|
|
||||||
```
|
|
||||||
|
|
||||||
CD to the newly cloned repo...
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd librespot
|
|
||||||
```
|
|
||||||
|
|
||||||
### Development Extra Steps
|
|
||||||
|
|
||||||
If you are looking to carry out development on librespot:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rustup override set nightly
|
|
||||||
```
|
|
||||||
|
|
||||||
The command above overrides the default rust in the directory housing librespot to use the ```nightly``` version, as opposed to the ```stable``` version.
|
|
||||||
|
|
||||||
Then, run the command below to install [rustfmt](https://github.com/rust-lang-nursery/rustfmt) for the ```nightly``` toolchain. This is not optional, as Travis CI is set up to check that code is compliant with rustfmt.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rustup component add rustfmt-preview
|
|
||||||
```
|
|
||||||
|
|
||||||
## Compiling & Running
|
|
||||||
|
|
||||||
Once your build environment is setup, compiling the code is pretty simple.
|
|
||||||
|
|
||||||
### Compiling
|
|
||||||
|
|
||||||
To build a ```debug``` build, from the project root:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cargo build
|
|
||||||
```
|
|
||||||
|
|
||||||
And for ```release```:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cargo build --release
|
|
||||||
```
|
|
||||||
|
|
||||||
You will most likely want to build debug builds when developing, as they are faster, and more verbose, for the purposes of debugging.
|
|
||||||
|
|
||||||
There are also a number of compiler feature flags that you can add, in the event that you want to have certain additional features also compiled. The list of these is available on the [wiki](https://github.com/librespot-org/librespot/wiki/Compiling#addition-features).
|
|
||||||
|
|
||||||
By default, librespot compiles with the ```portaudio-backend``` feature. To compile without default features, you can run with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cargo build --no-default-features
|
|
||||||
```
|
|
||||||
|
|
||||||
### Running
|
|
||||||
|
|
||||||
Assuming you just compiled a ```debug``` build, you can run librespot with the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./target/debug/librespot -n Librespot
|
|
||||||
```
|
|
||||||
|
|
||||||
There are various runtime options, documented in the wiki, and visible by running librespot with the ```-h``` argument.
|
|
||||||
|
|
||||||
## Reporting an Issue
|
## Reporting an Issue
|
||||||
|
|
||||||
Issues are tracked in the Github issue tracker of the librespot repo.
|
Issues are tracked in the Github issue tracker of the librespot repo.
|
||||||
|
@ -112,7 +9,7 @@ If you have encountered a bug, please report it, as we rely on user reports to f
|
||||||
Please also make sure that your issues are helpful. To ensure that your issue is helpful, please read over this brief checklist to avoid the more common pitfalls:
|
Please also make sure that your issues are helpful. To ensure that your issue is helpful, please read over this brief checklist to avoid the more common pitfalls:
|
||||||
|
|
||||||
- Please take a moment to search/read previous similar issues to ensure you aren’t posting a duplicate. Duplicates will be closed immediately.
|
- Please take a moment to search/read previous similar issues to ensure you aren’t posting a duplicate. Duplicates will be closed immediately.
|
||||||
- Please include a clear description of what the issue is. Issues with descriptions such as ‘It hangs after 40 minutes’ will be closed immediately.
|
- Please include a clear description of what the issue is. Issues with descriptions such as ‘It hangs after 40 minutes’ will be closed immediately.
|
||||||
- Please include, where possible, steps to reproduce the bug, along with any other material that is related to the bug. For example, if librespot consistently crashes when you try to play a song, please include the Spotify URI of that song. This can be immensely helpful in quickly pinpointing and resolving issues.
|
- Please include, where possible, steps to reproduce the bug, along with any other material that is related to the bug. For example, if librespot consistently crashes when you try to play a song, please include the Spotify URI of that song. This can be immensely helpful in quickly pinpointing and resolving issues.
|
||||||
- Lastly, and perhaps most importantly, please include a backtrace where possible. Recent versions of librespot should produce these automatically when it crashes, and print them to the console, but in some cases, you may need to run ‘export RUST_BACKTRACE=full’ before running librespot to enable backtraces.
|
- Lastly, and perhaps most importantly, please include a backtrace where possible. Recent versions of librespot should produce these automatically when it crashes, and print them to the console, but in some cases, you may need to run ‘export RUST_BACKTRACE=full’ before running librespot to enable backtraces.
|
||||||
|
|
||||||
|
@ -126,14 +23,13 @@ Fork -> Fix -> PR -> Review -> Merge
|
||||||
|
|
||||||
This is how all code is added to the repository, even by those with write access.
|
This is how all code is added to the repository, even by those with write access.
|
||||||
|
|
||||||
#### Steps before Commiting
|
#### Steps before Committing
|
||||||
|
|
||||||
In order to prepare for a PR, you will need to do a couple of things first:
|
In order to prepare for a PR, you will need to do a couple of things first:
|
||||||
|
|
||||||
Make any changes that you are going to make to the code, but do not commit yet.
|
Make any changes that you are going to make to the code, but do not commit yet.
|
||||||
|
|
||||||
Make sure you are using rust ```nightly``` to build librespot. Once this is confirmed, you will need to run the following command:
|
Make sure that the code is correctly formatted by running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo fmt --all
|
cargo fmt --all
|
||||||
```
|
```
|
||||||
|
@ -150,7 +46,7 @@ Once it has built, and you have confirmed there are no warnings or errors, you s
|
||||||
git commit -a -m “My fancy fix”
|
git commit -a -m “My fancy fix”
|
||||||
```
|
```
|
||||||
|
|
||||||
**N.B.** Please, for the sake of a readable history, do not bundle multipe major changes into a single commit. Instead, break it up into multiple commits.
|
**N.B.** Please, for the sake of a readable history, do not bundle multiple major changes into a single commit. Instead, break it up into multiple commits.
|
||||||
|
|
||||||
Once you have made the commits you wish to have merged, push them to your forked repo:
|
Once you have made the commits you wish to have merged, push them to your forked repo:
|
||||||
|
|
||||||
|
|
37
README.md
37
README.md
|
@ -7,38 +7,41 @@ Current maintainer is @awiouy folks.
|
||||||
# librespot
|
# librespot
|
||||||
*librespot* is an open source client library for Spotify. It enables
|
*librespot* is an open source client library for Spotify. It enables
|
||||||
applications to use Spotify's service, without using the official but
|
applications to use Spotify's service, without using the official but
|
||||||
closed-source libspotify. Additionally, it will provide extra features
|
closed-source `libspotify`. Additionally, it will provide extra features
|
||||||
which are not available in the official library.
|
which are not available in the official library.
|
||||||
|
|
||||||
_Note: librespot only works with Spotify Premium. This will remain the case for the forseeable future, as we are unlikely to work on implementing the features such as limited skips and adverts that would be required to make librespot compliant with free accounts._
|
_Note: librespot only works with Spotify Premium. This will remain the case for the foreseeable future, as we are unlikely to work on implementing the features such as limited skips and adverts that would be required to make librespot compliant with free accounts._
|
||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
We're available on [crates.io](https://crates.io/crates/librespot) as the _librespot_ package. Simply run `cargo install librespot` to install librespot on your system. Check the wiki for more info and possible [usage options](https://github.com/librespot-org/librespot/wiki/Options).
|
We're available on [crates.io](https://crates.io/crates/librespot) as the _librespot_ package. Simply run `cargo install librespot` to install librespot on your system. Check the wiki for more info and possible [usage options](https://github.com/librespot-org/librespot/wiki/Options).
|
||||||
|
|
||||||
After installation, you can run librespot form the CLI using a command such as `librespot -n "Librespot Speaker" -b 160` to create a speaker called _Librespot Speaker_ serving 160kbps audio.
|
After installation, you can run librespot from the CLI using a command such as `librespot -n "Librespot Speaker" -b 160` to create a speaker called _Librespot Speaker_ serving 160kbps audio.
|
||||||
|
|
||||||
## This fork
|
## This fork
|
||||||
As the origin by [plietar](https://github.com/plietar/) is no longer actively maintained, this organisation and repository have been set up so that the project may be maintained and upgraded in the future.
|
As the origin by [plietar](https://github.com/plietar/) is no longer actively maintained, this organisation and repository have been set up so that the project may be maintained and upgraded in the future.
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
Documentation is currently a work in progress.
|
Documentation is currently a work in progress, contributions are welcome!
|
||||||
|
|
||||||
There is some brief documentation on how the protocol works in the [docs](https://github.com/librespot-org/librespot/tree/master/docs) folder, and more general usage and compilation information is available on the [wiki](https://github.com/librespot-org/librespot/wiki).
|
There is some brief documentation on how the protocol works in the [docs](https://github.com/librespot-org/librespot/tree/master/docs) folder,
|
||||||
|
|
||||||
[CONTRIBUTING.md](https://github.com/librespot-org/librespot/blob/master/CONTRIBUTING.md) also contains detailed instructions on setting up a development environment, compilation, and contributing guidelines.
|
[COMPILING.md](https://github.com/librespot-org/librespot/blob/master/COMPILING.md) contains detailed instructions on setting up a development environment, and compiling librespot. More general usage and compilation information is available on the [wiki](https://github.com/librespot-org/librespot/wiki).
|
||||||
|
[CONTRIBUTING.md](https://github.com/librespot-org/librespot/blob/master/CONTRIBUTING.md) also contains our contributing guidelines.
|
||||||
|
|
||||||
If you wish to learn more about how librespot works overall, the best way is to simply read the code, and ask any questions you have in the Gitter chat linked above.
|
If you wish to learn more about how librespot works overall, the best way is to simply read the code, and ask any questions you have in our [Gitter Room](https://gitter.im/librespot-org/spotify-connect-resources).
|
||||||
|
|
||||||
# Issues
|
# Issues
|
||||||
|
|
||||||
If you run into a bug when using librespot, please search the existing issues before opening a new one. Chances are, we've encountered it before, and have provided a resolution. If not, please open a new one, and where possible, include the backtrace librespot generates on crashing, along with anything we can use to reproduce the issue, eg. the Spotify URI of the song that caused the crash.
|
If you run into a bug when using librespot, please search the existing issues before opening a new one. Chances are, we've encountered it before, and have provided a resolution. If not, please open a new one, and where possible, include the backtrace librespot generates on crashing, along with anything we can use to reproduce the issue, eg. the Spotify URI of the song that caused the crash.
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
Rust 1.32.0 or later is required to build librespot.
|
A quick walk through of the build process is outlined here, while a detailed compilation guide can be found [here](https://github.com/librespot-org/librespot/blob/master/COMPILING.md).
|
||||||
|
|
||||||
We recently switched to using [Rodio](https://github.com/tomaka/rodio) for audio playback by default, hence for macOS and Windows, you should just be able to clone and build librespot (with the command below). For linux, you will need to run the additional commands below, depending on your distro.
|
## Additional Dependencies
|
||||||
|
We recently switched to using [Rodio](https://github.com/tomaka/rodio) for audio playback by default, hence for macOS and Windows, you should just be able to clone and build librespot (with the command below).
|
||||||
|
For Linux, you will need to run the additional commands below, depending on your distro.
|
||||||
|
|
||||||
On debian / ubuntu, the following command will install these dependencies :
|
On Debian/Ubuntu, the following command will install these dependencies :
|
||||||
```shell
|
```shell
|
||||||
sudo apt-get install build-essential libasound2-dev
|
sudo apt-get install build-essential libasound2-dev
|
||||||
```
|
```
|
||||||
|
@ -48,7 +51,19 @@ On Fedora systems, the following command will install these dependencies :
|
||||||
sudo dnf install alsa-lib-devel make gcc
|
sudo dnf install alsa-lib-devel make gcc
|
||||||
```
|
```
|
||||||
|
|
||||||
Once you've cloned this repository you can build *librespot* using `cargo`.
|
librespot currently offers the a selection of [audio backends](https://github.com/librespot-org/librespot/wiki/Audio-Backends).
|
||||||
|
```
|
||||||
|
Rodio (default)
|
||||||
|
ALSA
|
||||||
|
PortAudio
|
||||||
|
PulseAudio
|
||||||
|
JACK
|
||||||
|
SDL
|
||||||
|
Pipe
|
||||||
|
```
|
||||||
|
Please check the corresponding [compiling entry](https://github.com/librespot-org/librespot/wiki/Compiling#general-dependencies) for backend specific dependencies.
|
||||||
|
|
||||||
|
Once you've installed the dependencies and cloned this repository you can build *librespot* with the default backend using Cargo.
|
||||||
```shell
|
```shell
|
||||||
cargo build --release
|
cargo build --release
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue