Ejemplo n.º 1
0
        public MediaLibraryAudioBroadcastItem(string title, int channelNr, EndPointSettings client)
            : base(DlnaResourceAccessUtils.RADIO_CHANNEL_RESOURCE + channelNr, client)
        {
            Id           = Key;
            Title        = title;
            ChannelName  = title;
            ChannelNr    = channelNr;
            Date         = DateTime.Now.ToString("yyyy-MM-dd");
            AlbumArtUrls = new List <IDirectoryAlbumArt>();

            var albumArt = new MediaLibraryAlbumArt(Guid.Empty, client);

            albumArt.Initialise(title, false);
            AlbumArtUrls.Add(albumArt);

            if (client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.All || client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.Icon)
            {
                Icon = albumArt.Uri;
            }
            if (client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.All || client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.Resource)
            {
                var albumResource = new MediaLibraryAlbumArtResource(albumArt);
                albumResource.Initialise();
                Resources.Add(albumResource);
            }
            if (client.Profile.Settings.Thumbnails.Delivery != ThumbnailDelivery.All && client.Profile.Settings.Thumbnails.Delivery != ThumbnailDelivery.AlbumArt)
            {
                AlbumArtUrls.Clear();
            }

            var resource = new MediaLibraryLiveResource(Key, channelNr, client);

            resource.Initialise();
            Resources.Add(resource);
        }
Ejemplo n.º 2
0
        public MediaLibraryAlbumItem(MediaItem item, EndPointSettings client)
            : base(item, NECESSARY_MUSIC_MIA_TYPE_IDS, OPTIONAL_MUSIC_MIA_TYPE_IDS,
                   new RelationshipFilter(AudioAspect.ROLE_TRACK, AudioAlbumAspect.ROLE_ALBUM, item.MediaItemId), client)
        {
            Genre       = new List <string>();
            Artist      = new List <string>();
            Contributor = new List <string>();

            if (MediaItemAspect.TryGetAspect(item.Aspects, AudioAlbumAspect.Metadata, out SingleMediaItemAspect albumAspect))
            {
                //Title = albumAspect.GetAttributeValue<string>(AudioAlbumAspect.ATTR_ALBUM);
                if (Client.Profile.Settings.Metadata.Delivery == MetadataDelivery.All)
                {
                    IList <MultipleMediaItemAspect> genreAspects;
                    if (MediaItemAspect.TryGetAspects(item.Aspects, GenreAspect.Metadata, out genreAspects))
                    {
                        CollectionUtils.AddAll(Genre, genreAspects.Select(g => g.GetAttributeValue <string>(GenreAspect.ATTR_GENRE)));
                    }

                    var artistObj = albumAspect.GetCollectionAttribute <object>(AudioAlbumAspect.ATTR_ARTISTS);
                    if (artistObj != null)
                    {
                        CollectionUtils.AddAll(Artist, artistObj.Cast <string>());
                    }

                    Description     = albumAspect.GetAttributeValue <string>(AudioAlbumAspect.ATTR_DESCRIPTION);
                    LongDescription = Description;
                }
            }

            //Support alternative ways to get album art
            var albumArt = new MediaLibraryAlbumArt(item, Client);

            if (albumArt != null)
            {
                albumArt.Initialise();
                if (Client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.All || Client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.Resource)
                {
                    var albumResource = new MediaLibraryAlbumArtResource(albumArt);
                    albumResource.Initialise();
                    Resources.Add(albumResource);
                }
                if (Client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.All || Client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.AlbumArt)
                {
                    AlbumArtUrl = albumArt.Uri;
                }
            }
        }
Ejemplo n.º 3
0
        public MediaLibraryItem(string key, MediaItem item, EndPointSettings client)
            : base(key, client)
        {
            MediaItemId = item.MediaItemId;
            SingleMediaItemAspect aspect;

            if (MediaItemAspect.TryGetAspect(item.Aspects, MediaAspect.Metadata, out aspect))
            {
                Title = aspect.GetAttributeValue <string>(MediaAspect.ATTR_TITLE);
            }

            AlbumArtUrls = new List <IDirectoryAlbumArt>();
            var albumArt = new MediaLibraryAlbumArt(item, client);

            albumArt.Initialise();
            AlbumArtUrls.Add(albumArt);
        }
Ejemplo n.º 4
0
        public MediaLibrarySeasonItem(MediaItem item, EndPointSettings client)
            : base(item, NECESSARY_EPISODE_MIA_TYPE_IDS, OPTIONAL_EPISODE_MIA_TYPE_IDS,
                   new RelationshipFilter(EpisodeAspect.ROLE_EPISODE, SeasonAspect.ROLE_SEASON, item.MediaItemId), client)
        {
            Genre       = new List <string>();
            Artist      = new List <string>();
            Contributor = new List <string>();

            if (Client.Profile.Settings.Metadata.Delivery == MetadataDelivery.All)
            {
                SingleMediaItemAspect seriesAspect;
                if (MediaItemAspect.TryGetAspect(item.Aspects, SeasonAspect.Metadata, out seriesAspect))
                {
                    var descriptionObj = seriesAspect.GetAttributeValue(SeasonAspect.ATTR_DESCRIPTION);
                    if (descriptionObj != null)
                    {
                        Description = descriptionObj.ToString();
                    }
                }
            }

            //Support alternative ways to get album art
            var albumArt = new MediaLibraryAlbumArt(item, Client);

            if (albumArt != null)
            {
                albumArt.Initialise();
                if (Client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.All || Client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.Resource)
                {
                    var albumResource = new MediaLibraryAlbumArtResource(albumArt);
                    albumResource.Initialise();
                    Resources.Add(albumResource);
                }
                if (Client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.All || Client.Profile.Settings.Thumbnails.Delivery == ThumbnailDelivery.AlbumArt)
                {
                    AlbumArtUrl = albumArt.Uri;
                }
            }
        }