示例#1
0
        private DateTimeZone FigureOutTimeZone()
        {
            string tzstr = ShowTimeZone;

            if (string.IsNullOrEmpty(tzstr))
            {
                tzstr = TimeZoneHelper.DefaultTimeZone();
            }

            try
            {
                return(DateTimeZoneProviders.Tzdb[tzstr]);
            }
            catch (Exception ex)
            {
                LOGGER.Info($"Could not work out what timezone '{ShowName}' has. In the settings it uses '{tzstr}', Testing to see whether it needs to be upgraded: {ex.Message}");
                try
                {
                    tzstr         = TZConvert.WindowsToIana(tzstr);
                    ShowTimeZone  = tzstr;
                    lastFiguredTz = tzstr;
                    return(DateTimeZoneProviders.Tzdb[tzstr]);
                }
                catch (Exception ex2)
                {
                    LOGGER.Warn(ex2,
                                $"Could not work out what timezone '{ShowName}' has. In the settings it uses '{tzstr}', but that is not valid. Please update. Using the default timezone {TimeZoneHelper.DefaultTimeZone()} for the show instead.");

                    try
                    {
                        tzstr         = TimeZoneHelper.DefaultTimeZone();
                        ShowTimeZone  = tzstr;
                        lastFiguredTz = tzstr;
                        return(DateTimeZoneProviders.Tzdb[tzstr]);
                    }
                    catch (Exception ex3)
                    {
                        LOGGER.Warn(ex3,
                                    $"Could not work out what timezone '{ShowName}' has. In the settings it uses '{tzstr}', but that is not valid. Tried to use the default timezone {TimeZoneHelper.DefaultTimeZone()} for the show instead - also invalid.  Please update.");


                        ShowTimeZone  = DateTimeZoneProviders.Tzdb.GetSystemDefault().Id;
                        lastFiguredTz = tzstr;
                        return(DateTimeZoneProviders.Tzdb.GetSystemDefault());
                    }
                }
            }
        }
示例#2
0
        public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh)
        {
            if (!TVSettings.Instance.Mede8erXML)
            {
                return(null);
            }

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

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

            return(theActionList);
        }
        public override ItemList?ProcessEpisode(ProcessedEpisode episode, FileInfo file, bool forceRefresh)
        {
            if (!TVSettings.Instance.wdLiveTvMeta)
            {
                return(null);
            }

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

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

            return(theActionList);
        }
示例#4
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");

                SeriesInfo seriesInfo = si.TheSeries();
                bool       needUpdate = !tvshowxml.Exists ||
                                        seriesInfo is null ||
                                        seriesInfo.SrvLastUpdated > TimeZoneHelper.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));
        }
示例#5
0
        private void SetDefaults()
        {
            ManualFolderLocations = new Dictionary <int, List <string> >();
            SeasonRules           = new Dictionary <int, List <ShowRule> >();
            SeasonEpisodes        = new Dictionary <int, List <ProcessedEpisode> >();
            IgnoreSeasons         = new List <int>();

            UseCustomShowName             = false;
            CustomShowName                = string.Empty;
            UseCustomLanguage             = false;
            TvdbCode                      = -1;
            UseCustomSearchUrl            = false;
            CustomSearchUrl               = string.Empty;
            ManualFoldersReplaceAutomatic = false;
            BannersLastUpdatedOnDisk      = null;                             //assume that the banners are old and have expired
            ShowTimeZone                  = TimeZoneHelper.DefaultTimeZone(); // default, is correct for most shows
            lastFiguredTz                 = string.Empty;

            UseSequentialMatch  = TVSettings.Instance.DefShowSequentialMatching;
            ShowNextAirdate     = TVSettings.Instance.DefShowNextAirdate;
            DoRename            = TVSettings.Instance.DefShowDoRenaming;
            DoMissingCheck      = TVSettings.Instance.DefShowDoMissingCheck;
            CountSpecials       = TVSettings.Instance.DefShowSpecialsCount;
            DvdOrder            = TVSettings.Instance.DefShowDVDOrder;
            ForceCheckNoAirdate = TVSettings.Instance.DefShowIncludeNoAirdate;
            ForceCheckFuture    = TVSettings.Instance.DefShowIncludeFuture;

            AutoAddCustomFolderFormat = CustomSeasonName.DefaultStyle();

            AutoAddFolderBase =
                !TVSettings.Instance.DefShowAutoFolders ? string.Empty
                : !TVSettings.Instance.DefShowUseDefLocation ?string.Empty
                :  TVSettings.Instance.DefShowLocation + Path.DirectorySeparatorChar + TVSettings.Instance.FilenameFriendly(FileHelper.MakeValidPath(ShowName));

            AutoAddType =
                !TVSettings.Instance.DefShowAutoFolders ? AutomaticFolderType.none
                :TVSettings.Instance.DefShowUseBase ? AutomaticFolderType.baseOnly
                :AutomaticFolderType.libraryDefault;
        }
