muammar / mkchromecast

Cast macOS and Linux Audio/Video to your Google Cast and Sonos Devices
http://mkchromecast.com
Other
2.19k stars 135 forks source link

Show current track #198

Open brantlk opened 6 years ago

brantlk commented 6 years ago

Would be nice if the app monitored the system to see what track is playing and send that to the cast device. I'm using Amarok on Kubuntu.

https://developers.google.com/cast/docs/reference/messages#MusicTrackMediaMetadata

$ pacmd list-sink-inputs
1 sink input(s) available.
    index: 56
        driver: <protocol-native.c>
        flags: START_CORKED 
        state: CORKED
        sink: 0 <alsa_output.pci-0000_00_1f.3.analog-stereo>
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 190.63 ms
        requested latency: 90.00 ms
        sample spec: s16le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        resample method: (null)
        module: 10
        client: 111 <Amarok>
        properties:
                phonon.streamid = "{8cec3801-29c5-480c-aed7-0cb8d2278c15}"
                media.role = "music"
                media.name = "'Wild Horses' by 'The Rolling Stones'"
                application.name = "Amarok"
                native-protocol.peer = "UNIX socket client"
                native-protocol.version = "32"
                application.version = "2.8.0"
                application.icon_name = "amarok"
                application.process.id = "1945"
                application.process.user = "blk"
                application.process.host = "blk-ThinkPad-P51s"
                application.process.binary = "amarok"
                application.language = "en_US.UTF-8"
                window.x11.display = ":0"
                application.process.machine_id = "0d93944408954d8db728b3f442d66ceb"
                application.process.session_id = "1"
                module-stream-restore.id = "sink-input-by-media-role:music"
                media.title = "Wild Horses"
                media.artist = "The Rolling Stones"
muammar commented 6 years ago

I was thinking of implementing something like that, but the big problem would be to have a standard way of getting name's song from popular music players. An example with Spotify installed with snap on Debian unstable:

muammar@nuc ~ 
  % pacmd list-sink-inputs                                               !10025
1 sink input(s) available.
    index: 70
    driver: <protocol-native.c>
    flags: START_CORKED 
    state: RUNNING
    sink: 12 <alsa_output.pci-0000_00_1f.3.analog-stereo>
    volume: front-left: 12511 /  19% / -43.15 dB,   front-right: 12511 /  19% / -43.15 dB
            balance 0.00
    muted: no
    current latency: 496.62 ms
    requested latency: 980.00 ms
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    resample method: (null)
    module: 7
    client: 90 <spotify>
    properties:
        media.role = "music"
        media.name = "Spotify"
        application.name = "spotify"
        native-protocol.peer = "UNIX socket client"
        native-protocol.version = "30"
        application.process.id = "6437"
        application.process.user = "muammar"
        application.process.host = "nuc"
        application.process.binary = "spotify"
        window.x11.display = ":0"
        application.language = "en_US.UTF-8"
        application.process.machine_id = "ab941b248d584d09a4ef98167d9cded3"
        application.process.session_id = "2"
        module-stream-restore.id = "sink-input-by-media-role:music"