コード例 #1
0
        public static string GetLetter(this EpisodeType type)
        {
            switch (type)
            {
            case EpisodeType.Normal:
                return(" ");

            case EpisodeType.Filler:
                return("F");

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
コード例 #2
0
        /*
         *      public Raw_AniDB_Episode(XmlNode node, int anid)
         *      {
         *              ProcessEpisodeSource(node, anid);
         *      }*/

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("episodeID: " + EpisodeID.ToString());
            sb.Append(" | animeID: " + AnimeID.ToString());
            sb.Append(" | episodeNumber: " + EpisodeNumber.ToString());
            sb.Append(" | episodeType: " + EpisodeType.ToString());
            sb.Append(" | englishName: " + EnglishName);
            sb.Append(" | airDate: " + AirDate);
            //sb.Append(" | AirDateFormatted: " + AirDateFormatted);

            return(sb.ToString());
        }
コード例 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="client">(Required) Spotify Sdk Client</param>
 /// <param name="episodeType">(Required) Episode Type</param>
 /// <param name="value">(Required) Only for EpisodeType.Search - Episode Search Term or EpisodeType.Show - Show Id</param>
 /// <param name="multipleEpisodeIds">(Required) Only for EpisodeType.Multiple - Multiple Spotify Episode Ids</param>
 /// <param name="searchIsExternal">(Optional) Only for EpisodeType.Search, If true the response will include any relevant audio content that is hosted externally</param>
 public ListEpisodeViewModel(
     ISpotifySdkClient client,
     EpisodeType episodeType,
     string value = null,
     List <string> multipleEpisodeIds = null,
     bool?searchIsExternal            = null)
     : base(client, new EpisodesRequest()
 {
     EpisodeType        = episodeType,
     Value              = value,
     MultipleEpisodeIds = multipleEpisodeIds,
     SearchIsExternal   = searchIsExternal
 })
 {
 }
コード例 #4
0
 public GameListEntry([NotNull] MenuItemIdentifier listing,
                      DifficultyType difficulty,
                      byte playerCount,
                      [NotNull] string name,
                      EpisodeType episode,
                      byte flags)
     : this()
 {
     Listing     = listing ?? throw new ArgumentNullException(nameof(listing));
     Difficulty  = difficulty;
     PlayerCount = playerCount;
     Name        = name ?? throw new ArgumentNullException(nameof(name));
     Episode     = episode;
     this.flags  = flags;
 }
コード例 #5
0
        public CommandRequest_LinkAniDBTvDB(int animeID, EpisodeType aniEpType, int aniEpNumber, int tvDBID,
                                            int tvSeasonNumber, int tvEpNumber, bool excludeFromWebCache, bool additiveLink = false)
        {
            this.animeID             = animeID;
            this.aniEpType           = aniEpType;
            this.aniEpNumber         = aniEpNumber;
            this.tvDBID              = tvDBID;
            this.tvSeasonNumber      = tvSeasonNumber;
            this.tvEpNumber          = tvEpNumber;
            this.excludeFromWebCache = excludeFromWebCache;
            this.additiveLink        = additiveLink;

            Priority = (int)DefaultPriority;

            GenerateCommandID();
        }
コード例 #6
0
 public GameSettings(DifficultyType difficulty,
                     bool isBattle,
                     byte @event,
                     SectionId section,
                     bool isChallengeMode,
                     uint randomSeed,
                     EpisodeType episode, bool isSinglePlayer)
 {
     Difficulty           = difficulty;
     this.isBattle        = isBattle;
     Event                = @event;
     Section              = section;
     this.isChallengeMode = isChallengeMode;
     RandomSeed           = randomSeed;
     Episode              = episode;
     this.isSinglePlayer  = isSinglePlayer;
 }
コード例 #7
0
        public List <VM_AnimeEpisode_User> GetEpisodesToDisplay(EpisodeType epType)
        {
            List <VM_AnimeEpisode_User> eps = new List <VM_AnimeEpisode_User>();

            foreach (VM_AnimeEpisode_User ep in GetEpisodesByType(epType))
            {
                bool useEp = true;
                if (BaseConfig.Settings.ShowOnlyAvailableEpisodes && ep.LocalFileCount == 0)
                {
                    useEp = false;
                }

                if (useEp)
                {
                    eps.Add(ep);
                }
            }

            return(eps);
        }
コード例 #8
0
        public void GetWatchedUnwatchedCount(EpisodeType epType, ref int unwatched, ref int watched)
        {
            unwatched = 0;
            watched   = 0;

            foreach (VM_AnimeEpisode_User ep in GetEpisodesByType(epType))
            {
                if (ep.LocalFileCount == 0)
                {
                    continue;
                }

                if (ep.Watched)
                {
                    watched++;
                }
                else
                {
                    unwatched++;
                }
            }
        }
コード例 #9
0
        public void Init(int animeID, int episodeNumber, EpisodeType epType)
        {
            this.episodeNumber = episodeNumber;
            this.animeID       = animeID;
            this.episodeType   = epType;

            string epNumberFormatted = episodeNumber.ToString();

            switch (epType)
            {
            case EpisodeType.Credits:
                epNumberFormatted = "C" + episodeNumber.ToString();
                break;

            case EpisodeType.Special:
                epNumberFormatted = "S" + episodeNumber.ToString();
                break;

            case EpisodeType.Other:
                epNumberFormatted = "0" + episodeNumber.ToString();
                break;

            case EpisodeType.Trailer:
                epNumberFormatted = "T" + episodeNumber.ToString();
                break;

            case EpisodeType.Parody:
                epNumberFormatted = "P" + episodeNumber.ToString();
                break;
            }

            key         = "AniDBCommand_GetEpisodeInfo_" + animeID.ToString() + "_" + epNumberFormatted;
            commandText = string.Format("EPISODE aid={0}&epno={1}", animeID, epNumberFormatted);

            //BaseConfig.MyAnimeLog.Write("AniDBCommand_GetEpisodeInfo.Process: Request: {0}", commandText);

            commandID = animeID.ToString();
        }
コード例 #10
0
        // Removes all TVDB information from a series, bringing it back to a blank state.
        public static void RemoveLinkAniDBTvDB(int animeID, EpisodeType aniEpType, int aniEpNumber, int tvDBID,
                                               int tvSeasonNumber, int tvEpNumber)
        {
            CrossRef_AniDB_TvDBV2 xref = RepoFactory.CrossRef_AniDB_TvDBV2.GetByTvDBID(tvDBID, tvSeasonNumber,
                                                                                       tvEpNumber, animeID,
                                                                                       (int)aniEpType,
                                                                                       aniEpNumber);

            if (xref == null)
            {
                return;
            }

            RepoFactory.CrossRef_AniDB_TvDBV2.Delete(xref.CrossRef_AniDB_TvDBV2ID);

            SVR_AniDB_Anime.UpdateStatsByAnimeID(animeID);

            CommandRequest_WebCacheDeleteXRefAniDBTvDB req = new CommandRequest_WebCacheDeleteXRefAniDBTvDB(animeID,
                                                                                                            (int)aniEpType, aniEpNumber,
                                                                                                            tvDBID, tvSeasonNumber, tvEpNumber);

            req.Save();
        }
コード例 #11
0
ファイル: Enums.cs プロジェクト: ElementalCrisis/jmmclient
        public static string EpisodeTypeTranslated(EpisodeType epType)
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(AppSettings.Culture);

            switch (epType)
            {
                case EpisodeType.Credits:
                    return JMMClient.Properties.Resources.EpisodeType_Credits;
                case EpisodeType.Episode:
                    return JMMClient.Properties.Resources.EpisodeType_Normal;
                case EpisodeType.Other:
                    return JMMClient.Properties.Resources.EpisodeType_Other;
                case EpisodeType.Parody:
                    return JMMClient.Properties.Resources.EpisodeType_Parody;
                case EpisodeType.Special:
                    return JMMClient.Properties.Resources.EpisodeType_Specials;
                case EpisodeType.Trailer:
                    return JMMClient.Properties.Resources.EpisodeType_Trailer;
                default:
                    return JMMClient.Properties.Resources.EpisodeType_Normal;

            }
        }
