Example #1
0
        /// <summary>
        /// Generatate unsorted list.
        /// </summary>
        /// <param name="progress"></param>
        public static void GeneratateUnsortedList(Progress progress)
        {
            mediaPathTvUnsorted.Clear();
            mediaPathMoviesUnsorted.Clear();


            var count = 0;

            try
            {
                foreach (MediaPathModel mediaPath in MediaPathDB)
                {
                    for (int index = 0; index < mediaPath.FileCollection.Count; index++)
                    {
                        progress.Message = string.Format("Processing {0}", mediaPath.FileCollection[index].PathAndFileName);

                        MediaPathFileModel filePath = mediaPath.FileCollection[index];

                        if (filePath.Type == MediaPathFileModel.MediaPathFileType.Movie)
                        {
                            if (new System.IO.FileInfo(filePath.PathAndFileName).Length > Get.InOutCollection.MinimumMovieSize)
                            {
                                if (!MasterMediaDBFactory.MovieDatabaseContains(filePath.PathAndFileName))
                                {
                                    mediaPathMoviesUnsorted.Add(filePath);
                                }
                            }
                        }

                        if (filePath.Type == MediaPathFileModel.MediaPathFileType.TV)
                        {
                            if (!MasterMediaDBFactory.TvDatabaseContains(filePath.PathAndFileName))
                            {
                                mediaPathTvUnsorted.Add(filePath);
                            }
                        }

                        count++;

                        var total = (long)MediaPathDB.Sum(pathColletion => pathColletion.FileCollection.Count);

                        progress.Percent = Convert.ToInt32((long)count * 100 / total);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteToLog(LogSeverity.Error, 0, "Could not Generated Unsorted List", ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// Generatate unsorted list.
        /// </summary>
        public static void GeneratateUnsortedList()
        {
            mediaPathTvUnsorted.Clear();
            mediaPathMoviesUnsorted.Clear();

            try
            {
                foreach (MediaPathModel mediaPath in MediaPathDB)
                {
                    for (int index = 0; index < mediaPath.FileCollection.Count; index++)
                    {
                        MediaPathFileModel filePath = mediaPath.FileCollection[index];

                        if (filePath.Type == MediaPathFileModel.MediaPathFileType.Movie)
                        {
                            if (new System.IO.FileInfo(filePath.PathAndFileName).Length > Get.InOutCollection.MinimumMovieSize)
                            {
                                if (!MasterMediaDBFactory.MovieDatabaseContains(filePath.PathAndFileName))
                                {
                                    mediaPathMoviesUnsorted.Add(filePath);
                                }
                            }
                        }

                        if (filePath.Type == MediaPathFileModel.MediaPathFileType.TV)
                        {
                            if (!MasterMediaDBFactory.TvDatabaseContains(filePath.PathAndFileName))
                            {
                                mediaPathTvUnsorted.Add(filePath);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteToLog(LogSeverity.Error, 0, "Could not Generated Unsorted List", ex.Message);
            }
        }