예제 #1
0
        public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh)
        {
            if (!TVSettings.Instance.NFOEpisodes)
            {
                return(null);
            }

            string   fn  = filo.RemoveExtension() + ".nfo";
            FileInfo nfo = FileHelper.FileInFolder(filo.Directory, fn);

            if (nfo.Exists && (dbep.SrvLastUpdated <= TimeZone.Epoch(nfo.LastWriteTime)) && !forceRefresh)
            {
                return(new ItemList());
            }

            //If we do not already have plans to put the file into place
            if (DoneNfo.Contains(nfo.FullName))
            {
                return(new ItemList());
            }

            DoneNfo.Add(nfo.FullName);
            return(new ItemList {
                new ActionNfo(nfo, dbep)
            });
        }
예제 #2
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            if (TVSettings.Instance.Mede8erXML)
            {
                ItemList TheActionList = new ItemList();

                FileInfo tvshowxml = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "series.xml");

                bool needUpdate = !tvshowxml.Exists ||
                                  (si.TheSeries().Srv_LastUpdated > TimeZone.Epoch(tvshowxml.LastWriteTime));

                if (forceRefresh || needUpdate)
                {
                    TheActionList.Add(new ActionMede8erXML(tvshowxml, si));
                }

                //Updates requested by [email protected] on 18/4/2013
                FileInfo viewxml = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "view.xml");
                if (!viewxml.Exists)
                {
                    TheActionList.Add(new ActionMede8erViewXML(viewxml, si));
                }


                return(TheActionList);
            }

            return(base.ProcessShow(si, forceRefresh));
        }
예제 #3
0
        public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh)
        {
            if (!TVSettings.Instance.pyTivoMeta)
            {
                return(null);
            }

            ItemList theActionList = new ItemList();
            string   fn            = filo.Name + ".txt";

            string folder = filo.DirectoryName;

            if (TVSettings.Instance.pyTivoMetaSubFolder)
            {
                folder += "\\.meta";
            }
            FileInfo meta = FileHelper.FileInFolder(folder, fn);

            if (!meta.Exists || (dbep.SrvLastUpdated > TimeZone.Epoch(meta.LastWriteTime)))
            {
                theActionList.Add(new ActionPyTivoMeta(meta, dbep));
            }

            return(theActionList);
        }
        public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh)
        {
            if (TVSettings.Instance.Mede8erXML)
            {
                ItemList TheActionList = new ItemList();
                string   fn            = filo.RemoveExtension() + ".xml";
                FileInfo nfo           = FileHelper.FileInFolder(filo.Directory, fn);

                if (forceRefresh || !nfo.Exists || (dbep.Srv_LastUpdated > TimeZone.Epoch(nfo.LastWriteTime)))
                {
                    TheActionList.Add(new ActionMede8erXML(nfo, dbep));
                }

                return(TheActionList);
            }
            return(base.ProcessEpisode(dbep, filo, forceRefresh));
        }
예제 #5
0
 public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
 {
     if (TVSettings.Instance.wdLiveTvMeta)
     {
         ItemList theActionList = new ItemList();
         FileInfo tvshowxml     = FileHelper.FileInFolder(si.AutoAddFolderBase, "series.xml");
         bool     needUpdate    = !tvshowxml.Exists ||
                                  (si.TheSeries().SrvLastUpdated > TimeZone.Epoch(tvshowxml.LastWriteTime));
         if ((forceRefresh || needUpdate) && (!doneFiles.Contains(tvshowxml.FullName)))
         {
             doneFiles.Add(tvshowxml.FullName);
             theActionList.Add(new ActionWdtvMeta(tvshowxml, si));
         }
         return(theActionList);
     }
     return(base.ProcessShow(si, forceRefresh));
 }
예제 #6
0
        public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh)
        {
            if (!TVSettings.Instance.wdLiveTvMeta)
            {
                return(null);
            }

            ItemList theActionList = new ItemList();
            string   fn            = filo.RemoveExtension() + ".xml";
            FileInfo nfo           = FileHelper.FileInFolder(filo.Directory, fn);

            if (forceRefresh || !nfo.Exists || (dbep.SrvLastUpdated > TimeZone.Epoch(nfo.LastWriteTime)))
            {
                theActionList.Add(new ActionWdtvMeta(nfo, dbep));
            }

            return(theActionList);
        }
        public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh)
        {
            if (TVSettings.Instance.NFOEpisodes)
            {
                ItemList TheActionList = new ItemList();

                string   fn  = filo.RemoveExtension() + ".nfo";
                FileInfo nfo = FileHelper.FileInFolder(filo.Directory, fn);

                if (!nfo.Exists || (dbep.Srv_LastUpdated > TimeZone.Epoch(nfo.LastWriteTime)) || forceRefresh)
                {
                    //If we do not already have plans to put the file into place
                    if (!(DownloadKodiMetaData.doneNFO.Contains(nfo.FullName)))
                    {
                        TheActionList.Add(new ActionNFO(nfo, dbep));
                        doneNFO.Add(nfo.FullName);
                    }
                }
                return(TheActionList);
            }
            return(base.ProcessEpisode(dbep, filo, forceRefresh));
        }