示例#6
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.AutoAddFolderBase, "tvshow.nfo");

                SeriesInfo seriesInfo = si.TheSeries();
                bool       needUpdate = !tvshownfo.Exists ||
                                        seriesInfo is null ||
                                        seriesInfo.SrvLastUpdated > TimeZoneHelper.Epoch(tvshownfo.LastWriteTime);

                bool alreadyOnTheList = DoneNfo.Contains(tvshownfo.FullName);

                if ((forceRefresh || needUpdate) && !alreadyOnTheList)
                {
                    theActionList.Add(new ActionNfo(tvshownfo, si));
                    DoneNfo.Add(tvshownfo.FullName);
                }
                return(theActionList);
            }
            return(base.ProcessShow(si, forceRefresh));
        }
示例#7
0
        private void SetShow()
        {
            int code = codeFinderForm.SelectedCode();

            selectedShow.CustomShowName    = txtCustomShowName.Text;
            selectedShow.UseCustomShowName = chkCustomShowName.Checked;
            selectedShow.UseCustomLanguage = chkCustomLanguage.Checked;
            if (selectedShow.UseCustomLanguage)
            {
                selectedShow.CustomLanguageCode = TheTVDB.Instance.LanguageList
                                                  .GetLanguageFromLocalName(cbLanguage.SelectedItem?.ToString())?.Abbreviation ?? TVSettings.Instance.PreferredLanguageCode;
            }
            selectedShow.ShowTimeZone              = cbTimeZone.SelectedItem?.ToString() ?? TimeZoneHelper.DefaultTimeZone();
            selectedShow.ShowNextAirdate           = chkShowNextAirdate.Checked;
            selectedShow.TvdbCode                  = code;
            selectedShow.CountSpecials             = chkSpecialsCount.Checked;
            selectedShow.DoRename                  = cbDoRenaming.Checked;
            selectedShow.DoMissingCheck            = cbDoMissingCheck.Checked;
            selectedShow.AutoAddCustomFolderFormat = txtSeasonFormat.Text;
            selectedShow.AutoAddFolderBase         = txtBaseFolder.Text;

            selectedShow.AutoAddType = GetAutoAddType();

            selectedShow.DvdOrder                      = chkDVDOrder.Checked;
            selectedShow.ForceCheckFuture              = cbIncludeFuture.Checked;
            selectedShow.ForceCheckNoAirdate           = cbIncludeNoAirdate.Checked;
            selectedShow.UseCustomSearchUrl            = cbUseCustomSearch.Checked;
            selectedShow.CustomSearchUrl               = txtSearchURL.Text;
            selectedShow.ManualFoldersReplaceAutomatic = chkReplaceAutoFolders.Checked;

            selectedShow.UseSequentialMatch = cbSequentialMatching.Checked;

            string slist = txtIgnoreSeasons.Text;

            selectedShow.IgnoreSeasons.Clear();
            foreach (Match match in Regex.Matches(slist, "\\b[0-9]+\\b"))
            {
                selectedShow.IgnoreSeasons.Add(int.Parse(match.Value));
            }

            selectedShow.ManualFolderLocations.Clear();
            foreach (ListViewItem lvi in lvSeasonFolders.Items)
            {
                try
                {
                    int seas = int.Parse(lvi.Text);
                    if (!selectedShow.ManualFolderLocations.ContainsKey(seas))
                    {
                        selectedShow.ManualFolderLocations.Add(seas, new List <string>());
                    }

                    selectedShow.ManualFolderLocations[seas].Add(lvi.SubItems[1].Text);
                }
                catch
                {
                    // ignored
                }
            }

            selectedShow.AliasNames.Clear();
            foreach (string showAlias in lbShowAlias.Items)
            {
                if (!selectedShow.AliasNames.Contains(showAlias))
                {
                    selectedShow.AliasNames.Add(showAlias);
                }
            }
        }
