コード例 #1
0
 protected MediaItemBase(IdentityInfo identityInfo, SizeInfo sizeInfo, CreatorInfo creatorInfo, CatalogInfo catalogInfo, TargetInfo targetInfo, UserInfo userInfo, ThumbnailInfo thumbnailInfo)
 {
     this.name          = identityInfo.Name;
     this.summary       = identityInfo.Summary;
     this.fromDate      = identityInfo.FromDate;
     this.toDate        = identityInfo.ToDate;
     this.number        = identityInfo.Number;
     this.duration      = sizeInfo.Duration;
     this.height        = sizeInfo.Height;
     this.width         = sizeInfo.Width;
     this.creator       = creatorInfo.Location;
     this.creatorName   = creatorInfo.Name;
     this.catalog       = catalogInfo.Location;
     this.catalogName   = catalogInfo.Name;
     this.target        = targetInfo.Location;
     this.targetType    = targetInfo.Type;
     this.user          = userInfo.Location;
     this.userName      = userInfo.Name;
     this.thumbnail     = thumbnailInfo.Location;
     this.thumbnailData = thumbnailInfo.Data;
     this.type          = identityInfo.Type;
     this.location      = identityInfo.Location;
 }
コード例 #2
0
 protected MediaItemBase(IdentityInfo identityInfo, SizeInfo sizeInfo, CreatorInfo creatorInfo, CatalogInfo catalogInfo, TargetInfo targetInfo, UserInfo userInfo, ThumbnailInfo thumbnailInfo)
 {
     this.name = identityInfo.Name;
     this.summary = identityInfo.Summary;
     this.fromDate = identityInfo.FromDate;
     this.toDate = identityInfo.ToDate;
     this.number = identityInfo.Number;
     this.duration = sizeInfo.Duration;
     this.height = sizeInfo.Height;
     this.width = sizeInfo.Width;
     this.creator = creatorInfo.Location;
     this.creatorName = creatorInfo.Name;
     this.catalog = catalogInfo.Location;
     this.catalogName = catalogInfo.Name;
     this.target = targetInfo.Location;
     this.targetType = targetInfo.Type;
     this.user = userInfo.Location;
     this.userName = userInfo.Name;
     this.thumbnail = thumbnailInfo.Location;
     this.thumbnailData = thumbnailInfo.Data;
     this.type = identityInfo.Type;
     this.location = identityInfo.Location;
 }
コード例 #3
0
 public Track(IdentityInfo identityInfo, SizeInfo sizeInfo, CreatorInfo creatorInfo, CatalogInfo catalogInfo, TargetInfo targetInfo, UserInfo userInfo, ThumbnailInfo thumbnailInfo)
     : base(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo)
 {
 }
コード例 #4
0
ファイル: Clip.cs プロジェクト: bossaia/alexandrialibrary
 public Clip(IdentityInfo identityInfo, SizeInfo sizeInfo, CreatorInfo creatorInfo, CatalogInfo catalogInfo, TargetInfo targetInfo, UserInfo userInfo, ThumbnailInfo thumbnailInfo)
     : base(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo)
 {
 }
コード例 #5
0
 public IMediaItemBuilder <T> Creator(Uri creator, string creatorName)
 {
     creatorInfo = new CreatorInfo(creator, creatorName);
     return(this);
 }
コード例 #6
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);
            }
        }
コード例 #7
0
        private void SaveMediaItems(IAudio audio)
        {
            try
            {
                var artist = audio.GetArtist(securityContext, mediaFactory, mediaItemRepository);
                mediaItemRepository.Save(new List<IArtist> { artist });
                tagRepository.Save(artist.GetTags());

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

                var track = audio.GetTrack(securityContext, mediaFactory, mediaItemRepository, audioStreamFactory, artist, album);
                mediaItemRepository.Save(new List<ITrack> { track });
                tagRepository.Save(track.GetTags());

                var trackDate = track.FromDate > DateTime.MinValue ? track.FromDate : track.ToDate;
                if (album.FromDate == DateTime.MinValue && trackDate != DateTime.MinValue)
                {
                    var identityInfo = new IdentityInfo(album.Location, album.Type, album.Name, album.Summary, trackDate, trackDate, 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 });
                }

                //if (album.ToDate == DateTime.MinValue && track.ToDate != DateTime.

                if (!HasDefaultThumbnail(track))
                {
                    if (HasDefaultThumbnail(album))
                    {
                        //var fromDate = album.FromDate;
                        //if (album.FromDate == DateTime.MinValue || album.FromDate == DateTime.MaxValue)
                        //{
                        //    fromDate = track.ToDate != DateTime.MinValue && track.ToDate != DateTime.MaxValue ?
                        //        track.ToDate
                        //        : track.FromDate;
                        //}

                        var number = album.Number;
                        if (album.Name.Contains("#") && !album.Name.EndsWith("#"))
                        {
                            var suffix = album.Name.Substring(album.Name.LastIndexOf('#') + 1).Trim();
                            uint.TryParse(suffix, out number);
                        }
                        else if (album.Name.Contains("(") && !album.Name.EndsWith("("))
                        {
                            var suffix = album.Name.Substring(album.Name.LastIndexOf("(") + 1);
                            var cleaned = System.Text.RegularExpressions.Regex.Replace(suffix, "[^0-9]", string.Empty);
                            uint.TryParse(cleaned, out number);
                        }

                        var identityInfo = new IdentityInfo(album.Location, album.Type, album.Name, album.Summary, album.FromDate, album.ToDate, 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(track.Thumbnail, track.ThumbnailData);
                        var updated = new Album(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo);
                        mediaItemRepository.Save(new List<IAlbum> { updated });
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("  SaveMediaItems", ex);
            }
        }