public override Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track) { return(Task.Run(() => { var query = MPMediaQuery.SongsQuery; NSNumber songId = UInt64.Parse(track.Id); MPMediaPropertyPredicate predicate = MPMediaPropertyPredicate.PredicateWithValue(songId, MPMediaItem.PersistentIDProperty); query.AddFilterPredicate(predicate); var s = query.Items.FirstOrDefault(); var url = s?.AssetURL?.AbsoluteString; return url == null ? null : new Uri(url); })); }
public override async Task <bool> SetRating(MusicPlayer.Models.Track track, int rating) { using (TagLib.File file = TagLib.File.Create(track.FileLocation)) { TagLib.Tag Tag = file.GetTag(TagLib.TagTypes.Id3v2); TagLib.Id3v2.Tag.DefaultVersion = 3; TagLib.Id3v2.Tag.ForceDefaultVersion = true; var frame = TagLib.Id3v2.PopularimeterFrame.Get((TagLib.Id3v2.Tag)Tag, "WindowsUser", true); //based on 0-5; //taglib sharp is 0-255; frame.Rating = (byte)(rating * 51); file.Save(); } return(true); }
public override async Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track) { string filePath = ""; if (!string.IsNullOrEmpty(track.FileLocation) && File.Exists(track.FileLocation)) { filePath = track.FileLocation; } filePath = Directory.EnumerateFiles(musicPath, track.FileName, SearchOption.AllDirectories).FirstOrDefault(); var uri = new Uri(filePath).AbsoluteUri; return(new Uri(uri)); }
public override System.Threading.Tasks.Task <bool> AddToLibrary(MusicPlayer.Models.Track track) { throw new NotImplementedException(); }
public override System.Threading.Tasks.Task <bool> SetRating(MusicPlayer.Models.Track track, int rating) { throw new NotImplementedException(); }
public override System.Threading.Tasks.Task <MusicPlayer.Models.RadioStation> CreateRadioStation(string name, MusicPlayer.Models.Track track) { throw new NotImplementedException(); }
public override System.Threading.Tasks.Task <MusicPlayer.Models.DownloadUrlData> GetDownloadUri(MusicPlayer.Models.Track track) { throw new NotImplementedException(); }
public override async System.Threading.Tasks.Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track) { return(new Uri(track.FileLocation)); }
public override async Task <bool> AddToLibrary(MusicPlayer.Models.Track track) { App.ShowNotImplmented(); return(false); }
public override async Task <MusicPlayer.Models.RadioStation> CreateRadioStation(string name, MusicPlayer.Models.Track track) { App.ShowNotImplmented(); return(null); }
public override async Task <MusicPlayer.Models.DownloadUrlData> GetDownloadUri(MusicPlayer.Models.Track track) { App.ShowNotImplmented(); return(null); }
public override async Task <MusicPlayer.Models.DownloadUrlData> GetDownloadUri(MusicPlayer.Models.Track track) { var result = await Api.GetTemporaryUrl(track.Id); return(new DownloadUrlData { Url = result }); }
public override async System.Threading.Tasks.Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track) { var result = await Api.GetTemporaryUrl(track.Id); return(new Uri(result)); }
public override async Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track) { var uri = new Uri(track.FileLocation).AbsoluteUri; return(new Uri(uri)); }