spotifyd icon indicating copy to clipboard operation
spotifyd copied to clipboard

Windows support

Open JCapucho opened this issue 4 years ago • 24 comments

This PR allows spotifyd to run on windows as non-daemon and daemon-like, only the rodio-backend is supported and the config file is stored on:

%AppData%/Roaming/spotifyd/spotifyd.conf

All output is logged into a .spotifyd.log file on windows when running in both non-daemon and daemon mode although in daemon mode the startup is logged to the console before a detached subprocess with the same binary and arguments (with the exception that the argument --no-daemon is set) is started

JCapucho avatar Jun 11 '20 18:06 JCapucho

As this is (compared to other PRs) larger change I'll add it to the v1 milestone for now. This doesn't mean however that it won't get merged beforehand.

mainrs avatar Jun 11 '20 20:06 mainrs

This seems to work perfectly fine on windows, just needs a rebase.

MartB avatar Jun 15 '20 15:06 MartB

I rebased the branch and improved the logging now --no-daemon will use the terminal and the daemon will use the file but the file will be stored next to the config file instead of the current working directory this makes it easier to use windows services

JCapucho avatar Jun 17 '20 11:06 JCapucho

Thanks for that! I will merge this after I can update the librespot dependency. I will take a closer look at it then and do a proper code review. I just skimmed through it for now.

mainrs avatar Jun 17 '20 11:06 mainrs

Just want to add that there's currently a runtime dependency on libogg (from with-tremor), and I wouldn't expect to find it on most windows systems. Users will have to do something about this if they want to use spotifyd.

Edit: Skimmed through the implementation, and it looks like tremor and libogg are alternatives to lewton. Is there a reason we couldn't switch to the Rust implementation?

Plecra avatar Sep 25 '20 13:09 Plecra

Also, why aren't we using the windows services API for this? It seems to fit the role best.

Plecra avatar Sep 27 '20 09:09 Plecra

I'm longer working on this and don't plan on working on it since I finally got rid of windows on the last machine I used that had it, if my memory is right I didn't use services because they are hard to get right and require special permissions while this method doesn't

JCapucho avatar Sep 27 '20 13:09 JCapucho

Tried this out today. Seems to work well so far... Found one Issue: When I switch the audio output devices while spotifyd is running it keeps playing on the old device. Tested on latest Windows 10

ekx avatar Sep 30 '20 19:09 ekx

A small issue I ran into is that I can't get the password_cmd option to work on windows. Other than that it is working fine for me :+1:

CptPotato avatar Oct 03 '20 09:10 CptPotato

Seems that on Windows (10) the following commands work:

cargo build --release --no-default-features --features rodio_backend cargo run --no-default-features --features rodio_backend

And this PR will build/run completely fine. However, it's not currently possible to install it using:

cargo install --path . --locked cargo install --path . --locked --no-default-features --features rodio_backend

As it complains about:

error: failed to run custom build command for 'alsa-sys v0.1.2'

Which suggests to me it's ignoring the rodio_backend build flag.

Runeii avatar Oct 05 '20 08:10 Runeii

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 13 '21 14:01 stale[bot]

Why is this dead? This is a great feature. I want to have spotify running HQ, without the desktop client.

zoeleu avatar Mar 06 '21 14:03 zoeleu

Hi, just want to express my support for getting this pr in. It would be really cool to get a lightweight spotify client for windows.

Brin-o avatar Mar 08 '21 12:03 Brin-o

I can confirm that with a bit of finagling, the code from the PR branch runs on Windows 8.1 To be clear, this means that the working build I have is based off the version 0.2.24 codebase, and not a more recent version with JCapucho's changes patched in; I don't know if simply applying the changes to the current codebase would yield a working build, and I didn't particularly need anything from the 3.0.x release, so I never tried.

I found that I had to specify limited version ranges for librespot, protobuf-codegen, and protobuf-codegen-pure in Cargo.toml

[dependencies.librespot]
version = ">= 0.1.1, < 0.1.2"
default-features = false
features = ["with-tremor"]

[build-dependencies.protobuf-codegen]
version = "~2.8.1, < 2.9.0"

[build-dependencies.protobuf-codegen-pure]
version = "~2.8.1, < 2.9.0"

