Beispiel #1
0
        public void CreateTVEpisode(int parent, int programno, int seriesno, int episodeno)
        {
            Title tt = new Title();

            tt.Name          = "TV P" + programno.ToString() + " S" + seriesno.ToString() + " E" + episodeno.ToString();
            tt.TitleType     = TitleTypes.Episode;
            tt.ParentTitleId = parent;
            TitleCollectionManager.AddTitle(tt);
        }
Beispiel #2
0
        public void CreateFilm(int parent, int no)
        {
            Title tt = new Title();

            tt.Name          = "Film " + no.ToString();
            tt.TitleType     = TitleTypes.Movie;
            tt.ParentTitleId = parent;
            TitleCollectionManager.AddTitle(tt);
        }
Beispiel #3
0
        public void CreateTVSeries(int parent, int programno, int seriesno)
        {
            Title tt = new Title();

            tt.Name          = "TV P" + programno.ToString() + " S" + seriesno.ToString();
            tt.TitleType     = TitleTypes.Season;
            tt.ParentTitleId = parent;
            TitleCollectionManager.AddTitle(tt);

            for (int i = 0; i < episodesperseries; i++)
            {
                CreateTVEpisode(tt.Id, programno, seriesno, i);
            }
        }
Beispiel #4
0
        public void CreateTVProgram(int parent, int programno)
        {
            Title tt = new Title();

            tt.Name          = "TV P" + programno.ToString();
            tt.TitleType     = TitleTypes.TVShow;
            tt.ParentTitleId = parent;
            TitleCollectionManager.AddTitle(tt);

            for (int i = 0; i < seriesperprogram; i++)
            {
                CreateTVSeries(tt.Id, programno, i);
            }
        }
Beispiel #5
0
        //int filmno;
        public void CreateTitles()
        {
            Console.WriteLine("Creating titles");
            totalfilms        = 100;
            totaltvprograms   = 100;
            seriesperprogram  = 5;
            episodesperseries = 8;

            // Test to create a title withou type specified
            Title ttt1 = new Title();

            ttt1.Name = "Test without titletype";
            TitleCollectionManager.AddTitle(ttt1);

            Title ttmovies = new Title();

            ttmovies.Name      = "Movies";
            ttmovies.TitleType = TitleTypes.Collection | TitleTypes.Root;
            TitleCollectionManager.AddTitle(ttmovies);

            Title tttv = new Title();

            tttv.Name      = "TV";
            tttv.TitleType = TitleTypes.TVShow | TitleTypes.Root;
            TitleCollectionManager.AddTitle(tttv);

            for (int i = 0; i < totalfilms; i++)
            {
                CreateFilm(ttmovies.Id, i);
            }

            for (int i = 0; i < totaltvprograms; i++)
            {
                CreateTVProgram(tttv.Id, i);
            }
            Console.WriteLine("Job Done. Press enter");
            Console.ReadKey();
        }
Beispiel #6
0
        public void TEST_IMPORT_INTO_DATABASE()
        {
            Console.WriteLine("Running dvd profiler importer");
            DVDProfilerImporter importer = new DVDProfilerImporter();

            importer.DoWork(new[] { @"..\..\..\Sample Files\DVDProfiler - Large.xml" });
            IList <OMLSDKTitle> titles = importer.GetTitles();

            Console.WriteLine("Adding items to the db");
            DateTime start = DateTime.Now;

            foreach (OMLSDKTitle title in titles)
            {
                // save the title - this also generates it an id
                TitleCollectionManager.AddTitle(OMLSDK.SDKUtilities.ConvertOMLSDKTitleToTitle(title));
            }

            // save all the image updates
            TitleCollectionManager.SaveTitleUpdates();

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            titles.Count));
        }
