Exemplo n.º 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);
     }));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
 public override System.Threading.Tasks.Task <bool> AddToLibrary(MusicPlayer.Models.Track track)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
 public override System.Threading.Tasks.Task <bool> SetRating(MusicPlayer.Models.Track track, int rating)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 public override System.Threading.Tasks.Task <MusicPlayer.Models.RadioStation> CreateRadioStation(string name, MusicPlayer.Models.Track track)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public override System.Threading.Tasks.Task <MusicPlayer.Models.DownloadUrlData> GetDownloadUri(MusicPlayer.Models.Track track)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
 public override async System.Threading.Tasks.Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track)
 {
     return(new Uri(track.FileLocation));
 }
Exemplo n.º 9
0
 public override async Task <bool> AddToLibrary(MusicPlayer.Models.Track track)
 {
     App.ShowNotImplmented();
     return(false);
 }
Exemplo n.º 10
0
 public override async Task <MusicPlayer.Models.RadioStation> CreateRadioStation(string name, MusicPlayer.Models.Track track)
 {
     App.ShowNotImplmented();
     return(null);
 }
Exemplo n.º 11
0
 public override async Task <MusicPlayer.Models.DownloadUrlData> GetDownloadUri(MusicPlayer.Models.Track track)
 {
     App.ShowNotImplmented();
     return(null);
 }
Exemplo n.º 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
            });
        }
Exemplo n.º 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));
        }
Exemplo n.º 14
0
        public override async Task <Uri> GetPlaybackUri(MusicPlayer.Models.Track track)
        {
            var uri = new Uri(track.FileLocation).AbsoluteUri;

            return(new Uri(uri));
        }