コード例 #12
0
ファイル: EpisodeList.xaml.cs プロジェクト: maxpiva/jmmclient
        void cboEpisodeTypeFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //return;
            ComboBox cbo = (ComboBox)sender;

            object obj = cbo.SelectedItem;
            if (obj == null) return;

            try
            {
                AnimeEpisodeTypeVM epType = obj as AnimeEpisodeTypeVM;
                AnimeSeriesVM animeSeries = (AnimeSeriesVM)this.DataContext;
                if (animeSeries == null) return;

                episodeType = epType.EpisodeType;

                RefreshEpisodes();
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
コード例 #13
0
ファイル: Enums.cs プロジェクト: karehaqt/jmmclient
        public static string EpisodeTypeTranslated(EpisodeType epType)
        {
            switch (epType)
            {
                case EpisodeType.Credits:
                    return JMMClient.Properties.Resources.EpisodeType_Credits;
                case EpisodeType.Episode:
                    return JMMClient.Properties.Resources.EpisodeType_Normal;
                case EpisodeType.Other:
                    return JMMClient.Properties.Resources.EpisodeType_Other;
                case EpisodeType.Parody:
                    return JMMClient.Properties.Resources.EpisodeType_Parody;
                case EpisodeType.Special:
                    return JMMClient.Properties.Resources.EpisodeType_Specials;
                case EpisodeType.Trailer:
                    return JMMClient.Properties.Resources.EpisodeType_Trailer;
                default:
                    return JMMClient.Properties.Resources.EpisodeType_Normal;

            }
        }
コード例 #14
0
        public void Init(int animeID, string animeName, EpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeason, int tvEpNumber, string tvSeriesName,
                         AniDB_AnimeVM anime, int?crossRef_AniDB_TvDBV2ID)
        {
            Anime                   = anime;
            AnimeID                 = animeID;
            AnimeName               = animeName;
            AnimeEpisodeType        = (int)aniEpType;
            AnimeEpisodeNumber      = aniEpNumber;
            TvDBID                  = tvDBID;
            TvDBSeason              = tvSeason;
            TvDBEpisodeNumber       = tvEpNumber;
            TvDBSeriesName          = tvSeriesName;
            CrossRef_AniDB_TvDBV2ID = crossRef_AniDB_TvDBV2ID;

            AnimeURL = string.Format(Constants.URLS.AniDB_Series, AnimeID);
            TvDBURL  = string.Format(Constants.URLS.TvDB_Series, TvDBID);

            bool hasSpecials = false;

            AniDBEpisodes = new List <AniDB_EpisodeVM>();
            List <JMMClient.JMMServerBinary.Contract_AniDB_Episode> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetAniDBEpisodesForAnime(AnimeID);

            foreach (JMMClient.JMMServerBinary.Contract_AniDB_Episode contract in contracts)
            {
                AniDBEpisodes.Add(new AniDB_EpisodeVM(contract));
                if (contract.EpisodeType == (int)EpisodeType.Special)
                {
                    hasSpecials = true;
                }
            }

            cboEpisodeType.Items.Clear();
            cboEpisodeType.Items.Add("Episodes");
            if (hasSpecials)
            {
                cboEpisodeType.Items.Add("Specials");
            }

            cboEpisodeType.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeType_SelectionChanged);

            if (aniEpType == EpisodeType.Episode)
            {
                cboEpisodeType.SelectedIndex = 0;
            }
            else
            {
                cboEpisodeType.SelectedIndex = 1;
            }



            // get the seasons

            try
            {
                cboSeasonNumber.Items.Clear();

                List <int> seasons = null;
                if (anime.TvSummary.TvDetails.ContainsKey(tvDBID))
                {
                    TvDetails = anime.TvSummary.TvDetails[tvDBID];
                    seasons   = anime.TvSummary.TvDetails[tvDBID].DictTvDBSeasons.Keys.ToList();
                }
                else
                {
                    JMMServerVM.Instance.clientBinaryHTTP.UpdateTvDBData(tvDBID);
                    TvDetails = new TvDBDetails(tvDBID);
                    seasons   = TvDetails.DictTvDBSeasons.Keys.ToList();
                    //seasons = JMMServerVM.Instance.clientBinaryHTTP.GetSeasonNumbersForSeries(tvDBID);
                }

                int i   = 0;
                int idx = 0;
                foreach (int season in seasons)
                {
                    cboSeasonNumber.Items.Add(season.ToString());
                    if (season == tvSeason)
                    {
                        idx = i;
                    }
                    i++;
                }

                cboSeasonNumber.SelectionChanged  += new SelectionChangedEventHandler(cboSeasonNumber_SelectionChanged);
                cboEpisodeNumber.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeNumber_SelectionChanged);

                cboSeasonNumber.SelectedIndex = idx;
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
コード例 #15
0
 public VM_AnimeEpisodeType(VM_AnimeSeries_User series, VM_AnimeEpisode_User ep)
 {
     AnimeSeries            = series;
     EpisodeType            = (EpisodeType)ep.EpisodeType;
     EpisodeTypeDescription = EpisodeType.EpisodeTypeTranslated();
 }
コード例 #16
0
        public void ProcessVoteFoundEpisode(string sRecMessage, int animeID, int epno, EpisodeType epType)
        {
            // remove the header info
            string[] sDetails = sRecMessage.Substring(15).Split('|');

            //261 VOTE FOUNDThe Day a New Demon Was Born|700|1|63091

            // 261 VOTE FOUND
            // 0. The Day a New Demon Was Born
            // 1. 700 ** vote value
            // 2. 1 ** ???
            // 3. 63091 ** episodeid

            this.EntityID      = animeID;
            this.EpisodeNumber = epno;
            this.VoteValue     = int.Parse(sDetails[1].Trim());
            this.VoteType      = (int)AniDBVoteType.Episode;
            this.EpisodeType   = (int)epType;
        }
コード例 #17
0
 public void AddOrUpdate(int animeepisodeId, string providerEpisodeId, int season, int episodeNumber, EpisodeType type, MatchRating rating)
 {
     lock (_dict)
     {
         if (_dict.ContainsKey(animeepisodeId))
         {
             CrossRef_AniDB_ProviderEpisode r = _dict[animeepisodeId];
             if (r.ProviderEpisodeID != providerEpisodeId || r.MatchRating != rating || r.Season != season || r.Number != episodeNumber || r.Type != type)
             {
                 _providerDict.Remove(r.ProviderEpisodeID);
                 r.ProviderEpisodeID = providerEpisodeId;
                 r.MatchRating       = rating;
                 r.Season            = season;
                 r.Number            = episodeNumber;
                 r.Type = type;
                 _providerDict.Add(r.ProviderEpisodeID, animeepisodeId);
                 _needPersistance = true;
             }
         }
         else
         {
             CrossRef_AniDB_ProviderEpisode r = new CrossRef_AniDB_ProviderEpisode();
             r.AniDBEpisodeID    = animeepisodeId;
             r.ProviderEpisodeID = providerEpisodeId;
             r.MatchRating       = rating;
             r.Season            = season;
             r.Number            = episodeNumber;
             r.Type = type;
             _dict.Add(animeepisodeId, r);
             _providerDict[providerEpisodeId] = animeepisodeId;
             _needPersistance = true;
         }
     }
 }
コード例 #18
0
 public Episode(EpisodeType etype)
 {
     this.etype = etype;
 }
コード例 #19
0
        public static void LinkAniDBTvDB(int animeID, EpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber, bool excludeFromWebCache, bool additiveLink = false)
        {
            if (!additiveLink)
            {
                // remove all current links
                logger.Info($"Removing All TvDB Links for: {animeID}");
                RemoveAllAniDBTvDBLinks(animeID, -1, false);
            }

            // check if we have this information locally
            // if not download it now
            TvDB_Series tvSeries = RepoFactory.TvDB_Series.GetByTvDBID(tvDBID);

            if (tvSeries != null)
            {
                // download and update series info, episode info and episode images
                // will also download fanart, posters and wide banners
                CommandRequest_TvDBUpdateSeries cmdSeriesEps =
                    new CommandRequest_TvDBUpdateSeries(tvDBID,
                                                        false);
                cmdSeriesEps.Save();
            }
            else
            {
                tvSeries = GetSeriesInfoOnline(tvDBID, true);
            }

            CrossRef_AniDB_TvDBV2 xref = RepoFactory.CrossRef_AniDB_TvDBV2.GetByTvDBID(tvDBID, tvSeasonNumber,
                                                                                       tvEpNumber, animeID, (int)aniEpType, aniEpNumber) ??
                                         new CrossRef_AniDB_TvDBV2();

            xref.AnimeID = animeID;
            xref.AniDBStartEpisodeType   = (int)aniEpType;
            xref.AniDBStartEpisodeNumber = aniEpNumber;

            xref.TvDBID                 = tvDBID;
            xref.TvDBSeasonNumber       = tvSeasonNumber;
            xref.TvDBStartEpisodeNumber = tvEpNumber;
            if (tvSeries != null)
            {
                xref.TvDBTitle = tvSeries.SeriesName;
            }

            if (excludeFromWebCache)
            {
                xref.CrossRefSource = (int)CrossRefSource.WebCache;
            }
            else
            {
                xref.CrossRefSource = (int)CrossRefSource.User;
            }

            RepoFactory.CrossRef_AniDB_TvDBV2.Save(xref);

            logger.Info(
                $"Adding TvDB Link: AniDB(ID:{animeID}|Type:{aniEpType}|Number:{aniEpNumber}) -> TvDB(ID:{tvDBID}|Season:{tvSeasonNumber}|Number:{tvEpNumber})");
            if (!excludeFromWebCache)
            {
                var req = new CommandRequest_WebCacheSendXRefAniDBTvDB(xref.CrossRef_AniDB_TvDBV2ID);
                req.Save();
            }

            if (ServerSettings.Trakt_IsEnabled && !string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken))
            {
                // check for Trakt associations
                List <CrossRef_AniDB_TraktV2> trakt = RepoFactory.CrossRef_AniDB_TraktV2.GetByAnimeID(animeID);
                if (trakt.Count != 0)
                {
                    foreach (CrossRef_AniDB_TraktV2 a in trakt)
                    {
                        RepoFactory.CrossRef_AniDB_TraktV2.Delete(a);
                    }
                }

                var cmd2 = new CommandRequest_TraktSearchAnime(animeID, false);
                cmd2.Save();
            }
        }