Beispiel #7
0
        public void LoadTitlesIntoDatabase(OMLPlugin plugin)
        {
            bool Cancelled = false;

            try
            {
                Utilities.DebugLine("[OMLImporter] Titles loaded, beginning Import process");
                IList <Title> titles = OMLSDK.SDKUtilities.ConvertOMLSDKTitlesToTitles(plugin.GetTitles());
                Utilities.DebugLine("[OMLImporter] " + titles.Count + " titles found in input file");

                int totalNumberOfTitles   = 0;
                int numberOfTitlesAdded   = 0;
                int numberOfTitlesSkipped = 0;

                bool YesToAll = true;// false;

                foreach (Title t in titles)
                {
                    if (backgroundWorker1.CancellationPending)
                    {
                        // Abort the operation
                        Cancelled = true;
                        break;
                    }

                    backgroundWorker1.ReportProgress(100 * totalNumberOfTitles / titles.Count, "Saving title : " + t.Name);

                    totalNumberOfTitles++;

                    if (TitleCollectionManager.ContainsDisks(t.Disks))
                    {
                        numberOfTitlesSkipped++;
                        continue;
                    }

                    if (!YesToAll)
                    {
                        //TODO: Need to show a UI that let's the User decide whether to import all titles or be selective about it

                        /*Console.WriteLine("Would you like to add this title? (y/n/a)");
                         * string response = Console.ReadLine();
                         * switch (response.ToUpper())
                         * {
                         *  case "Y":
                         *      mainTitleCollection.Add(t);
                         *      numberOfTitlesAdded++;
                         *      break;
                         *  case "N":
                         *      numberOfTitlesSkipped++;
                         *      break;
                         *  case "A":
                         *      YesToAll = true;
                         *      mainTitleCollection.Add(t);
                         *      numberOfTitlesAdded++;
                         *      break;
                         *  default:
                         *      break;
                         * }*/
                    }
                    else
                    {
                        TitleCollectionManager.AddTitle(t);
                        numberOfTitlesAdded++;
                    }
                }

                backgroundWorker1.ReportProgress(100, "Finalising...");

                TitleCollectionManager.SaveTitleUpdates();

                if (Cancelled)
                {
                    backgroundWorker1.ReportProgress(100, "Cancelled : Added " + numberOfTitlesAdded + "  Skipped " + numberOfTitlesSkipped);
                }
                else
                {
                    backgroundWorker1.ReportProgress(100, "Complete : Added " + numberOfTitlesAdded + "  Skipped " + numberOfTitlesSkipped);
                }

                plugin.GetTitles().Clear();
            }
            catch (Exception e)
            {
                XtraMessageBox.Show("Exception in LoadTitlesIntoDatabase: {0}", e.Message);
                Utilities.DebugLine("[OMLImporter] Exception in LoadTitlesIntoDatabase: " + e.Message);
            }
        }
Beispiel #8
0
        public static void LoadTitlesIntoDatabase(OMLPlugin plugin, bool flushInputBuffer, bool autoYesToAll)
        {
            try
            {
                Utilities.DebugLine("[OMLImporter] Titles loaded, beginning Import process");
                //TitleCollection tc = new TitleCollection();
                IList <Title> titles = OMLSDK.SDKUtilities.ConvertOMLSDKTitlesToTitles(plugin.GetTitles());
                Utilities.DebugLine("[OMLImporter] " + titles.Count + " titles found in input file");
                Console.WriteLine("Found " + titles.Count + " titles");

                int  numberOfTitlesAdded   = 0;
                int  numberOfTitlesSkipped = 0;
                bool YesToAll = autoYesToAll;

                if (flushInputBuffer && Console.In.Peek() > 0)
                {
                    Console.In.ReadToEnd(); // flush out anything still in there
                }
                foreach (Title t in titles)
                {
                    if (TitleCollectionManager.ContainsDisks(t.Disks))
                    {
                        Console.WriteLine("Title {0} skipped because already in the collection", t.Name);
                        numberOfTitlesSkipped++;
                        continue;
                    }


                    Console.WriteLine("Adding: " + t.Name);
                    if (YesToAll == false)
                    {
                        Console.WriteLine("Would you like to add this title? (y/n/a)");
                        string response = Console.ReadLine();
                        switch (response.ToUpper())
                        {
                        case "Y":
                            TitleCollectionManager.AddTitle(t);
                            numberOfTitlesAdded++;
                            break;

                        case "N":
                            numberOfTitlesSkipped++;
                            break;

                        case "A":
                            YesToAll = true;
                            TitleCollectionManager.AddTitle(t);
                            numberOfTitlesAdded++;
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        TitleCollectionManager.AddTitle(t);
                        numberOfTitlesAdded++;
                    }
                }

                // save all the image updates
                TitleCollectionManager.SaveTitleUpdates();

                plugin.GetTitles().Clear();

                //if (numberOfTitlesAdded > 0) isDirty = true;
                Console.WriteLine();
                Console.WriteLine("Added " + numberOfTitlesAdded + " titles");
                Console.WriteLine("Skipped " + numberOfTitlesSkipped + " titles");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in LoadTitlesIntoDatabase: {0}", e.Message);
            }
            //tc.saveTitleCollection();
            //Console.WriteLine("Complete");
        }