Пример #1
0
        public bool Import(IMLSection section, IMLImportProgress progress)
        {


            return MainImportingEngine.DoImport(this, section, progress);


        }
Пример #2
0
 /// <summary>
 /// Retrievies list of movies matching specified movie title
 /// </summary>
 /// <param name="title">Title of movie to search for</param>
 /// <returns>IIMDbMovieCollection object</returns>
 public IIMDbMovieCollection SearchMovieDetails(string title, IMLImportProgress ThisProgress, int CurrentProgress)       
 {
 
         IIMDbMovieCollection list = _db.SearchMovieInfo(title, ThisProgress, CurrentProgress );
         return list;
     
    
 }
Пример #3
0
        public static bool DoImport
            (Importer importer,
            IBaseSystem iBaseSystem,
            IMLSection section,
            IMLImportProgress progress)
        {
            try
            {
                ThisProgress = progress;
                Settings.ImportingStarted   = false;
                Settings.ImportingCompleted = false;


                MediaLocationsRetriever
                .RetrieveMediaLocations
                    (importer);


                if (ImportingEngineHelpers
                    .PerformInitializationTasks(section))
                {
                    return(true);
                }


                var combinedSceneTags =
                    VideoFilenameCleaner
                    .ReadDictionaryReturnAllTags();



                StartMainImportingEngine
                    (importer,
                    iBaseSystem,
                    section,
                    combinedSceneTags);



                ImportingEngineHelpers
                .FinishImport();



                return(true);
            }
            catch (Exception e)
            {
                Debugger.LogMessageToFile
                    ("An unexpected error ocurred " +
                    "in the main import method DoImport(). " +
                    "The error was: " + e);
            }


            return(true);
        }
                public bool Import
                    (IMLSection section,
                     IMLImportProgress progress)
                {

                    return MainImportingEngine.DoImport
                        (this, Ibs, section, progress);
                
                }
        public static bool DoImport(Importer importer,
                     IBaseSystem iBaseSystem,
                     IMLSection section,
                     IMLImportProgress progress)
        {
            try
                    {

                        ThisProgress = progress;
                        Settings.ImportingStarted = false;
                        Settings.ImportingCompleted = false;

                        MediaLocationsRetriever
                            .RetrieveMediaLocations
                            (importer);

                        if (ImportingEngineHelpers
                            .PerformInitializationTasks(section))
                            return true;

                        var combinedSceneTags =
                            VideoFilenameCleaner
                            .ReadDictionaryReturnAllTags();

                        StartMainImportingEngine
                            (importer,
                             iBaseSystem,
                             section,
                             combinedSceneTags);

                        ImportingEngineHelpers
                            .FinishImport();

                        return true;

                    }
                    catch (Exception e)
                    {

                        Debugger.LogMessageToFile
                            ("An unexpected error ocurred " +
                             "in the main import method DoImport(). " +
                             "The error was: " + e);
                    }

                    return true;
        }
        internal static bool DoImport(Importer importer,
            IMLSection section, IMLImportProgress progress)
        {
            try
            {

                #region INIT
                string pluginPath = Helpers.GetPluginPath();
                string debugLogPath = pluginPath + "Debug.log";

                //TODO: Replace ThisProgress with ImportProgress.CurrentProgress
                ThisProgress = progress;
                Settings.ImportingStarted = false;
                Settings.ImportingCompleted = false;

                ImportProgress.GeneralStatus = String.Empty;
                ImportProgress.SpecialStatus = String.Empty;
                ImportProgress.CurrentProgress = 0;

                #endregion

                Helpers.DeleteDebugLog(debugLogPath);

                if (!InternetConnectionDiagnostic.CheckOsDbAvailability())
                    return true;

                MediaSectionUpdater.UpdateMediaSection(section, pluginPath);

                ImportProgress.FinishImport();

                return true;

            }
            catch (Exception e)
            {

                Helpers.LogMessageToFile(
                    "An unexpected error ocurred " +
                    "in Main Import Engine. " +
                    "The error was: " + e);
            }

            return true;
        }
 public bool Import(IMLSection Section, IMLImportProgress Progress)
 {
     String messageBox = String.Empty;
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "bool: " + boolProperty.ToString(CultureInfo.InvariantCulture);
     if (charProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "char: " + charProperty;
       }
       if (choicesProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "choices: " + choicesProperty;
       }
       if (choices2Property != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "choices2: " + choices2Property;
       }
       if (dateProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "date: " + dateProperty;
       }
       if (fileProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "file: " + fileProperty;
       }
       if (folderProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "folder: " + folderProperty;
       }
       if (folderlistProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "folderlist:";
     foreach (String temp in folderlistProperty) {
       messageBox += ((messageBox.EndsWith("folderlist:")) ? "\t" : "\r\n\t") + temp;
     }
       }
       if (intProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "int: " + intProperty.ToString();
       }
       if (maskedtextboxProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "maskedtextbox: " + maskedtextboxProperty;
       }
       if (numericupdownProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "numericupdown: " + numericupdownProperty.ToString();
       }
       if (passwordProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "password: "******"" : "\r\n") + "section: " + sectionProperty;
       }
       if (stringProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "string: " + stringProperty;
       }
       if (stringlistProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "stringlist:";
     foreach (String temp in stringlistProperty) {
       messageBox += ((messageBox.EndsWith("stringlist:")) ? "\t" : "\r\n\t") + temp;
     }
       }
       if (timeProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "time: " + timeProperty;
       }
       if (trackbarProperty != null) {
     messageBox += ((messageBox == String.Empty) ? "" : "\r\n") + "trackbar: " + trackbarProperty.ToString();
       }
       System.Windows.Forms.MessageBox.Show(messageBox);
       return true;
 }
        internal static bool DoImport
            (Importer importer, IMLSection section, 
            IMLImportProgress progress)
        {
            try
            {
                ThisProgress = progress;

                ImportingEngineHelpers.ConfigureUiStartingState();

                Settings.ImportingStarted = false;
                Settings.ImportingCompleted = false;


                #region Open UI
                //StatusForm.StatusForm.statusForm.TrayIcon.ShowBalloonTip(1000, "MediaFairy is working", "Double clck this tray icon to show or hide the importing status window. ", ToolTipIcon.Info);

                //MessageBox.Show(Convert.ToString(UIenabled));

                //if (UIenabled)
                //{
                //    StatusForm.StatusForm.statusForm.Show();

                //    while (!ImportingStarted)
                //    {
                //        Thread.Sleep(20);
                //        Application.DoEvents();

                //    }

                //}
                #endregion


                ImportingEngineHelpers
                    .RetrieveMediaLocations
                    (importer);


                if (ImportingEngineHelpers
                    .PerformInitializationTasks
                    (section))
                    return true;


                IEnumerable<string> combinedSceneTags
                    = VideoFilenameCleaner
                    .ReadDictionaryReturnAllTags();


                StartMainImportingEngine
                    (importer, section, 
                    combinedSceneTags);


                ImportingEngineHelpers
                    .FinishImport();




                return true;

            }
            catch (Exception e)
            {

                StatusForm.statusForm.TrayIcon.ShowBalloonTip(10000, "Import error",
                                                              "An unexpected error ocurred in the main importing process. Please refer to Debug.log for details.",
                                                              ToolTipIcon.Error);

                Debugger.LogMessageToFile(
                    "An unexpected error ocurred in the main import method DoImport(). The error was: " + e);
            }


            return true;
        }
