예제 #1
0
파일: PlexHelper.cs 프로젝트: pyrostic/Ombi
        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
파일: PlexHelper.cs 프로젝트: zobe123/Ombi
        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);
            }
        }