Пример #1
0
        public static EpisodeModelHelper GetSeasonsAndEpisodesFromPlexGuid(string guid)
        {
            var ep = new EpisodeModelHelper();

            //guid="com.plexapp.agents.thetvdb://269586/2/8?lang=en"
            if (string.IsNullOrEmpty(guid))
            {
                return(null);
            }
            try
            {
                var guidSplit = guid.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);
                if (guidSplit.Length > 2)
                {
                    ep.ProviderId    = guidSplit[1];
                    ep.SeasonNumber  = int.Parse(guidSplit[2]);
                    ep.EpisodeNumber = int.Parse(guidSplit[3]);
                }
                return(ep);
            }
            catch (Exception e)
            {
                Log.Error(e);
                Log.Error(guid);
                return(ep);
            }
        }
Пример #2
0
        public static EpisodeModelHelper GetSeasonsAndEpisodesFromPlexGuid(string guid)
        {
            var ep = new EpisodeModelHelper();

            //com.plexapp.agents.thetvdb://269586/2/8?lang=en
            //com.plexapp.agents.themoviedb://390043?lang=en
            //com.plexapp.agents.imdb://tt2543164?lang=en
            if (string.IsNullOrEmpty(guid))
            {
                return(null);
            }
            try
            {
                var guidSplit = guid.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);
                if (guidSplit.Length > 2)
                {
                    if (guid.Contains("thetvdb", CompareOptions.IgnoreCase))
                    {
                        ep.ProviderId = new ProviderId {
                            TheTvDb = guidSplit[1]
                        };
                    }
                    if (guid.Contains("themoviedb", CompareOptions.IgnoreCase))
                    {
                        ep.ProviderId = new ProviderId {
                            TheMovieDb = guidSplit[1]
                        };
                    }
                    if (guid.Contains("imdb", CompareOptions.IgnoreCase))
                    {
                        ep.ProviderId = new ProviderId {
                            ImdbId = guidSplit[1]
                        };
                    }
                    ep.SeasonNumber  = int.Parse(guidSplit[2]);
                    ep.EpisodeNumber = int.Parse(guidSplit[3]);
                }
                return(ep);
            }
            catch (Exception)
            {
                return(ep);
            }
        }