Esempio n. 1
0
        private static string[] ImportMoviePhotos(DatabaseEntry movie, string folderPath, ContentManagementClient client)
        {
            folderPath = Path.Combine(folderPath, "Movies", "images", movie.ExternalId);
            var externalIds = new List <string>();
            var contentType = "image/jpeg";

            foreach (var filePath in Directory.EnumerateFiles(folderPath, "*.jpg", SearchOption.TopDirectoryOnly))
            {
                var externalId = $"Movie image - {movie.ExternalId} ({Path.GetFileNameWithoutExtension(filePath)})";

                var descriptions = new List <AssetDescription> {
                    new AssetDescription
                    {
                        Language    = LanguageIdentifier.DEFAULT_LANGUAGE,
                        Description = movie.GetText("Name")
                    }
                };

                var file = client.UpsertAssetByExternalIdAsync(movie.ExternalId, new FileContentSource(filePath, contentType), new List <AssetDescription>());

                externalIds.Add(externalId);
            }

            return(externalIds.ToArray());
        }
Esempio n. 2
0
        private static string ImportActorPhoto(DatabaseEntry actor, string folderPath, ContentManagementClient client)
        {
            var externalId  = $"Actor image - {actor.ExternalId}";
            var filePath    = Path.Combine(folderPath, "Actors", "images", $"{actor.ExternalId}.jpg");
            var contentType = "image/jpeg";

            var descriptions = new List <AssetDescription> {
                new AssetDescription
                {
                    Language    = LanguageIdentifier.DEFAULT_LANGUAGE,
                    Description = actor.GetText("Name")
                }
            };

            client.UpsertAssetByExternalIdAsync(
                actor.ExternalId,
                new FileContentSource(filePath, contentType),
                new List <AssetDescription>()
                );

            return(externalId);
        }