private void ImportThread()
        {
            try
            {
                _isImporting = true;

                try
                {
                    _database = new TvMovieDatabase();
                    _database.Connect();
                }
                catch (Exception)
                {
                    Log.Error("TVMovie: Import enabled but the ClickFinder database was not found.");
                    return;
                }

                //Log.Debug("TVMovie: Checking database");
                try
                {
                    if (_database.NeedsImport)
                    {
                        SetStandbyAllowed(false);

                        long updateDuration = _database.LaunchTVMUpdater(true);
                        if (updateDuration < 1200)
                        {
                            // Updating a least a few programs should take more than 20 seconds
                            if (updateDuration > 20)
                            {
                                _database.Import();
                            }
                            else
                            {
                                Log.Info("TVMovie: Import skipped because there was no new data.");
                            }
                        }
                        else
                        {
                            Log.Info("TVMovie: Import skipped because the update process timed out / has been aborted.");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Info("TvMovie plugin error:");
                    Log.Write(ex);
                }
            }
            finally
            {
                _isImporting = false;
                SetStandbyAllowed(true);
            }
        }
Example #2
0
    private void ImportThread()
    {
      try
      {
        _isImporting = true;

        try
        {
          _database = new TvMovieDatabase();
          _database.Connect();
        }
        catch (Exception)
        {
          Log.Error("TVMovie: Import enabled but the ClickFinder database was not found.");
          return;
        }

        //Log.Debug("TVMovie: Checking database");
        try
        {
          if (_database.NeedsImport)
          {
            SetStandbyAllowed(false);

            long updateDuration = _database.LaunchTVMUpdater(true);
            if (updateDuration < 1200)
            {
              // Updating a least a few programs should take more than 20 seconds
              if (updateDuration > 20)
              {
                Log.Debug("TVMovie: importing database");
                _database.Import();
                Log.Debug("TVMovie: clearing personal tv guide");
                ClearPersonalTVGuideMap();
                Log.Debug("TVMovie: creating ProgramUpdated event");
                _tvController.Fire(this, new TvServerEventArgs(TvServerEventType.ProgramUpdated));
              }
              else
                Log.Info("TVMovie: Import skipped because there was no new data.");
            }
            else
              Log.Info("TVMovie: Import skipped because the update process timed out / has been aborted.");
          }
        }
        catch (Exception ex)
        {
          Log.Info("TvMovie plugin error:");
          Log.Write(ex);
        }
      }
      finally
      {
        _isImporting = false;
        SetStandbyAllowed(true);
      }
    }
Example #3
0
    private void ImportThread()
    {
      try
      {
        _isImporting = true;

        try
        {
          _database = new TvMovieDatabase();
          _database.Connect();
        }
        catch (Exception)
        {
          Log.Error("TVMovie: Import enabled but the ClickFinder database was not found.");
          return;
        }

        //Log.Debug("TVMovie: Checking database");
        try
        {
          if (_database.NeedsImport)
          {
            SetStandbyAllowed(false);

            long updateDuration = _database.LaunchTVMUpdater(true);
            if (updateDuration < 1200)
            {
              // Updating a least a few programs should take more than 20 seconds
              if (updateDuration > 20)
                _database.Import();
              else
                Log.Info("TVMovie: Import skipped because there was no new data.");
            }
            else
              Log.Info("TVMovie: Import skipped because the update process timed out / has been aborted.");
          }
        }
        catch (Exception ex)
        {
          Log.Info("TvMovie plugin error:");
          Log.Write(ex);
        }
      }
      finally
      {
        _isImporting = false;
        SetStandbyAllowed(true);
      }
    }