コード例 #20
0
 /// <summary>
 /// 获取章节类型的描述
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string GetDesc(this EpisodeType type)
 {
     return(type.ToString().Replace('_', '/'));
 }
コード例 #21
0
        public void Init(int animeID, string animeName, EpisodeType aniEpType, int aniEpNumber, string traktID, int traktSeason, int traktEpNumber, string trakSeriesName,
            AniDB_AnimeVM anime, int? crossRef_AniDB_TraktV2ID)
        {
            Anime = anime;
            AnimeID = animeID;
            AnimeName = animeName;
            AnimeEpisodeType = (int)aniEpType;
            AnimeEpisodeNumber = aniEpNumber;
            TraktID = traktID;
            TraktSeason = traktSeason;
            TraktEpisodeNumber = traktEpNumber;
            TraktSeriesName = trakSeriesName;
            CrossRef_AniDB_TraktV2ID = crossRef_AniDB_TraktV2ID;

            AnimeURL = string.Format(Constants.URLS.AniDB_Series, AnimeID);
            TraktURL = string.Format(Constants.URLS.Trakt_Series, TraktID);

            bool hasSpecials = false;
            AniDBEpisodes = new List<AniDB_EpisodeVM>();
            List<JMMClient.JMMServerBinary.Contract_AniDB_Episode> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetAniDBEpisodesForAnime(AnimeID);
            foreach (JMMClient.JMMServerBinary.Contract_AniDB_Episode contract in contracts)
            {
                AniDBEpisodes.Add(new AniDB_EpisodeVM(contract));
                if (contract.EpisodeType == (int)EpisodeType.Special) hasSpecials = true;
            }

            cboEpisodeType.Items.Clear();
            cboEpisodeType.Items.Add("Episodes");
            if (hasSpecials) cboEpisodeType.Items.Add("Specials");

            cboEpisodeType.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeType_SelectionChanged);

            if (aniEpType == EpisodeType.Episode)
                cboEpisodeType.SelectedIndex = 0;
            else
                cboEpisodeType.SelectedIndex = 1;

            // get the seasons

            try
            {
                cboSeasonNumber.Items.Clear();

                List<int> seasons = null;
                if (anime.traktSummary.traktDetails.ContainsKey(traktID))
                {
                    traktDetails = anime.traktSummary.traktDetails[traktID];
                    seasons = anime.traktSummary.traktDetails[traktID].DictTraktSeasons.Keys.ToList();
                }
                else
                {
                    JMMServerVM.Instance.clientBinaryHTTP.UpdateTraktData(traktID);
                    traktDetails = new TraktDetails(traktID);
                    seasons = traktDetails.DictTraktSeasons.Keys.ToList();
                }

                int i = 0;
                int idx = 0;
                foreach (int season in seasons)
                {
                    cboSeasonNumber.Items.Add(season.ToString());
                    if (season == traktSeason) idx = i;
                    i++;
                }

                cboSeasonNumber.SelectionChanged += new SelectionChangedEventHandler(cboSeasonNumber_SelectionChanged);
                cboEpisodeNumber.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeNumber_SelectionChanged);

                cboSeasonNumber.SelectedIndex = idx;

            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
