Exemple #1
0
 private void cmdInit_Click(object sender, EventArgs e)
 {
     m_tvdbHandler = new TvdbHandler(new XmlCacheProvider("C:\\test"), "E8D8A47528D5B5AD");
       m_tvdbHandler.InitCache();
       cmdEnd.Enabled = true;
       cmdLoadSeries.Enabled = true;
 }
Exemple #2
0
 public EPG_Control_V3(string SourceDirectory)
 {
   this.sourceDirectory = SourceDirectory;
   currentTime = DateTime.Now;
   lastTime = DateTime.Now.AddHours(4);
   incrementalTime = new System.TimeSpan(0, 30, 0);
   epg_Data = new EPG_Program_Channel();
   epg_Times = new EPG_Time();
   epg_SelectedItem = new EPG_SelectedItem();
   tvdbHandler = new TvdbHandler(new XmlCacheProvider("C:\\test"), "572328F18DC4374A");
   tvdbHandler.InitCache();
   client = new TMDbClient("ecaa9ae8c8346269b53c80e2a61aa0ea");
   client.GetConfig();
   epg_ChannelIndex = 0;
   epg_ProgramIndex = 0;
 }
        public TVDBTVShowMetadataSource(IFileSystem fileSystem, string apiKey)
        {
            // Set fileSystem.
            _fileSystem = fileSystem;

            // Make cache directory.
            var assemblyName = Assembly.GetExecutingAssembly().GetName().Name;
            _tvdbCacheDirectory = _fileSystem.DirectoryInfo.FromDirectoryName(_fileSystem.Path.Combine(_fileSystem.Path.GetTempPath(), assemblyName + _fileSystem.Path.DirectorySeparatorChar +"TVDBCache"));
            if(!_tvdbCacheDirectory.Exists)
            {
                _tvdbCacheDirectory.Create();
            }

            // Initalise handler with cache.
            _tvdbHandler = new TvdbHandler(new XmlCacheProvider(_tvdbCacheDirectory.FullName), apiKey);
            if(!_tvdbHandler.IsCacheInitialised)
            {
                _tvdbHandler.InitCache();
            }
        }
Exemple #4
0
 public EPG_Control_V4(string SourceDirectory)
 {
   this.sourceDirectory = SourceDirectory;;
   if (DateTime.Now.Minute < 30)
     currentTime = DateTime.Now.AddMinutes(-DateTime.Now.Minute);
   else
     currentTime = DateTime.Now.AddMinutes(30 - DateTime.Now.Minute);
   currentSelectedTime = currentTime;
   lastTime = currentTime.AddHours(2);
   currentChannel = 0;
   lastChannel = 2;
   incrementalTime = new System.TimeSpan(0, 30, 0);
   epg_Data = new EPG_Program_Channel();
   epg_Times = new EPG_Time();
   epg_SelectedItem = new EPG_SelectedItem();
   tvdbHandler = new TvdbHandler(new XmlCacheProvider("C:\\test"), "572328F18DC4374A");
   tvdbHandler.InitCache();
   client = new TMDbClient("ecaa9ae8c8346269b53c80e2a61aa0ea");
   client.GetConfig();
 }
Exemple #5
0
    public EPG_Control_V2(string SourceDirectory)
    {
      this.sourceDirectory = SourceDirectory;
      epg_Data = new EPG_Program_Channel();
      epg_Times = new EPG_Time();
      epg_SelectedItem = new EPG_SelectedItem();
      tvdbHandler = new TvdbHandler(new XmlCacheProvider("C:\\test"), "572328F18DC4374A");
      tvdbHandler.InitCache();
      client = new TMDbClient("ecaa9ae8c8346269b53c80e2a61aa0ea");
      client.GetConfig();
      epg_ChannelIndex = 0;
      epg_ProgramIndex = 0;
      incTimeSpan = new TimeSpan(0, 30, 0);
      int ts = 0;

      if (DateTime.Now.Minute < 30)      
        ts = -(DateTime.Now.Minute);      
      else      
        ts = 30 - DateTime.Now.Minute;        
      
      currentTime = DateTime.Now.AddMinutes(ts);
      lastTime = currentTime.AddHours(2);
    }
        private void init()
        {
            string cache = PluginSettings.TvDbLibCache;
              string tvdbid = "BBB734ABE146900D";  // mine, don't abuse it!!!
              tvdbHandler = new TvdbHandler(new XmlCacheProvider(cache),tvdbid);
              tvdbHandler.InitCache();

              seriesNameMapping = PluginSettings.TvDbSeriesMappings;
        }
Exemple #7
0
        private void cmdInit_Click(object sender, EventArgs e)
        {
            m_tvdbHandler = new TvdbHandler(new XmlCacheProvider("C:\\test"), File.ReadAllText("api_key.txt"));
              m_tvdbHandler.InitCache();
              //m_tvdbHandler.ClearCache();
              //m_tvdbHandler.GetBasicSeries(73545, TvdbLanguage.DefaultLanguage, false);
              //TvdbSeries s = m_tvdbHandler.GetSeries(73545, TvdbLanguage.DefaultLanguage, true, true, true);

              List<TvdbLanguage> lang = m_tvdbHandler.Languages;
              cmdTest1.Enabled = true;
              cmdTestZip.Enabled = true;
              cmdGetEpisodes.Enabled = true;
              cmdEnd.Enabled = true;
              cmdSetUser.Enabled = true;
              cmdGetEpisodeAired.Enabled = true;
        }
