Skip to content

Commit

Permalink
fix: add missing attribute on player_windows
Browse files Browse the repository at this point in the history
  • Loading branch information
srevinsaju committed Feb 26, 2022
1 parent 16de9fb commit 9c6270d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scrob-core/src/player/player_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::Duration;
use std::time::SystemTime;
use windows::Media::Control::GlobalSystemMediaTransportControlsSessionManager as MediaManager;
use windows::Media::Control::GlobalSystemMediaTransportControlsSessionPlaybackStatus as MediaStatus;
use windows::Media::MediaTimelineController;


/// Uses the winrt api to get access the media player data.
pub fn get_current_song() -> Result<Song, &'static str> {
Expand Down Expand Up @@ -54,8 +54,10 @@ pub fn get_current_song() -> Result<Song, &'static str> {
}

let mut source = Players::GenericMusicPlayer;
let mut app_id = "";
if let Ok(origin) = current_session.SourceAppUserModelId() {
let origin = origin.to_string();
app_id = origin;
trace!("Detected song from '{}'", origin);
if origin.starts_with("Microsoft.ZuneMusic") {
source = Players::GrooveMusic
Expand All @@ -73,6 +75,7 @@ pub fn get_current_song() -> Result<Song, &'static str> {
.expect("Failed to unwrap song metadata even if retrieval was successful.");

let song = Song {
app_id: app_id,
track: song_metadata
.Title()
.expect("Failed to retrieve title from song")
Expand Down

0 comments on commit 9c6270d

Please sign in to comment.