Пример #1
0
 public UploadImageCommand(ImageFileRepository imageFileRepository, AssetDocumentRepository assetDocumentRepository, UploadAssetNotifier notifier)
     : base(notifier)
 {
     _assetRootPath           = ConfigurationManager.AppSettings["ImageRootPath"];
     _imageFileRepository     = imageFileRepository;
     _assetDocumentRepository = assetDocumentRepository;
 }
Пример #2
0
        private static void UploadAsset(FileMetadata file)
        {
            var assetFileRepository     = new ImageFileRepository();
            var assetDocumentRepository = new AssetDocumentRepository();
            var notifier = new MessageBusClient();

            var assetRootPath = ConfigurationManager.AppSettings["ImageRootPath"];

            var id           = Guid.NewGuid().ToString();
            var fileInfo     = FileReader.GetFileInfo(file.FileLocation);
            var fileContents = FileReader.ReadFile(file.FileLocation);
            var fileName     = $"original{fileInfo.Extension}";


            var storageMetadata = assetFileRepository.StoreAsset(id, fileName, "image/jpeg", fileContents);

            if (storageMetadata == null)
            {
                return;
            }

            var imageMetadata    = FileReader.GetImageMetadata(file.FileName);
            var imageDescription = imageMetadata.GetValue("Exif IFD0", "Image Description");


            var assetMetadata = new AssetMetadata
            {
                Id              = id,
                Name            = file.FileName,
                Description     = imageDescription ?? string.Empty,
                Category        = file.Category,
                ContentType     = "image/jpeg",
                Author          = file.Photographer,
                Url             = $"{assetRootPath}/{storageMetadata.StorageId}",
                StorageMetadata = storageMetadata,
                Type            = "image"
            };

            assetDocumentRepository.Create(assetMetadata);

            notifier.SendMessage(new NewImageAdded {
                ImageName = storageMetadata.StorageId, Id = id
            });
        }
Пример #3
0
 public GenerateThumbnail(ImageFileRepository fileRepository, AssetDocumentRepository documentRepository)
 {
     _fileRepository     = fileRepository;
     _documentRepository = documentRepository;
 }
Пример #4
0
 public EncodeSmoothStreamingVideo(MediaServicesRepository mediaServicesRepository, AssetDocumentRepository documentRepository, MessageBusClient messageBusClient)
 {
     _mediaServicesRepository = mediaServicesRepository;
     _documentRepository      = documentRepository;
     _messageBusClient        = messageBusClient;
 }
Пример #5
0
 public ExtractVideoKeywords(MediaServicesRepository mediaServicesRepository, AssetDocumentRepository documentRepository, MessageBusClient messageBusClient)
 {
     _mediaServicesRepository = mediaServicesRepository;
     _documentRepository      = documentRepository;
     _messageBusClient        = messageBusClient;
 }
Пример #6
0
 public AssetDocumentCDNDecorator(AssetDocumentRepository repository)
 {
     _repository = repository;
 }
Пример #7
0
 public UploadVideoCommand(MediaServicesRepository mediaServicesRepository, AssetDocumentRepository assetDocumentRepository, UploadAssetNotifier notifier)
     : base(notifier)
 {
     _mediaServicesRepository = mediaServicesRepository;
     _assetDocumentRepository = assetDocumentRepository;
 }
 public UpdateSearchAssetSearchRecord(AssetDocumentRepository docuementRepository, SearchManagementClient _searchClient)
 {
     _docuementRepository = docuementRepository;
     this._searchClient   = _searchClient;
 }
Пример #9
0
 public GetAssetDetailsQuery(AssetDocumentRepository assetdocumentRepository)
 {
     _assetDocumentRepository = assetdocumentRepository;
 }