예제 #1
0
 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);
     }));
 }
예제 #2
0
 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);
 }
예제 #3
0
        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));
        }
예제 #4
0
 public override System.Threading.Tasks.Task <bool> AddToLibrary(MusicPlayer.Models.Track track)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public override System.Threading.Tasks.Task <bool> SetRating(MusicPlayer.Models.Track track, int rating)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 public override System.Threading.Tasks.Task <MusicPlayer.Models.RadioStation> CreateRadioStation(string name, MusicPlayer.Models.Track track)
 {
     throw new NotImplementedException();
 }
예제 #7
0
 public override System.Threading.Tasks.Task <MusicPlayer.Models.DownloadUrlData> GetDownloadUri(MusicPlayer.Models.Track track)
 {
     throw new NotImplementedException();
 }
예제 #8
0
 public override async System.Threading.Tasks.Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track)
 {
     return(new Uri(track.FileLocation));
 }
예제 #9
0
 public override async Task <bool> AddToLibrary(MusicPlayer.Models.Track track)
 {
     App.ShowNotImplmented();
     return(false);
 }
예제 #10
0
 public override async Task <MusicPlayer.Models.RadioStation> CreateRadioStation(string name, MusicPlayer.Models.Track track)
 {
     App.ShowNotImplmented();
     return(null);
 }
예제 #11
0
 public override async Task <MusicPlayer.Models.DownloadUrlData> GetDownloadUri(MusicPlayer.Models.Track track)
 {
     App.ShowNotImplmented();
     return(null);
 }
예제 #12
0
        public override async Task <MusicPlayer.Models.DownloadUrlData> GetDownloadUri(MusicPlayer.Models.Track track)
        {
            var result = await Api.GetTemporaryUrl(track.Id);

            return(new DownloadUrlData {
                Url = result
            });
        }
예제 #13
0
        public override async System.Threading.Tasks.Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track)
        {
            var result = await Api.GetTemporaryUrl(track.Id);

            return(new Uri(result));
        }
예제 #14
0
        public override async Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track)
        {
            var uri = new Uri(track.FileLocation).AbsoluteUri;

            return(new Uri(uri));
        }