public override IAlbum GetAlbum(ISecurityContext securityContext, IMediaFactory mediaFactory, IMetadataRepository mediaItemRepository, IArtist artist) { IAlbum album = null; var track = mediaItemRepository.GetByTarget <ITrack>(Location).FirstOrDefault(); if (track != null) { album = mediaItemRepository.GetByLocation <IAlbum>(track.Catalog); if (album != null) { return(album); } } var albumTitle = "Unknown Album"; var summary = string.Empty; //var albumTag = GetTags().Where(x => x.Type == Id3v2TagType.Album).FirstOrDefault(); if (id3v2Tag != null && id3v2Tag.Album != null) { albumTitle = id3v2Tag.Album; //albumTag.Tuple.ToString(); album = mediaItemRepository.GetByCreatorAndName <IAlbum>(artist.Location, albumTitle); if (album != null) { return(album); } } var builder = new MediaItemBuilder <IAlbum>(securityContext, mediaFactory) .Identity(albumTitle, summary) .Creator(artist.Location, artist.Name); return(builder.ToMediaItem()); }
public override IAlbum GetAlbum(ISecurityContext securityContext, IMediaFactory mediaFactory, IMetadataRepository mediaItemRepository, IArtist artist) { IAlbum album = null; var track = mediaItemRepository.GetByTarget<ITrack>(Location).FirstOrDefault(); if (track != null) { album = mediaItemRepository.GetByLocation<IAlbum>(track.Catalog); if (album != null) return album; } var albumTitle = "Unknown Album"; var summary = string.Empty; //var albumTag = GetTags().Where(x => x.Type == Id3v2TagType.Album).FirstOrDefault(); if (id3v2Tag != null && id3v2Tag.Album != null) { albumTitle = id3v2Tag.Album; //albumTag.Tuple.ToString(); album = mediaItemRepository.GetByCreatorAndName<IAlbum>(artist.Location, albumTitle); if (album != null) return album; } var builder = new MediaItemBuilder<IAlbum>(securityContext, mediaFactory) .Identity(albumTitle, summary) .Creator(artist.Location, artist.Name); return builder.ToMediaItem(); }