Ejemplo n.º 1
0
        public UPnPTrackInfo(MusicTrack track, UPnPMusicSource source)
            : this(track as Item, source)
        {
            ArtistName = track.Artists.Count > 0 ? track.Artists[0].Name : "";
            AlbumTitle = track.Albums.Count > 0 ? track.Albums[0] : "";

            TrackNumber = track.OriginalTrackNumber.GetValueOrDefault ();

            Genre = track.Genres.Count > 0 ? track.Genres[0] : "";
        }
 public void MusicTrackSerialization ()
 {
     var music_track = new MusicTrack ("0", "-1", new MusicTrackOptions {
         Title = "Foo",
         Artists = new[] { new PersonWithRole ("Fooer", "performer") },
         Albums = new[] { "Footown" },
         OriginalTrackNumber = 1,
         Genres = new[] { "Fooish" },
         Resources = new[] { new Resource (new Uri ("http://foo/"), new ResourceOptions {
                 Size = 42
             })}
     });
     serializer.GetString (music_track);
 }
Ejemplo n.º 3
0
        public void OnTag (string id, IEnumerable<Resource> resources, Tag tag, Action<Object> consumer)
        {
            var genres = tag.Genres;
            var artists = tag.Performers;
            var album_artists = tag.AlbumArtists;
            var composers = tag.Composers;

            var music_track = new MusicTrack (id, Wmp11Ids.AllMusic, new MusicTrackOptions {
                Title = tag.Title,
                OriginalTrackNumber = (int)tag.Track,
                Genres = genres,
                Artists = GetArtists (artists),
                Resources = resources
            });

            audio_items.Add (music_track);
            consumer (music_track);

            foreach (var genre in genres) {
                genre_builder.OnItem (genre, music_track, consumer,
                    options => options != null ? options : new GenreOptions { Title = genre });
            }

            foreach (var artist in artists) {
                artist_builder.OnItem (artist, music_track, consumer,
                    options => ArtistWithGenres (artist, genres, options));
            }

            album_builder.OnItem (tag.Album, music_track, consumer,
                options => options != null ? options : new MusicAlbumOptions {
                    Title = tag.Album,
                    Contributors = album_artists
                });

            foreach (var album_artist in album_artists) {
                album_artist_builder.OnItem (album_artist, music_track, consumer,
                    options => ArtistWithGenres (album_artist, genres, options));
            }

            foreach (var composer in composers) {
                composer_builder.OnItem (composer, music_track, consumer,
                    options => ArtistWithGenres (composer, genres, options));
            }
        }
Ejemplo n.º 4
0
 static void AssertMusicTrack (MusicTrack musicTrack, MusicTrackOptions options)
 {
     AssertAudioItem (musicTrack, options);
     Assert.AreEqual (musicTrack.AlbumArtUri, options.AlbumArtUri);
     Assert.AreEqual (musicTrack.OriginalTrackNumber, options.OriginalTrackNumber);
     Assert.AreEqual (musicTrack.StorageMedium, options.StorageMedium);
     Assert.AreEqual (musicTrack.Date, options.Date);
     Assert.IsTrue (musicTrack.Artists.IsReadOnly);
     Assert.IsTrue (musicTrack.Albums.IsReadOnly);
     Assert.IsTrue (musicTrack.Playlists.IsReadOnly);
     Assert.IsTrue (musicTrack.Contributors.IsReadOnly);
     CollectionAssert.AreEqual (musicTrack.Artists, options.Artists);
     CollectionAssert.AreEqual (musicTrack.Albums, options.Albums);
     CollectionAssert.AreEqual (musicTrack.Playlists, options.Playlists);
     CollectionAssert.AreEqual (musicTrack.Contributors, options.Contributors);
 }
Ejemplo n.º 5
0
 public void MusicTrackInstantiation ()
 {
     var options = new MusicTrackOptions ();
     SetMusicTrackOptions (options);
     var music_track = new MusicTrack ("-1", "-1", options);
     AssertMusicTrack (music_track, options);
     AssertMusicTrack (music_track, music_track.GetOptions ());
 }