Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="aObject">
 /// A <see cref="Upnp.upnpObject"/>
 /// </param>
 public void SetItem(Upnp.upnpObject aObject)
 {
     if (iConnection != null)
     {
         iConnection.Cancel();
         iConnection = null;
     }
     if (aObject != null)
     {
         Uri uri = DidlLiteAdapter.ArtworkUri(aObject);
         if (uri != null)
         {
             NSUrl        url     = new NSUrl(iUriConverter.Convert(uri.AbsoluteUri));
             NSUrlRequest request = new NSUrlRequest(url);
             iConnection = new NSUrlConnection(request, new Delegate(this), true);
         }
         else
         {
             SetImage(KinskyTouch.Properties.ResourceManager.Loading);
         }
     }
     else
     {
         SetImage(KinskyTouch.Properties.ResourceManager.Loading);
     }
 }
Example #2
0
        public Upnp.upnpObject GetUpnpMusicTrack(OptionPageSetup aUserOptionsSetup, HelperKinskyJukebox aHelper)
        {
            Upnp.upnpObject upnpMusicTrack = null;

            if (DiscCount > 0)
            {
                upnpMusicTrack = new Upnp.musicTrack();
            }
            else
            {
                upnpMusicTrack = new Upnp.musicTrack();
            }
            upnpMusicTrack.Id    = FilePath;
            upnpMusicTrack.Title = Title;
            ((Upnp.musicTrack)upnpMusicTrack).Album.Add(Album);
            ((Upnp.musicTrack)upnpMusicTrack).Genre.Add(Genre);
            ((Upnp.musicTrack)upnpMusicTrack).OriginalTrackNumber = (int)Track;
            if (upnpMusicTrack is Upnp.musicTrack)
            {
                ((Upnp.musicTrack)upnpMusicTrack).OriginalDiscNumber = (int)Disc;
                ((Upnp.musicTrack)upnpMusicTrack).OriginalDiscCount  = (int)DiscCount;
            }
            ((Upnp.musicTrack)upnpMusicTrack).Date = Year;

            Upnp.artist performer = new Upnp.artist();
            performer.Artist = Artist;
            performer.Role   = "Performer";
            ((Upnp.musicTrack)upnpMusicTrack).Artist.Add(performer);

            Upnp.artist composer = new Upnp.artist();
            composer.Role   = "Composer";
            composer.Artist = Composer;
            ((Upnp.musicTrack)upnpMusicTrack).Artist.Add(composer);

            Upnp.artist albumArtist = new Upnp.artist();
            albumArtist.Artist = AlbumArtist;
            albumArtist.Role   = "AlbumArtist";
            ((Upnp.musicTrack)upnpMusicTrack).Artist.Add(albumArtist);

            Upnp.artist conductor = new Upnp.artist();
            conductor.Artist = Conductor;
            conductor.Role   = "Conductor";
            ((Upnp.musicTrack)upnpMusicTrack).Artist.Add(conductor);

            Upnp.resource resource = new Upnp.resource();
            resource.Duration     = Duration;
            resource.Uri          = GetUri(FilePath, aHelper);
            resource.ProtocolInfo = "http-get:*:" + MimeType + ":*";
            upnpMusicTrack.Res.Add(resource);

            try {
                string art = GetUri(AlbumArtPath, aHelper);
                upnpMusicTrack.AlbumArtUri.Add(art);
                upnpMusicTrack.ArtworkUri.Add(art);
            }
            catch (Exception) { // if AlbumArtPath is invalid, just don't add artwork
            }

            return(upnpMusicTrack);
        }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="aObject">
 /// A <see cref="Upnp.upnpObject"/>
 /// </param>
 public void SetMetatext(Upnp.upnpObject aObject)
 {
     if (aObject != null)
     {
         iMetatext  = DidlLiteAdapter.Title(aObject);
         iMetatext2 = string.Empty;
     }
 }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="aObject">
 /// A <see cref="Upnp.upnpObject"/>
 /// </param>
 public void SetItem(Upnp.upnpObject aObject)
 {
     if (aObject != null)
     {
         iTitle     = DidlLiteAdapter.Title(aObject);
         iMetatext  = DidlLiteAdapter.Album(aObject);
         iMetatext2 = DidlLiteAdapter.Artist(aObject);
     }
     else
     {
         iTitle     = string.Empty;
         iMetatext  = string.Empty;
         iMetatext2 = string.Empty;
     }
 }
