Nerixyz / current-song2

Display the currently playing song/audio.
https://currentsong.nerixyz.de
85 stars 7 forks source link

Include filter for Spotify.exe not working #434

Open ex0tiq opened 4 months ago

ex0tiq commented 4 months ago

Got everything setup how I need it, however I can't get the filter config option to work. I want it to only show the music playing on Spotify.

I've tried both Include and Exclude modes with corresponding settings

mode = "Include"
items = ["Spotify.exe"]

or

mode = "Exclude"
items = ["msedge.exe","chrome.exe","firefox.exe"]

However when I use the Include mode with this settings, nothing gets recognized at all (no Spotify, Firefox, etc.). And when I use the Exclude mode it still recognizes output from Firefox.

I'm on Windows 11 22H2 (Build 22621.3447) with Spotify 1.2.35.663.gb699649e. Any idea what I'm doing wrong?

Nerixyz commented 4 months ago

That's really weird. I noticed that sometimes GSMTC (the underlying API the app uses) fails to recognize Spotify, which is why I opened https://github.com/Nerixyz/current-song2/pull/300.

If you have a Rust compiler, you can try to see if GSMTC recognizes Spotify by cloning this repo and running

cargo r -p win-gsmtc --example basic

This should output all events from all recognized apps.

ex0tiq commented 4 months ago

Thanks for the fast response :) That command results in the following output. Looks to me like Spotify is recognized as a Chromium process?

Created session: {id=0, source=Chromium.T4VOCGBXUNT2JS247C26TRJJY4}
Current session: 0
[0/Chromium.T4VOCGBXUNT2JS247C26TRJJY4] Model updated: SessionModel {
    playback: Some(
        PlaybackModel {
            status: Playing,
            type: Music,
            rate: 1.0,
            shuffle: false,
            auto_repeat: List,
        },
    ),
    timeline: None,
    media: None,
    source: "Chromium.T4VOCGBXUNT2JS247C26TRJJY4",
}
[0/Chromium.T4VOCGBXUNT2JS247C26TRJJY4] Model updated: SessionModel {
    playback: Some(
        PlaybackModel {
            status: Playing,
            type: Music,
            rate: 1.0,
            shuffle: false,
            auto_repeat: List,
        },
    ),
    timeline: Some(
        TimelineModel {
            start: 0ns,
            end: 175.803s,
            position: 31.638s,
            last_updated_at_ms: 1713702137714,
        },
    ),
    media: None,
    source: "Chromium.T4VOCGBXUNT2JS247C26TRJJY4",
}
[0/Chromium.T4VOCGBXUNT2JS247C26TRJJY4] Media updated: SessionModel {
    playback: Some(
        PlaybackModel {
            status: Playing,
            type: Music,
            rate: 1.0,
            shuffle: false,
            auto_repeat: List,
        },
    ),
    timeline: Some(
        TimelineModel {
            start: 0ns,
            end: 175.803s,
            position: 31.638s,
            last_updated_at_ms: 1713702137714,
        },
    ),
    media: Some(
        MediaModel {
            title: "For Life (feat. Nile Rodgers)",
            subtitle: "",
            artist: "Kygo",
            album: Some(
                AlbumModel {
                    artist: "Kygo",
                    title: "For Life (feat. Nile Rodgers)",
                    track_count: 0,
                },
            ),
            track_number: Some(
                1,
            ),
            genres: [],
            playback_type: Music,
        },
    ),
    source: "Chromium.T4VOCGBXUNT2JS247C26TRJJY4",
} - Some(Image { content_type: "image/png" })
Nerixyz commented 4 months ago

That's weird. Do you know if you're using the MS-store version or the "regular" version? Afaik, the store version has some other ID. I've tested it on Spotify for Windows (64 bit) 1.2.34.783.g923721d9 and 1.2.35.663.gb699649e.

One more reason for NPSM is that it has access to the raw HWND.

ex0tiq commented 4 months ago

As far as I'm aware I have the "regular" version. I've installed it with winget (winget install Spotify.Spotify) which, as far as I'm aware, should have installed the regular, non MS-Store version. Should I install the version directly from their website?

Any idea when NPSM is ready for deployment :D ? In exclude mode it works as it should, but it is annoying that when I run something else in firefox, that it shows that as well as soon as the track on Spotify is paused.

Nerixyz commented 4 months ago

Any idea when NPSM is ready for deployment :D ?

It will likely take some time. I have the definitions locally but haven't integrated it yet.

In exclude mode it works as it should, but it is annoying that when I run something else in firefox, that it shows that as well as soon as the track on Spotify is paused.

You should be able to use Chromium.T4VOCGBXUNT2JS247C26TRJJY4 to in-/exclude apps for now (I assume this won't change).

ex0tiq commented 4 months ago

Oh... you are absolutely right. Using this identifier as include as well it works as it should... could have thought of that myself facepalm

mode = "Include"
items = ["Spotify.exe","Chromium.T4VOCGBXUNT2JS247C26TRJJY4"]

My issue is resolved with this :)

Nerixyz commented 4 months ago

I'll keep this open to track this version of Spotify.