Beispiel #1
0
        /// <summary>
        /// Loads all orphan files in the Natural Grounding folder as a list of strings.
        /// </summary>
        public void LoadFiles()
        {
            files = new List <LocalFileInfo>();

            if (!Directory.Exists(Settings.NaturalGroundingFolder))
            {
                return;
            }

            // We must load all file names from the database to know which files are not in the database.
            List <string> AllFiles = SearchVideoAccess.GetAllFileNames();

            string ItemFile;
            bool   ItemInDatabase;
            var    FileEnum = Directory.EnumerateFiles(Settings.NaturalGroundingFolder, "*.*", System.IO.SearchOption.AllDirectories);

            foreach (string f in FileEnum)
            {
                // Exclude temp folder.
                if (!f.StartsWith(PathManager.TempFilesPath))
                {
                    ItemFile       = f.Substring(Settings.NaturalGroundingFolder.Length);
                    ItemInDatabase = AllFiles.Any(d => d.Equals(ItemFile, StringComparison.OrdinalIgnoreCase));
                    files.Add(new LocalFileInfo(ItemFile, ItemInDatabase));
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Loads the list of artists.
        /// </summary>
        /// <param name="settings">The filters to apply to the data.</param>
        public async Task <List <SearchCategoryItem> > LoadCategoriesAsync(SearchSettings settings, SearchFilterEnum groupType)
        {
            List <SearchCategoryItem> Result = new List <SearchCategoryItem>();

            if (settings.ListIsInDatabase != false)
            {
                Result.Add(new SearchCategoryItem(SearchFilterEnum.All, null, "All"));
                if (groupType != SearchFilterEnum.Artist)
                {
                    Result.Add(new SearchCategoryItem(SearchFilterEnum.Artist, null, "By Artist"));
                }
                if (groupType != SearchFilterEnum.Category)
                {
                    Result.Add(new SearchCategoryItem(SearchFilterEnum.Category, null, "By Category"));
                }
                if (groupType != SearchFilterEnum.Element)
                {
                    Result.Add(new SearchCategoryItem(SearchFilterEnum.Element, null, "By Element"));
                }
            }
            if (settings.ListIsInDatabase != true)
            {
                Result.Add(new SearchCategoryItem(SearchFilterEnum.Files, null, "Other Files"));
            }
            Result.Add(new SearchCategoryItem(SearchFilterEnum.None, null, "---"));

            if (groupType == SearchFilterEnum.Artist)
            {
                if (string.IsNullOrEmpty(settings.Search))
                {
                    Result.Add(new SearchCategoryItem(SearchFilterEnum.Artist, "", "No Artist"));
                    Result.Add(new SearchCategoryItem(SearchFilterEnum.ArtistSingles, null, "Singles"));
                }
                Result.AddRange(await Task.Run(() => SearchVideoAccess.GetCategoryArtists(settings)));
            }
            else if (groupType == SearchFilterEnum.Category)
            {
                if (string.IsNullOrEmpty(settings.Search))
                {
                    Result.Add(new SearchCategoryItem(SearchFilterEnum.Category, "", "No Category"));
                }
                Result.AddRange(await Task.Run(() => SearchVideoAccess.GetCategoryCategories(settings)));
            }
            else if (groupType == SearchFilterEnum.Element)
            {
                Result.AddRange(await Task.Run(() => SearchVideoAccess.GetCategoryElements(settings)));
            }

            return(Result);
        }
        /// <summary>
        /// Loads the list of rating categories for the Distibution Graph interface.
        /// </summary>
        /// <returns>A list of RatingCategory objects.</returns>
        public async Task <List <RatingCategory> > GetRatingCategoriesAsync()
        {
            List <RatingCategory> Result = await Task.Run(() => SearchVideoAccess.GetCustomRatingCategories());

            Result.Insert(0, new RatingCategory()
            {
                Name = "--------------------"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Love"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Egoless"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Spiritual Feminine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Spiritual Masculine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Emotional Feminine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Emotional Masculine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Physical Feminine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Physical Masculine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Intensity"
            });
            Result.Insert(0, new RatingCategory());
            return(Result);
        }
        /// <summary>
        /// Loads the list of rating categories for the Elements combobox.
        /// </summary>
        /// <returns>A list of RatingCategory objects.</returns>
        public async Task <List <RatingCategory> > GetElementCategoriesAsync()
        {
            List <RatingCategory> Result   = new List <RatingCategory>();
            List <RatingCategory> DbResult = await Task.Run(() => SearchVideoAccess.GetCustomRatingCategories());

            Result.Add(new RatingCategory()
            {
                Name = ""
            });
            Result.Add(new RatingCategory()
            {
                Name = "Egoless"
            });
            Result.Add(new RatingCategory()
            {
                Name = "Love"
            });
            Result.AddRange(DbResult);
            return(Result);
        }
Beispiel #5
0
        /// <summary>
        /// Loads the playlist from the database with specified filter conditions.
        /// </summary>
        /// <param name="settings">The filters to apply to the data.</param>
        /// <param name="forceScanFolder">Whether to scan files in folder to set FileExists.</param>
        /// <returns>A Task object for asynchronous processing.</returns>
        public async Task LoadPlaylistAsync(SearchSettings settings, bool forceScanFolder)
        {
            bool LoadFilesRequired = !(settings.IsInDatabase == true);

            // Load database.
            var DbTask = Task.Run(() => SearchVideoAccess.GetList(settings));

            // Load files.
            if (LoadFilesRequired || forceScanFolder)
            {
                if (files == null)
                {
                    // Run both tasks simultaneously.
                    var FilesTask = Task.Run(() => LoadFiles());
                    Task.WaitAll(DbTask, FilesTask);
                }
                playlist = await DbTask;
                await Task.Run(() => MergePlaylist(settings));
            }
            else
            {
                playlist = await DbTask;
            }
        }
Beispiel #6
0
        /// <summary>
        /// Loads the list of rating categories for the search interface.
        /// </summary>
        /// <returns>A list of RatingCategory objects.</returns>
        public async Task <List <RatingCategory> > GetRatingCategoriesAsync(bool addSpecial)
        {
            List <RatingCategory> Result = await Task.Run(() => SearchVideoAccess.GetCustomRatingCategories());

            Result.Insert(0, new RatingCategory()
            {
                Name = "--------------------"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Love"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Egoless"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Spiritual Feminine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Spiritual Masculine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Emotional Feminine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Emotional Masculine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Physical Feminine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Physical Masculine"
            });
            Result.Insert(0, new RatingCategory()
            {
                Name = "Intensity"
            });
            if (addSpecial)
            {
                Result.Insert(0, new RatingCategory()
                {
                    Name = "--------------------"
                });
                Result.Insert(0, new RatingCategory()
                {
                    Name = "Height"
                });
                Result.Insert(0, new RatingCategory()
                {
                    Name = "Length"
                });
                Result.Insert(0, new RatingCategory()
                {
                    Name = "Highest"
                });
                Result.Insert(0, new RatingCategory()
                {
                    Name = "Preference"
                });
            }
            Result.Insert(0, new RatingCategory());
            return(Result);
        }