コード例 #22
0
 public static void SetWatchedStatusOnSeries(bool watchedStatus, int maxEpisodeNumber, int animeSeriesID, EpisodeType episodeType)
 {
     try
     {
         VM_ShokoServer.Instance.ShokoServices.SetWatchedStatusOnSeries(animeSeriesID, watchedStatus, maxEpisodeNumber,
                                                                        (int)episodeType, VM_ShokoServer.Instance.CurrentUser.JMMUserID);
     }
     catch (Exception ex)
     {
         BaseConfig.MyAnimeLog.Write("SetWatchedStatusOnSeries: " + ex.Message);
     }
 }
コード例 #23
0
 /// <inheritdoc />
 public BlockPlayerCreateGameRequestPayload(string gameName, string password, DifficultyType partyDifficulty, bool isBattleModeEnabled, bool isChallengeModeEnabled, EpisodeType partyEpisode, bool isSinglePlayerModeEnabled)
 {
     this.unk1                      = unk1;
     GameName                       = gameName;
     Password                       = password;
     PartyDifficulty                = partyDifficulty;
     this.isBattleModeEnabled       = isBattleModeEnabled;
     this.isChallengeModeEnabled    = isChallengeModeEnabled;
     PartyEpisode                   = partyEpisode;
     this.isSinglePlayerModeEnabled = isSinglePlayerModeEnabled;
 }