示例#8
0
        private void FigureOutTimeZone()
        {
            string tzstr = ShowTimeZone;

            if (string.IsNullOrEmpty(tzstr))
            {
                tzstr = TimeZoneHelper.DefaultTimeZone();
            }

            try
            {
                seriesTimeZone = TimeZoneInfo.FindSystemTimeZoneById(tzstr);
            }
            catch (Exception ex)
            {
                Logger.Warn(ex, $"Could not work out what timezone '{ShowName}' has. In the settings it uses '{tzstr}', but that is not valid. Please update. Using the default timezone {TimeZoneHelper.DefaultTimeZone()} for the show instead.");
                try
                {
                    tzstr          = TimeZoneHelper.DefaultTimeZone();
                    seriesTimeZone = TimeZoneInfo.FindSystemTimeZoneById(tzstr);
                }
                catch (Exception)
                {
                    Logger.Warn(ex, $"Could not work out what timezone '{ShowName}' has. In the settings it uses '{tzstr}', but that is not valid. Tried to use the default timezone {TimeZoneHelper.DefaultTimeZone()} for the show instead - also invalid.  Please update.");
                    seriesTimeZone = TimeZoneInfo.Local;
                }
            }

            lastFiguredTz = tzstr;
        }
示例#9
0
        private void SetShow()
        {
            int code = codeFinderForm.SelectedCode();

            selectedShow.CustomShowName    = txtCustomShowName.Text;
            selectedShow.UseCustomShowName = chkCustomShowName.Checked;
            selectedShow.UseCustomLanguage = chkCustomLanguage.Checked;
            if (selectedShow.UseCustomLanguage)
            {
                selectedShow.CustomLanguageCode = TheTVDB.LocalCache.Instance.LanguageList?.GetLanguageFromLocalName(cbLanguage.SelectedItem?.ToString())?.Abbreviation
                                                  ?? TVSettings.Instance.PreferredLanguageCode;
            }

            selectedShow.UseCustomRegion = chkCustomRegion.Checked;
            if (selectedShow.UseCustomRegion)
            {
                selectedShow.CustomRegionCode = TMDB.LocalCache.COUNTRIES
                                                .FirstOrDefault(x => x.Name == cbLanguage.SelectedItem?.ToString()).Code ?? TVSettings.Instance.TMDBRegion;
            }

            selectedShow.ShowTimeZone    = cbTimeZone.SelectedItem?.ToString() ?? TVSettings.Instance.DefaultShowTimezoneName ?? TimeZoneHelper.DefaultTimeZone();
            selectedShow.ShowNextAirdate = chkShowNextAirdate.Checked;

            selectedShow.SetId(GetProviderTypeInUse(), code);
            selectedShow.CountSpecials             = chkSpecialsCount.Checked;
            selectedShow.DoRename                  = cbDoRenaming.Checked;
            selectedShow.DoMissingCheck            = cbDoMissingCheck.Checked;
            selectedShow.AutoAddCustomFolderFormat = txtSeasonFormat.Text;
            selectedShow.AutoAddFolderBase         = txtBaseFolder.Text;

            selectedShow.AutoAddType           = GetAutoAddType();
            selectedShow.ConfigurationProvider = GetConfigurationProviderType();

            selectedShow.DvdOrder                      = chkDVDOrder.Checked;
            selectedShow.ForceCheckFuture              = cbIncludeFuture.Checked;
            selectedShow.ForceCheckNoAirdate           = cbIncludeNoAirdate.Checked;
            selectedShow.UseCustomSearchUrl            = cbUseCustomSearch.Checked;
            selectedShow.CustomSearchUrl               = txtSearchURL.Text;
            selectedShow.UseCustomNamingFormat         = cbUseCustomNamingFormat.Checked;
            selectedShow.CustomNamingFormat            = txtCustomEpisodeNamingFormat.Text;
            selectedShow.ManualFoldersReplaceAutomatic = chkReplaceAutoFolders.Checked;

            selectedShow.UseSequentialMatch = cbSequentialMatching.Checked;
            selectedShow.UseAirDateMatch    = cbAirdateMatching.Checked;
            selectedShow.UseEpNameMatch     = cbEpNameMatching.Checked;

            SetupDropDowns();
        }
