Example #1
0
        private void SaveMediaItems(IVideo video)
        {
            try
            {
                var artist = video.GetArtist(securityContext, mediaFactory, mediaItemRepository);
                mediaItemRepository.Save(new List <IArtist> {
                    artist
                });
                tagRepository.Save(artist.GetTags());

                var album = video.GetAlbum(securityContext, mediaFactory, mediaItemRepository, artist);
                mediaItemRepository.Save(new List <IAlbum> {
                    album
                });
                tagRepository.Save(album.GetTags());

                var clip = video.GetClip(securityContext, mediaFactory, mediaItemRepository, artist, album);
                mediaItemRepository.Save(new List <IClip> {
                    clip
                });
                tagRepository.Save(clip.GetTags());

                var clipDate = clip.FromDate > DateTime.MinValue ? clip.FromDate : clip.ToDate;
                if (album.FromDate == DateTime.MinValue && clipDate != DateTime.MinValue)
                {
                    var identityInfo  = new IdentityInfo(album.Location, album.Type, album.Name, album.Summary, clipDate, clipDate, album.Number);
                    var sizeInfo      = new SizeInfo(album.Duration, album.Height, album.Width);
                    var creatorInfo   = new CreatorInfo(album.Creator, album.CreatorName);
                    var catalogInfo   = new CatalogInfo(album.Catalog, album.CatalogName);
                    var targetInfo    = new TargetInfo(album.Target, album.TargetType);
                    var userInfo      = new UserInfo(album.User, album.UserName);
                    var thumbnailInfo = new ThumbnailInfo(album.Thumbnail, album.ThumbnailData);
                    album = new Album(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo);
                    mediaItemRepository.Save(new List <IAlbum> {
                        album
                    });
                }
            }
            catch (Exception ex)
            {
                logger.Error("  CatalogSpider.SaveMediaItems", ex);
            }
        }
        private void SaveMediaItems(IVideo video)
        {
            try
            {
                var artist = video.GetArtist(securityContext, mediaFactory, mediaItemRepository);
                mediaItemRepository.Save(new List<IArtist> { artist });
                tagRepository.Save(artist.GetTags());

                var album = video.GetAlbum(securityContext, mediaFactory, mediaItemRepository, artist);
                mediaItemRepository.Save(new List<IAlbum> { album });
                tagRepository.Save(album.GetTags());

                var clip = video.GetClip(securityContext, mediaFactory, mediaItemRepository, artist, album);
                mediaItemRepository.Save(new List<IClip> { clip });
                tagRepository.Save(clip.GetTags());

                var clipDate = clip.FromDate > DateTime.MinValue ? clip.FromDate : clip.ToDate;
                if (album.FromDate == DateTime.MinValue && clipDate != DateTime.MinValue)
                {
                    var identityInfo = new IdentityInfo(album.Location, album.Type, album.Name, album.Summary, clipDate, clipDate, album.Number);
                    var sizeInfo = new SizeInfo(album.Duration, album.Height, album.Width);
                    var creatorInfo = new CreatorInfo(album.Creator, album.CreatorName);
                    var catalogInfo = new CatalogInfo(album.Catalog, album.CatalogName);
                    var targetInfo = new TargetInfo(album.Target, album.TargetType);
                    var userInfo = new UserInfo(album.User, album.UserName);
                    var thumbnailInfo = new ThumbnailInfo(album.Thumbnail, album.ThumbnailData);
                    album = new Album(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo);
                    mediaItemRepository.Save(new List<IAlbum> { album });
                }
            }
            catch (Exception ex)
            {
                logger.Error("  CatalogSpider.SaveMediaItems", ex);
            }
        }