Exemple #8
0
        /// <summary>
        /// Initialise the form
        /// </summary>
        /// <param name="_userId"></param>
        public void InitialiseForm(String _userId, ICacheProvider _provider)
        {
            //m_tvdbHandler = new Tvdb(new BinaryCacheProvider(@"cachefile.bin"), Resources.API_KEY);new XmlCacheProvider("XmlCache")

              m_tvdbHandler = new TvdbHandler(_provider, Resources.API_KEY);
              m_tvdbHandler.InitCache();

              List<TvdbLanguage> m_languages = m_tvdbHandler.Languages;

              foreach (TvdbLanguage l in m_languages)
              {
            if (l.Abbriviation.Equals("en")) m_currentLanguage = l;
            cbLanguage.Items.Add(l);
              }
              lblCurrentLanguage.Text = "[" + m_currentLanguage.ToString() + "]";

              //enable/disable community features
              if (_userId != null)
              {
            TvdbUser user = new TvdbUser("user", _userId);
            m_tvdbHandler.UserInfo = user;
            List<TvdbSeries> favList = null;
            try
            {
              user.UserPreferredLanguage = m_tvdbHandler.GetPreferredLanguage();
              favList = m_tvdbHandler.GetUserFavorites(user.UserPreferredLanguage);
            }
            catch (TvdbInvalidApiKeyException ex)
            {
              MessageBox.Show(ex.Message);
            }
            catch (TvdbNotAvailableException ex)
            {
              MessageBox.Show(ex.Message);
            }

            if (favList != null)
            {
              foreach (TvdbSeries s in favList)
              {
            if (s != null)
            {
              cbUserFavourites.Items.Add(s);
            }
              }
            }
              }
              else
              {
            cbUserFavourites.Text = "No userinfo set";
            cbUserFavourites.Enabled = false;
              }

              cmdAddRemoveFavorites.Enabled = false;
              cmdSendSeriesRating.Enabled = false;
              raterSeriesYourRating.Enabled = false;
        }
Exemple #9
0
 private void cmdInit_Click(object sender, EventArgs e)
 {
     m_tvdbHandler = new TvdbHandler(new XmlCacheProvider("C:\\test"), "");
       m_tvdbHandler.InitCache();
       cmdEnd.Enabled = true;
 }
Exemple #10
0
        private void InitTvdblibHandler()
        {
            ICacheProvider provider;
              if (cbCacheType.SelectedIndex == 0 || cbCacheType.SelectedIndex == -1)
              {
            provider = new XmlCacheProvider(txtCacheLocation.Text);
              }
              else
              {
            provider = new BinaryCacheProvider(txtCacheLocation.Text);
              }

              lbCacheSnapshots.Items.Clear();
              foreach (String f in Directory.GetFiles(Directory.GetCurrentDirectory(), "Rev_*.zip"))
              {
            FileInfo file = new FileInfo(f);
            CacheRevision rev = CacheRevision.CreateFromFile(file);

            if (rev != null)
            {
              lbCacheSnapshots.Items.Add(rev);
            }
              }

              m_tvdbHandler = new TvdbHandler(provider, File.ReadAllText("api_key.txt"));
              // m_tvdbHandler.UserInfo = new TvdbLib.Data.TvdbUser("DieBagger", txtUserId.Text);
              m_tvdbHandler.InitCache();
              txtLastUpdated.Text = m_tvdbHandler.GetLastUpdate().ToString();

              List<int> cached = m_tvdbHandler.GetCachedSeries();
              lvCachedSeries.Items.Clear();
              cached.ForEach(delegate(int s)
              {
            ListViewItem item = new ListViewItem(s.ToString());
            item.SubItems.Add("");
            item.Tag = s;
            lvCachedSeries.Items.Add(item);
              });
              m_tvdbDownloader = new TvdbDownloader(File.ReadAllText("api_key.txt"));
              m_tvdbHandler.UpdateFinished += new TvdbHandler.UpdateFinishedDelegate(m_tvdbHandler_UpdateFinished);
        }
Exemple #11
0
        private void LazyInitialization()
        {
            //Initialize once per instance here, not Startup() to avoid slowing down application startup.
            if (m_tvdbHandler != null)
                return;

            m_tvdbHandler = new TvdbHandler(new XmlCacheProvider("C:\\temp\\tvdbcache"), "BC8024C516DFDA3B");
            m_tvdbHandler.InitCache();

            if (DateTimeOffset.Now - m_LastUpdateTime > TimeSpan.FromDays(1)) {
                log.InfoFormat("Updating all series since it's been {0} since the last update.", DateTimeOffset.Now - m_LastUpdateTime);
                m_tvdbHandler.UpdateAllSeries(TvdbHandler.Interval.automatic, true);
                LastUpdateTime = DateTimeOffset.Now;
                log.DebugFormat("Update OK.");
            } else {
                log.InfoFormat("Not updating since it's only been {0} since the last update.", DateTimeOffset.Now - m_LastUpdateTime);
            }
        }
Exemple #12
0
 private void cmdInit_Click(object sender, EventArgs e)
 {
     m_tvdbHandler = new TvdbHandler(new XmlCacheProvider("C:\\test"), "");
       m_tvdbHandler.InitCache();
       List<TvdbLanguage> lang = m_tvdbHandler.Languages;
       cmdTest1.Enabled = true;
       cmdTestZip.Enabled = true;
       cmdGetEpisodes.Enabled = true;
       cmdEnd.Enabled = true;
       cmdSetUser.Enabled = true;
       cmdGetEpisodeAired.Enabled = true;
 }