示例#10
0
        private void SetShowItem()
        {
            int code = tvCodeFinder.SelectedCode();

            ShowConfiguration.TvdbCode          = code;
            ShowConfiguration.AutoAddFolderBase = cbDirectory.Text + lblDirectoryName.Text;

            //Set Default Timezone and if not then set on Network
            ShowConfiguration.ShowTimeZone = TVSettings.Instance.DefaultShowTimezoneName ?? TimeZoneHelper.TimeZoneForNetwork(tvCodeFinder.SelectedShow()?.Network, ShowConfiguration.ShowTimeZone);

            if (!originalHint.Contains(tvCodeFinder.SelectedShow()?.Name ?? string.Empty, StringComparison.OrdinalIgnoreCase))
            {
                ShowConfiguration.AliasNames.Add(originalHint);
            }
        }
示例#11
0
        private void SetShow()
        {
            int code = codeFinderForm.SelectedCode();

            selectedShow.CustomShowName    = txtCustomShowName.Text;
            selectedShow.UseCustomShowName = chkCustomShowName.Checked;
            selectedShow.UseCustomLanguage = chkCustomLanguage.Checked;
            if (selectedShow.UseCustomLanguage)
            {
                selectedShow.CustomLanguageCode = TheTVDB.Instance.LanguageList
                                                  .GetLanguageFromLocalName(cbLanguage.SelectedItem?.ToString())?.Abbreviation ?? TVSettings.Instance.PreferredLanguageCode;
            }
            selectedShow.ShowTimeZone              = cbTimeZone.SelectedItem?.ToString() ?? TVSettings.Instance.DefaultShowTimezoneName ?? TimeZoneHelper.DefaultTimeZone();
            selectedShow.ShowNextAirdate           = chkShowNextAirdate.Checked;
            selectedShow.TvdbCode                  = code;
            selectedShow.CountSpecials             = chkSpecialsCount.Checked;
            selectedShow.DoRename                  = cbDoRenaming.Checked;
            selectedShow.DoMissingCheck            = cbDoMissingCheck.Checked;
            selectedShow.AutoAddCustomFolderFormat = txtSeasonFormat.Text;
            selectedShow.AutoAddFolderBase         = txtBaseFolder.Text;

            selectedShow.AutoAddType = GetAutoAddType();

            selectedShow.DvdOrder                      = chkDVDOrder.Checked;
            selectedShow.ForceCheckFuture              = cbIncludeFuture.Checked;
            selectedShow.ForceCheckNoAirdate           = cbIncludeNoAirdate.Checked;
            selectedShow.UseCustomSearchUrl            = cbUseCustomSearch.Checked;
            selectedShow.CustomSearchUrl               = txtSearchURL.Text;
            selectedShow.ManualFoldersReplaceAutomatic = chkReplaceAutoFolders.Checked;

            selectedShow.UseSequentialMatch = cbSequentialMatching.Checked;

            SetupDropDowns();
        }
示例#12
0
        private void SetShowItem(int code, TVDoc.ProviderType type, string folderbase)
        {
            ShowConfiguration.SetId(type, code);
            ShowConfiguration.AutoAddFolderBase     = folderbase;
            ShowConfiguration.ConfigurationProvider = type == TVSettings.Instance.DefaultProvider? TVDoc.ProviderType.libraryDefault: type;

            //Set Default Timezone and if not then set on Network
            ShowConfiguration.ShowTimeZone = TVSettings.Instance.DefaultShowTimezoneName ?? TimeZoneHelper.TimeZoneForNetwork(tvCodeFinder.SelectedShow()?.Network, ShowConfiguration.ShowTimeZone);

            if (!originalHint.Contains(tvCodeFinder.SelectedShow()?.Name ?? string.Empty, StringComparison.OrdinalIgnoreCase))
            {
                ShowConfiguration.AliasNames.Add(originalHint);
            }
        }