예제 #8
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            // for each tv show, optionally write a tvshow.nfo file
            if (TVSettings.Instance.NFOShows)
            {
                ItemList TheActionList = new ItemList();
                FileInfo tvshownfo     = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "tvshow.nfo");

                bool needUpdate = !tvshownfo.Exists ||
                                  (si.TheSeries().Srv_LastUpdated > TimeZone.Epoch(tvshownfo.LastWriteTime)) ||
                                  // was it written before we fixed the bug in <episodeguideurl> ?
                                  (tvshownfo.LastWriteTime.ToUniversalTime().CompareTo(new DateTime(2009, 9, 13, 7, 30, 0, 0, DateTimeKind.Utc)) < 0);

                bool alreadyOnTheList = DownloadKODIMetaData.doneNFO.Contains(tvshownfo.FullName);

                if ((forceRefresh || needUpdate) && !alreadyOnTheList)
                {
                    TheActionList.Add(new ActionNFO(tvshownfo, si));
                    DownloadKODIMetaData.doneNFO.Add(tvshownfo.FullName);
                }
                return(TheActionList);
            }
            return(base.ProcessShow(si, forceRefresh));
        }
예제 #9
0
파일: TheTVDB.cs 프로젝트: tijonx/tvrename
        public bool GetUpdates()
        {
            this.Say("Updates list");

            if (!this.Connected && !this.Connect())
            {
                this.Say("");
                return(false);
            }

            long theTime = this.Srv_Time;

            if (theTime == 0)
            {
                // we can use the oldest thing we have locally.  It isn't safe to use the newest thing.
                // This will only happen the first time we do an update, so a false _all update isn't too bad.
                foreach (System.Collections.Generic.KeyValuePair <int, SeriesInfo> kvp in this.Series)
                {
                    SeriesInfo ser = kvp.Value;
                    if ((theTime == 0) || ((ser.Srv_LastUpdated != 0) && (ser.Srv_LastUpdated < theTime)))
                    {
                        theTime = ser.Srv_LastUpdated;
                    }
                    foreach (System.Collections.Generic.KeyValuePair <int, Season> kvp2 in kvp.Value.Seasons)
                    {
                        Season seas = kvp2.Value;

                        foreach (Episode e in seas.Episodes)
                        {
                            if ((theTime == 0) || ((e.Srv_LastUpdated != 0) && (e.Srv_LastUpdated < theTime)))
                            {
                                theTime = e.Srv_LastUpdated;
                            }
                        }
                    }
                }
            }

            // anything with a srv_lastupdated of 0 should be marked as dirty
            // typically, this'll be placeholder series
            foreach (System.Collections.Generic.KeyValuePair <int, SeriesInfo> kvp in this.Series)
            {
                SeriesInfo ser = kvp.Value;
                if ((ser.Srv_LastUpdated == 0) || (ser.Seasons.Count == 0))
                {
                    ser.Dirty = true;
                }
                foreach (System.Collections.Generic.KeyValuePair <int, Season> kvp2 in kvp.Value.Seasons)
                {
                    foreach (Episode ep in kvp2.Value.Episodes)
                    {
                        if (ep.Srv_LastUpdated == 0)
                        {
                            ep.Dirty = true;
                        }
                    }
                }
            }

            if (theTime == 0)
            {
                this.Say("");
                return(true); // that's it for now
            }

            long seconds = TimeZone.Epoch() - theTime;

            if (seconds < 3540) // 59 minutes
            {
                this.Say("");
                return(true);
            }

            string timePeriod = "";

            int howLongDays = (int)(seconds / (60 * 60 * 24));

            if ((howLongDays < 1) || (this.Series.Count == 0))
            {
                timePeriod = "day";
            }
            else if ((howLongDays >= 1) && (howLongDays < 7))
            {
                timePeriod = "week";
            }
            else if ((howLongDays >= 7) && (howLongDays < 28))
            {
                timePeriod = "month";
            }
            else
            {
                timePeriod = "all";
            }

            if (timePeriod != "all")
            {
                this.Say("Updates list for the " + timePeriod);
            }
            else
            {
                this.Say("Updates list for everything");
            }

            // http://thetvdb.com/api/5FEC454623154441/updates/updates_day.xml
            // day, week, month, all

            string udf = "updates_" + timePeriod;

            byte[] p = this.GetPageZIP("updates/" + udf + ".zip", udf + ".xml", true, false);
            if (p == null)
            {
                this.Say("");
                return(false);
            }
            //BinaryWriter ^fs = gcnew BinaryWriter(gcnew FileStream("c:\\temp\\ud.xml", FileMode::Create));
            //fs->Write(p, 0, p->Length);
            //fs->Close();

            MemoryStream ms = new MemoryStream(p);

            this.Say("");

            return(this.ProcessUpdateList(ms));
        }