I think I might have also needed to manually update the manifest and lockfiles for librespot accordingly, and build it with --features="rodio-backend,with-tremor", but its been several weeks and its not clear from my command history if I did or not.

I definitely had to regenerate/update the lockfile for spotifyd itself, making sure that it listed acceptable versions for protobuf-codegen, protobuf-codegen-pure, and the various librespot crates. I probably did that with cargo generate-lockfile --offline, but again, my command history doesn't indicate whether or not I did it by hand.

To build spotifyd, I had to use the MSVC toolchain rather than GNU toolchain, as I found that no matter what I did, the latter either failed to build, built an executable that simply didn't work, or built an executable I couldn't run; your results may differ. The actual command I used is rustup run 1.47.0-x86_64-pc-windows-msvc cargo build --release --no-default-features --features="rodio_backend" --manifest ~/.cargo/git/checkouts/spotifyd-36f4565cca355e0b/d119fc3/Cargo.toml. It may or may not also be possible with the right setup to build and run with the dbus_keyring and/or dbus_mpris features, but I didn't attempt that because just getting spotifyd to run at all was enough for me.

StaticPH avatar Mar 08 '21 18:03 StaticPH

What needs to be done to get this merged?

vincenttermaat avatar Jun 20 '21 22:06 vincenttermaat

It should atleast be updated to the current master.

robinvd avatar Jun 21 '21 11:06 robinvd

Hi there, any help needed here? Would love to run this daemon on Windows. Thanks for working on this.

lamaland avatar Sep 06 '21 09:09 lamaland

I am using librespot instead

vincenttermaat avatar Sep 06 '21 09:09 vincenttermaat

Is this PR still active?

CypherpunkSamurai avatar Dec 10 '21 08:12 CypherpunkSamurai

Is something known?

DomingoMG avatar Feb 27 '22 19:02 DomingoMG

I believe it is currently preferred to use librespot (which was linked three comments above)

Katzenwerfer avatar Feb 27 '22 19:02 Katzenwerfer

I built this, and after playing with it for a bit, managed to get it to work. For anyone on Windows that is getting:

Caught panic with message: attempted to zero-initialize type `librespot_tremor::tremor_sys::ov_callbacks`, which is invalid

Remove librespot's with-tremor feature flag in Cargo.toml Specifically the 2nd thing here: https://github.com/Spotifyd/spotifyd/issues/719#issuecomment-774727927 The other methods of getting it to work did not work for me Can someone please rebase this already, so that we don't have to do these annoying workarounds?

brian6932 avatar Mar 05 '22 01:03 brian6932

@Katzenwerfer @DomingoMG @CypherpunkSamurai This PR is fairly old, and has merge conflicts which aren't resolved, plus the author has already disclaimed it. Finally, I'm not sure any maintainer uses Windows to test this.

If someone could get this into a working, mergeable state, I may be able to throw together a Windows box to try it.

slondr avatar Mar 11 '22 02:03 slondr

We need two reviews for this PR to pass. I'll try cloning the branch and testing it out. If anyone else got time please do.

CypherpunkSamurai avatar Aug 21 '22 06:08 CypherpunkSamurai

@RakeshChowdhury As has been pointed out in this comment, this PR currently is not mergeable and - up until now - no one has stepped up to fix the conflicts. So unless someone with interest shows up to get it working, this PR is unfortunately not going to happen. :/

eladyn avatar Apr 29 '23 15:04 eladyn

My branch here https://github.com/BKasin/spotifyd/tree/windows is rebased against the current commit of master, and seems to be working. Config file paths could definitely be handled better, and I'll have to research windows daemons/services if a better solution for that is desired. But as things stand it seems to work completely fine.


What is the preferred way for me to handle getting that branch ready? Should I open a PR or should this one be re-targeted?

image

catumin avatar Aug 25 '23 07:08 catumin

@BKasin thank you for working on this! I haven't had a look yet, but opening a new PR seems like the easiest way forward. I'm currently not at home (and won't be for some time), but I'll try to at least give feedback an answer any questions you have.

eladyn avatar Aug 30 '23 09:08 eladyn

@eladyn can probably close this now that #1219 is merged.

catumin avatar Oct 20 '23 04:10 catumin