Пример #9
0
        /// <summary>
        /// Retrieves movie matching specified id
        /// </summary>
        /// <param name="imdbID">IMDb.com ID</param>
        /// <returns>IIMDbMovie object</returns>
        /// 


        public IIMDbMovie GetMovieDetails(string imdbID, IMLImportProgress ThisProgress, int CurrentProgress, bool ShowProgress)  
        {
            Debugger.Debugger.LogMessageToFile("Entered GetMovieDetails");

            try
            {
                IIMDbMovie movie = _db.GetMovieInfo(imdbID, ThisProgress, CurrentProgress, ShowProgress);
                return movie;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                return null;
            }
        }
        public bool Import(IMLSection Section, IMLImportProgress Progress)
        {
            XmlDocument IceCastDirectoryXml = new XmlDocument();

            WebClient client = new WebClient();

            const string iceCastDirectoryURL = "http://dir.xiph.org/yp.xml";

            Console.WriteLine("Downloading xml data...");

            Progress.Progress(0, "Loading IceCast station directory...");

            byte[] data = client.DownloadData(iceCastDirectoryURL);

            Stream stream = new MemoryStream(data);

            IceCastDirectoryXml.Load(stream);

            XmlNode directoryNode = IceCastDirectoryXml.ChildNodes[1];

            Console.WriteLine(directoryNode.Name);

            XmlNodeList directoryEntries = directoryNode.ChildNodes;

            Section.BeginUpdate();

            foreach (XmlNode radioStation in directoryEntries)
            {

                XmlNodeList stationProperties = radioStation.ChildNodes;

                string itemName = String.Empty;
                string itemLocation = String.Empty;
                string itemBitrate = String.Empty;
                string itemGenre = String.Empty;

                foreach (XmlNode stationProperty in stationProperties)
                {

                    if (stationProperty.Name == "server_name")
                    {
                        itemName = stationProperty.InnerText;

                    }

                    if (stationProperty.Name == "listen_url")
                    {
                        itemLocation = stationProperty.InnerText;

                    }

                    if (stationProperty.Name == "bitrate")
                    {
                        itemBitrate = stationProperty.InnerText;

                    }

                    if (stationProperty.Name == "genre")
                    {
                        itemGenre = stationProperty.InnerText;

                    }

                }

                if (String.IsNullOrEmpty(itemName))
                    continue;

                if (String.IsNullOrEmpty(itemLocation))
                    continue;

                IMLItem item
                    = Section.AddNewItem
                    (itemName, itemLocation);

                item.Tags["BitRate"] = itemBitrate;
                item.Tags["Genre"] = itemGenre;

                item.SaveTags();

            }

            Section.EndUpdate();

            Progress.Progress(100, "RadioActive completed succesfully!");

            return true;
        }
        internal static void ImportPcGames(IMLImportProgress progress, IMLSection gamesSection)
        {

            if ((!Settings.EnableGamesUpdater && !Settings.EnableGamesImporter))
                return;
                            
            if (String.IsNullOrEmpty(Settings.GameShortcutsLocation) )
                return;

            if ( !File.Exists(Settings.GameShortcutsLocation) )
            return;


            Importer.ThisProgress = progress;
            //Importer.GeneralStatus = "Updating Games Section";
            Importer.SpecialStatus = String.Empty;
            Importer.ThisProgress.Progress(Importer.CurrentProgress, "Updating Games Section...");

            DirectoryInfo pcGamesFolder = new DirectoryInfo(Settings.GameShortcutsLocation);
            FileInfo[] shortcuts = pcGamesFolder.GetFiles("*.lnk", SearchOption.AllDirectories);
            //IMLSection GamesSection = Importer.library.FindSection("Games", true);

            #region Man importing engine

            int itemCounter = 0;
            WshShell shell = new WshShellClass();

            gamesSection.BeginUpdate();

            foreach (FileInfo shortcut in shortcuts)
            {
                int progressStep = 100 / shortcuts.Length;
                Importer.CurrentProgress = 100 - (progressStep * (shortcuts.Length - itemCounter));

                ImportPcGame(shell, shortcut.FullName, gamesSection);
                itemCounter++;
            }

            gamesSection.EndUpdate();

            #endregion

            #region Update

            if (!Settings.EnableGamesUpdater) return;


           

            gamesSection.BeginUpdate();
            itemCounter = 0;
            int[] allItemIDs = gamesSection.GetAllItemIDs();

            foreach (int id in allItemIDs)
            {
                IMLItem item = gamesSection.FindItemByID(id);
                int progressStep = 100 / allItemIDs.Length;
                Importer.CurrentProgress = 100 - (progressStep * (allItemIDs.Length - itemCounter));
                Downloaders.DownloadGameDetailsFromMobyGames(item);

                Helpers.UserCancels(Importer.SpecialStatus, item);

                itemCounter++;
            }

            gamesSection.EndUpdate();
            
            

            #endregion

        } //endof function
        /// <exception cref="FileImporterInitializationException"><c>FileImporterInitializationException</c>.</exception>
        public bool Import(IMLSection section, IMLImportProgress progress)
        {
            CoreEngineHelpers.Snapshot();
            try
            {
                if (!Initialized)
                {
                    throw new FileImporterInitializationException();
                }

                Section = section;
                ImportProgress = progress;
                using (ImportFunc = new TheImport(this))
                {
                    ImportCore.Run(this.ImportFunc);
                }
            }
            catch (FileImporterInitializationException ex)
            {
                MessageBox.Show(ex.Message);
            }

            CoreEngineHelpers.Snapshot();
            return true;
        }