コード例 #24
0
        public static string LinkAniDBTvDB(int animeID, EpisodeType aniEpType, int aniEpNumber, int tvDBID,
                                           int tvSeasonNumber, int tvEpNumber, bool excludeFromWebCache, bool additiveLink = false)
        {
            using (var session = DatabaseFactory.SessionFactory.OpenSession())
            {
                if (!additiveLink)
                {
                    // remove all current links
                    RemoveAllAniDBTvDBLinks(animeID, -1, false);
                }

                // check if we have this information locally
                // if not download it now
                TvDB_Series tvSeries = RepoFactory.TvDB_Series.GetByTvDBID(tvDBID) ?? GetSeriesInfoOnline(tvDBID);

                // download and update series info, episode info and episode images
                // will also download fanart, posters and wide banners
                CommandRequest_TvDBUpdateSeriesAndEpisodes cmdSeriesEps =
                    new CommandRequest_TvDBUpdateSeriesAndEpisodes(tvDBID,
                                                                   false);
                //Optimize for batch updates, if there are a lot of LinkAniDBTvDB commands queued
                //this will cause only one updateSeriesAndEpisodes command to be created
                if (RepoFactory.CommandRequest.GetByCommandID(cmdSeriesEps.CommandID) == null)
                {
                    cmdSeriesEps.Save();
                }

                CrossRef_AniDB_TvDBV2 xref = RepoFactory.CrossRef_AniDB_TvDBV2.GetByTvDBID(tvDBID, tvSeasonNumber,
                                                                                           tvEpNumber, animeID, (int)aniEpType, aniEpNumber) ??
                                             new CrossRef_AniDB_TvDBV2();

                xref.AnimeID = animeID;
                xref.AniDBStartEpisodeType   = (int)aniEpType;
                xref.AniDBStartEpisodeNumber = aniEpNumber;

                xref.TvDBID                 = tvDBID;
                xref.TvDBSeasonNumber       = tvSeasonNumber;
                xref.TvDBStartEpisodeNumber = tvEpNumber;
                if (tvSeries != null)
                {
                    xref.TvDBTitle = tvSeries.SeriesName;
                }

                if (excludeFromWebCache)
                {
                    xref.CrossRefSource = (int)CrossRefSource.WebCache;
                }
                else
                {
                    xref.CrossRefSource = (int)CrossRefSource.User;
                }

                RepoFactory.CrossRef_AniDB_TvDBV2.Save(xref);

                logger.Trace($"Changed tvdb association: {animeID}");

                if (!excludeFromWebCache)
                {
                    var req = new CommandRequest_WebCacheSendXRefAniDBTvDB(xref.CrossRef_AniDB_TvDBV2ID);
                    req.Save();
                }

                if (ServerSettings.Trakt_IsEnabled && !string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken))
                {
                    // check for Trakt associations
                    List <CrossRef_AniDB_TraktV2> trakt = RepoFactory.CrossRef_AniDB_TraktV2.GetByAnimeID(animeID);
                    if (trakt.Count != 0)
                    {
                        // remove them and rescan
                        foreach (CrossRef_AniDB_TraktV2 a in trakt)
                        {
                            RepoFactory.CrossRef_AniDB_TraktV2.Delete(a);
                        }
                    }

                    var cmd2 = new CommandRequest_TraktSearchAnime(animeID, false);
                    cmd2.Save(session);
                }
            }

            return(string.Empty);
        }
