Skip to content

Commit

Permalink
account for upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Sep 30, 2024
1 parent e97eb43 commit b065c8a
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 18 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build_librespot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build Librespot (with mass patches) for all platforms

on:
push:
branches: [mass]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
macOS:
runs-on: macos-11.0

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust support for ARM64 & prepare environment
run: |
rustup target add aarch64-apple-darwin
mkdir releases
- name: Build
run: |
cargo build --release --no-default-features --features "passthrough-decoder"
cargo build --target=aarch64-apple-darwin --release --no-default-features --features "passthrough-decoder"
- name: Build fat binary
run: |
lipo -create \
-arch x86_64 target/release/librespot \
-arch arm64 target/aarch64-apple-darwin/release/librespot \
-output releases/librespot-macos-arm64
chmod +x releases/librespot-macos-arm64
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: librespot-mac
path: releases/

Linux:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare build environment
run: |
rustup target add x86_64-unknown-linux-musl
rustup target add i686-unknown-linux-musl
curl -L https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz | tar xvz
mkdir -p releases/linux
- name: "Install musl-tools to provide musl-gcc"
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: "musl-tools"
version: "1.0"

- name: Build x86_64
run: |
cargo build --release --no-default-features --features "passthrough-decoder" --target=x86_64-unknown-linux-musl
cp target/x86_64-unknown-linux-musl/release/librespot releases/linux/librespot-linux-x86_64
chmod +x releases/linux/librespot-linux-x86_64
- name: Build ARMv8
run: |
./cross build --release --no-default-features --features "passthrough-decoder" --target=aarch64-unknown-linux-musl
cp target/aarch64-unknown-linux-musl/release/librespot releases/linux/librespot-linux-aarch64
chmod +x releases/linux/librespot-linux-aarch64
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: librespot-linux
path: releases/
24 changes: 6 additions & 18 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ fn get_setup() -> Setup {
const ONEVENT: &str = "onevent";
#[cfg(feature = "passthrough-decoder")]
const PASSTHROUGH: &str = "passthrough";
const PASSWORD: &str = "password";
const PROXY: &str = "proxy";
const QUIET: &str = "quiet";
const SYSTEM_CACHE: &str = "system-cache";
Expand Down Expand Up @@ -312,7 +313,7 @@ fn get_setup() -> Setup {
const ONEVENT_SHORT: &str = "o";
#[cfg(feature = "passthrough-decoder")]
const PASSTHROUGH_SHORT: &str = "P";
const TOKEN_SHORT: &str = "k";
const PASSWORD_SHORT: &str = "p";
const EMIT_SINK_EVENTS_SHORT: &str = "Q";
const QUIET_SHORT: &str = "q";
const INITIAL_VOLUME_SHORT: &str = "R";
Expand Down Expand Up @@ -501,10 +502,10 @@ fn get_setup() -> Setup {
"USERNAME",
)
.optopt(
TOKEN_SHORT,
TOKEN,
"Spotify access token to sign in with. Use empty string to obtain token.",
"TOKEN",
PASSWORD_SHORT,
PASSWORD,
"Password used to sign in with.",
"PASSWORD",
)
.optopt(
ACCESS_TOKEN_SHORT,
Expand Down Expand Up @@ -1479,19 +1480,6 @@ fn get_setup() -> Setup {
..SessionConfig::default()
};

let credentials = {
let cached_creds = cache.as_ref().and_then(Cache::credentials);

if let Some(mut access_token) = opt_str(TOKEN) {
Some(Credentials::with_access_token(access_token))
} else {
if cached_creds.is_some() {
trace!("Using cached credentials.");
}
cached_creds
}
};

let enable_discovery = !opt_present(DISABLE_DISCOVERY);

if credentials.is_none() && !enable_discovery {
Expand Down

0 comments on commit b065c8a

Please sign in to comment.