示例#13
0
        public ShowConfiguration([NotNull] XElement xmlSettings) : this()
        {
            CustomShowName            = xmlSettings.ExtractString("ShowName");
            UseCustomShowName         = xmlSettings.ExtractBool("UseCustomShowName", false);
            UseCustomLanguage         = xmlSettings.ExtractBool("UseCustomLanguage", false);
            CustomLanguageCode        = xmlSettings.ExtractString("CustomLanguageCode");
            CustomShowName            = xmlSettings.ExtractString("CustomShowName");
            TvdbCode                  = xmlSettings.ExtractInt("TVDBID", -1);
            TVmazeCode                = xmlSettings.ExtractInt("TVMAZEID", -1);
            TmdbCode                  = xmlSettings.ExtractInt("TMDBID", -1);
            CountSpecials             = xmlSettings.ExtractBool("CountSpecials", false);
            ShowNextAirdate           = xmlSettings.ExtractBool("ShowNextAirdate", true);
            AutoAddFolderBase         = xmlSettings.ExtractString("FolderBase");
            DoRename                  = xmlSettings.ExtractBool("DoRename", true);
            DoMissingCheck            = xmlSettings.ExtractBool("DoMissingCheck", true);
            DvdOrder                  = xmlSettings.ExtractBool("DVDOrder", false);
            UseCustomSearchUrl        = xmlSettings.ExtractBool("UseCustomSearchURL", false);
            CustomSearchUrl           = xmlSettings.ExtractString("CustomSearchURL");
            UseCustomNamingFormat     = xmlSettings.ExtractBool("UseCustomNamingFormat", false);
            CustomNamingFormat        = xmlSettings.ExtractString("CustomNamingFormat");
            ShowTimeZone              = xmlSettings.ExtractStringOrNull("TimeZone") ?? TimeZoneHelper.DefaultTimeZone(); // default, is correct for most shows
            ForceCheckFuture          = xmlSettings.ExtractBoolBackupDefault("ForceCheckFuture", "ForceCheckAll", false);
            ForceCheckNoAirdate       = xmlSettings.ExtractBoolBackupDefault("ForceCheckNoAirdate", "ForceCheckAll", false);
            AutoAddCustomFolderFormat = xmlSettings.ExtractStringOrNull("CustomFolderFormat") ?? CustomSeasonName.DefaultStyle();
            AutoAddType               = GetAutoAddType(xmlSettings.ExtractInt("AutoAddType"));
            ConfigurationProvider     = GetConfigurationProviderType(xmlSettings.ExtractInt("ConfigurationProvider"));

            BannersLastUpdatedOnDisk      = xmlSettings.ExtractDateTime("BannersLastUpdatedOnDisk");
            UseSequentialMatch            = xmlSettings.ExtractBool("UseSequentialMatch", false);
            UseAirDateMatch               = xmlSettings.ExtractBool("UseAirDateMatch", false);
            UseEpNameMatch                = xmlSettings.ExtractBool("UseEpNameMatch", false);
            ManualFoldersReplaceAutomatic = xmlSettings.ExtractBool("ManualFoldersReplaceAutomatic", false);

            SetupIgnoreRules(xmlSettings);
            SetupAliases(xmlSettings);
            SetupSeasonRules(xmlSettings);
            SetupSeasonFolders(xmlSettings);
            UpgradeFromOldSeasonFormat(xmlSettings);
        }
        public override ItemList?ProcessShow(ShowConfiguration si, bool forceRefresh)
        {
            if (TVSettings.Instance.Mede8erXML)
            {
                ItemList theActionList = new ItemList();

                FileInfo tvshowxml = FileHelper.FileInFolder(si.AutoAddFolderBase, "cachedSeries.xml");

                CachedSeriesInfo cachedSeriesInfo = si.CachedShow;
                bool             needUpdate       = !tvshowxml.Exists ||
                                                    cachedSeriesInfo is null ||
                                                    cachedSeriesInfo.SrvLastUpdated > TimeZoneHelper.Epoch(tvshowxml.LastWriteTime);

                if ((forceRefresh || needUpdate) && !doneFiles.Contains(tvshowxml.FullName))
                {
                    doneFiles.Add(tvshowxml.FullName);
                    theActionList.Add(new ActionMede8erXML(tvshowxml, si));
                }

                //Updates requested by [email protected] on 18/4/2013
                FileInfo viewxml = FileHelper.FileInFolder(si.AutoAddFolderBase, "View.xml");
                if (!viewxml.Exists && !doneFiles.Contains(viewxml.FullName))
                {
                    doneFiles.Add(viewxml.FullName);
                    theActionList.Add(new ActionMede8erViewXML(viewxml, si));
                }

                return(theActionList);
            }

            return(base.ProcessShow(si, forceRefresh));
        }