コード例 #25
0
        public static void EpisodeTypeTranslated(PlexEpisodeType tp, EpisodeType epType, AnimeType an, int cnt)
        {
            tp.Type      = (int)epType;
            tp.Count     = cnt;
            tp.AnimeType = an;
            bool plural = cnt > 1;

            switch (epType)
            {
            case EpisodeType.Credits:
                tp.Name  = plural ? "Credits" : "Credit";
                tp.Image = "plex_credits.png";
                return;

            case EpisodeType.Episode:
                switch (an)
                {
                case AnimeType.Movie:
                    tp.Name  = plural ? "Movies" : "Movie";
                    tp.Image = "plex_movies.png";
                    return;

                case AnimeType.OVA:
                    tp.Name  = plural ? "Ovas" : "Ova";
                    tp.Image = "plex_ovas.png";
                    return;

                case AnimeType.Other:
                    tp.Name  = plural ? "Others" : "Other";
                    tp.Image = "plex_others.png";
                    return;

                case AnimeType.TVSeries:
                    tp.Name  = plural ? "Episodes" : "Episode";
                    tp.Image = "plex_episodes.png";
                    return;

                case AnimeType.TVSpecial:
                    tp.Name  = plural ? "TV Episodes" : "TV Episode";
                    tp.Image = "plex_tvepisodes.png";
                    return;

                case AnimeType.Web:
                    tp.Name  = plural ? "Web Clips" : "Web Clip";
                    tp.Image = "plex_webclips.png";
                    return;
                }
                tp.Name  = plural ? "Episodes" : "Episode";
                tp.Image = "plex_episodes.png";
                return;

            case EpisodeType.Parody:
                tp.Name  = plural ? "Parodies" : "Parody";
                tp.Image = "plex_parodies.png";
                return;

            case EpisodeType.Special:
                tp.Name  = plural ? "Specials" : "Special";
                tp.Image = "plex_specials.png";
                return;

            case EpisodeType.Trailer:
                tp.Name  = plural ? "Trailers" : "Trailer";
                tp.Image = "plex_trailers.png";
                return;

            default:
                tp.Name  = "Misc";
                tp.Image = "plex_misc.png";
                return;
            }
        }