Example #5
0
        public TrackMetadata(Upnp.upnpObject aMusicTrack)
        {
            Assert.Check(aMusicTrack is Upnp.musicTrack);

            // File Info
            if (aMusicTrack.Res.Count > 0)
            {
                FilePath = aMusicTrack.Res[0].Uri;
            }
            try {
                AlbumArtPath = DidlLiteAdapter.ArtworkUri(aMusicTrack).AbsoluteUri;
            }
            catch { // invlid or missing album art
            }

            // populate metadata from upnp music track if it is there
            try {
                Title = aMusicTrack.Title;
                if (((Upnp.musicTrack)aMusicTrack).Album.Count > 0)
                {
                    Album = ((Upnp.musicTrack)aMusicTrack).Album[0];
                }
                if (((Upnp.musicTrack)aMusicTrack).Artist.Count > 0)
                {
                    Artist = ((Upnp.musicTrack)aMusicTrack).Artist[0].Artist;
                    foreach (Upnp.artist artist in ((Upnp.musicTrack)aMusicTrack).Artist)
                    {
                        if (artist.Role == null || artist.Role == "" || artist.Role == "Performer")
                        {
                            Artist = artist.Artist;
                        }
                        else if (artist.Role == "Composer")
                        {
                            Composer = artist.Artist;
                        }
                        else if (artist.Role == "AlbumArtist")
                        {
                            AlbumArtist = artist.Artist;
                        }
                        else if (artist.Role == "Conductor")
                        {
                            Conductor = artist.Artist;
                        }
                    }
                }
                if (((Upnp.musicTrack)aMusicTrack).Genre.Count > 0)
                {
                    Genre = ((Upnp.musicTrack)aMusicTrack).Genre[0];
                }
                Track = (uint)(((Upnp.musicTrack)aMusicTrack).OriginalTrackNumber);
                if (aMusicTrack is Upnp.musicTrack)
                {
                    Disc      = (uint)(((Upnp.musicTrack)aMusicTrack).OriginalDiscNumber);
                    DiscCount = (uint)(((Upnp.musicTrack)aMusicTrack).OriginalDiscCount);
                }
                Year = ((Upnp.musicTrack)aMusicTrack).Date;
                if (aMusicTrack.Res.Count > 0)
                {
                    Duration = aMusicTrack.Res[0].Duration;
                    MimeType = aMusicTrack.Res[0].ProtocolInfo.Replace("http-get:*:", "").Replace(":*", "");
                }
            }
            catch (Exception) {
            }

            // deal with missing data and unwanted data
            if (Title == null)
            {
                Title = "Unknown";
            }
            if (Album == null)
            {
                Album = "Unknown";
            }
            if (Artist == null)
            {
                Artist = "Unknown";
            }
            if (Genre == null)
            {
                Genre = "Unknown";
            }
            if (Composer == null)
            {
                Composer = "Unknown";
            }
            if (Conductor == null)
            {
                Conductor = "Unknown";
            }
            if (AlbumArtist == null)
            {
                AlbumArtist = "Unknown";
            }
            if (Year == null)
            {
                Year = "Unknown";
            }
            if (Duration == null)
            {
                Duration = "Unknown";
            }
            if (MimeType == null)
            {
                MimeType = "Unknown";
            }
        }
Example #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="aObject">
 /// A <see cref="Upnp.upnpObject"/>
 /// </param>
 public void SetMetatext(Upnp.upnpObject aObject)
 {
 }
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="aObject">
 /// A <see cref="Upnp.upnpObject"/>
 /// </param>
 public void SetItem(Upnp.upnpObject aObject)
 {
 }