public void Start() { spookyStingSource = GetComponent <AudioSource>(); photoLibrary = GetComponent <PhotoLibrary>(); isCameraActive = true; isFlashOn = false; }
public static PhotoLibrary Convert(Settings settings) { var library = new PhotoLibrary { DestinationFolder = settings.DestinationFolder, SourceFolder = settings.SourceFolder, }; return(library); }
public IEnumerable <PhotoRecord> Run(PhotoLibrary library) { var files = new GetPhotoFilesQuery().Run(library); var sourcePathLength = library.SourceFolder.Length; var records = new ConcurrentBag <PhotoRecord>(); var exceptions = new ConcurrentBag <Exception>(); Parallel.ForEach(files, file => { try { var relativePath = file.FullName.Remove(0, sourcePathLength).TrimStart(new[] { '\\' }); using var context = PhotoSyncContextFactory.Make(library.DestinationFullPath); var excludedFolders = context.ExcludeFolders.Select(x => x.RelativePath); if (!this.IsInExcludedFolder(excludedFolders, relativePath)) { if (context.Photos.Any(x => x.RelativePath == relativePath)) { var photo = context.Photos.FirstOrDefault(x => x.RelativePath == relativePath); if (photo != null) { var sourceFilePath = Path.Combine(library.SourceFolder, relativePath); if (!File.Exists(sourceFilePath)) { context.Photos.Remove(photo); context.SaveChanges(); } else { records.Add(this.MakeRecord(photo, file)); } } } else { var photo = new Photo { RelativePath = relativePath }; context.Photos.Add(photo); context.SaveChanges(); records.Add(this.MakeRecord(photo, file)); } } } catch (Exception ex) { exceptions.Add(ex); } }); return(exceptions.IsEmpty ? records : throw new AggregateException(exceptions)); }
public void Initialize() { SpeechController.GetInstance().OnContextSpeechDetected += OnPhotoContextWord; photoLibrary = Instantiate <GameObject>(Resources.Load <GameObject>("prefabs/PhotoLibrary")).GetComponent <PhotoLibrary>(); ActiveSet = photoLibrary.PhotoSets[0]; }
/// <summary> /// Get Libraries /// </summary> /// <param name="filter">Library Filter (Optional)</param> /// <exception cref="ApplicationException">Invalid Library Exception</exception> /// <returns>List of Library Objects</returns> public async Task <List <LibraryBase> > Libraries(LibraryFilter filter = null) { var libraries = new List <LibraryBase>(); var summary = await this.plexServerClient.GetLibrariesAsync(this.AccessToken, this.Uri.ToString()); foreach (var library in summary.Libraries) { switch (library.Type.ToUpper(CultureInfo.InvariantCulture)) { case "MOVIE": var movieLibrary = new MovieLibrary(this.plexServerClient, this.plexLibraryClient, this); ObjectMapper.Mapper.Map(library, movieLibrary); var movieFilterContainer = await this.plexLibraryClient.GetLibraryFilters(this.AccessToken, this.Uri.ToString(), library.Key); libraries.Add(movieLibrary); break; case "SHOW": var showLibrary = new ShowLibrary(this.plexServerClient, this.plexLibraryClient, this); ObjectMapper.Mapper.Map(library, showLibrary); var showFilterContainer = await this.plexLibraryClient.GetLibraryFilters(this.AccessToken, this.Uri.ToString(), showLibrary.Key); libraries.Add(showLibrary); break; case "ARTIST": var musicLibrary = new MusicLibrary(this.plexServerClient, this.plexLibraryClient, this); ObjectMapper.Mapper.Map(library, musicLibrary); var musicFilterContainer = await this.plexLibraryClient.GetLibraryFilters(this.AccessToken, this.Uri.ToString(), musicLibrary.Key); libraries.Add(musicLibrary); break; case "PHOTO": var photoLibrary = new PhotoLibrary(this.plexServerClient, this.plexLibraryClient, this); ObjectMapper.Mapper.Map(library, photoLibrary); var photoFilterContainer = await this.plexLibraryClient.GetLibraryFilters(this.AccessToken, this.Uri.ToString(), photoLibrary.Key); libraries.Add(photoLibrary); break; default: throw new ApplicationException("Invalid Library Type"); } } if (filter != null) { if (filter.Keys.Count > 0) { libraries = libraries .Where(c => filter.Keys.Contains(c.Key, StringComparer.OrdinalIgnoreCase)) .ToList(); } if (filter.Titles.Count > 0) { libraries = libraries .Where(c => filter.Titles.Contains(c.Title, StringComparer.OrdinalIgnoreCase)) .ToList(); } if (filter.Types.Count > 0) { libraries = libraries .Where(c => filter.Types.Contains(c.Type, StringComparer.OrdinalIgnoreCase)) .ToList(); } } return(libraries); }
public static Settings Convert(PhotoLibrary library) => new Settings { DestinationFolder = library.DestinationFolder, SourceFolder = library.SourceFolder };