コード例 #26
0
        public void Init(int animeID, string animeName, EpisodeType aniEpType, int aniEpNumber, string traktID, int traktSeason, int traktEpNumber, string trakSeriesName,
                         VM_AniDB_Anime anime, int?crossRef_AniDB_TraktV2ID)
        {
            Anime                    = anime;
            AnimeID                  = animeID;
            AnimeName                = animeName;
            AnimeEpisodeType         = (int)aniEpType;
            AnimeEpisodeNumber       = aniEpNumber;
            TraktID                  = traktID;
            TraktSeason              = traktSeason;
            TraktEpisodeNumber       = traktEpNumber;
            TraktSeriesName          = trakSeriesName;
            CrossRef_AniDB_TraktV2ID = crossRef_AniDB_TraktV2ID;

            AnimeURL = string.Format(Constants.URLS.AniDB_Series, AnimeID);
            TraktURL = string.Format(Constants.URLS.Trakt_Series, TraktID);

            bool hasSpecials = false;

            AniDBEpisodes = new List <VM_AniDB_Episode>();
            foreach (VM_AniDB_Episode contract in VM_ShokoServer.Instance.ShokoServices.GetAniDBEpisodesForAnime(AnimeID).Cast <VM_AniDB_Episode>())

            {
                AniDBEpisodes.Add(contract);
                if (contract.EpisodeType == (int)EpisodeType.Special)
                {
                    hasSpecials = true;
                }
            }

            cboEpisodeType.Items.Clear();
            cboEpisodeType.Items.Add(Shoko.Commons.Properties.Resources.Anime_Episodes);
            if (hasSpecials)
            {
                cboEpisodeType.Items.Add(Shoko.Commons.Properties.Resources.Anime_Specials);
            }

            cboEpisodeType.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeType_SelectionChanged);

            if (aniEpType == EpisodeType.Episode)
            {
                cboEpisodeType.SelectedIndex = 0;
            }
            else
            {
                cboEpisodeType.SelectedIndex = 1;
            }



            // get the seasons

            try
            {
                cboSeasonNumber.Items.Clear();

                List <int> seasons = null;
                if (anime.traktSummary.traktDetails.ContainsKey(traktID))
                {
                    traktDetails = anime.traktSummary.traktDetails[traktID];
                    seasons      = anime.traktSummary.traktDetails[traktID].DictTraktSeasons.Keys.ToList();
                }
                else
                {
                    VM_ShokoServer.Instance.ShokoServices.UpdateTraktData(traktID);
                    traktDetails = new VM_TraktDetails(traktID);
                    seasons      = traktDetails.DictTraktSeasons.Keys.ToList();
                }

                int i   = 0;
                int idx = 0;
                foreach (int season in seasons)
                {
                    cboSeasonNumber.Items.Add(season.ToString());
                    if (season == traktSeason)
                    {
                        idx = i;
                    }
                    i++;
                }

                cboSeasonNumber.SelectionChanged  += new SelectionChangedEventHandler(cboSeasonNumber_SelectionChanged);
                cboEpisodeNumber.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeNumber_SelectionChanged);

                cboSeasonNumber.SelectedIndex = idx;
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }