示例#1
0
        private TimerInfo GetTimerInfo(EpgEventJSONObject i)
        {
            var info = new TimerInfo();

            var recurr = i.recurr;

            if (recurr != null)
            {
                if (recurr.OID != 0)
                {
                    info.SeriesTimerId = recurr.OID.ToString(_usCulture);
                }

                info.Name = recurr.RecurringName;
            }

            var schd = i.schd;

            if (schd != null)
            {
                info.ChannelId = schd.ChannelOid.ToString(_usCulture);
                info.Id        = schd.OID.ToString(_usCulture);
                info.Status    = ParseStatus(schd.Status);
                info.StartDate = DateTime.Parse(schd.StartTime).ToUniversalTime();
                info.EndDate   = DateTime.Parse(schd.EndTime).ToUniversalTime();

                info.PrePaddingSeconds  = int.Parse(schd.PrePadding, _usCulture) * 60;
                info.PostPaddingSeconds = int.Parse(schd.PostPadding, _usCulture) * 60;

                info.Name = schd.Name;
            }

            var epg = i.epgEvent;

            if (epg != null)
            {
                //info.Audio = ListingsResponse.ParseAudio(epg.Audio);
                info.ProgramId = epg.OID.ToString(_usCulture);
                //info.OfficialRating = epg.Rating;
                //info.EpisodeTitle = epg.Subtitle;
                info.Name     = epg.Title;
                info.Overview = epg.Desc;
                //info.Genres = epg.Genres;
                //info.IsRepeat = !epg.FirstRun;
                //info.CommunityRating = ListingsResponse.ParseCommunityRating(epg.StarRating);
                //info.IsHD = string.Equals(epg.Quality, "hdtv", StringComparison.OrdinalIgnoreCase);
            }

            return(info);
        }
示例#2
0
        private SeriesTimerInfo GetSeriesTimerInfo(EpgEventJSONObject i)
        {
            var info = new SeriesTimerInfo();

            var recurr = i.recurr;

            if (recurr != null)
            {
                info.ChannelId = GetChannelId(recurr);

                info.Id = recurr.OID.ToString(_usCulture);

                info.StartDate = DateTime.Parse(recurr.StartTime).ToUniversalTime();
                info.EndDate   = DateTime.Parse(recurr.EndTime).ToUniversalTime();

                info.PrePaddingSeconds  = int.Parse(recurr.PrePadding, _usCulture) * 60;
                info.PostPaddingSeconds = int.Parse(recurr.PostPadding, _usCulture) * 60;

                info.Name             = recurr.RecurringName ?? recurr.EPGTitle;
                info.RecordNewOnly    = recurr.OnlyNew;
                info.RecordAnyChannel = recurr.allChannels;

                info.Days = (recurr.Day ?? string.Empty).Split(',')
                            .Select(d => (DayOfWeek)Enum.Parse(typeof(DayOfWeek), d.Trim(), true))
                            .ToList();

                info.Priority = recurr.Priority;
            }

            var epg = i.epgEvent;

            if (epg != null)
            {
                info.ProgramId = epg.OID.ToString(_usCulture);
                info.Overview  = epg.Desc;
            }

            return(info);
        }
        private RecordingInfo GetRecordingInfo(EpgEventJSONObject i)
        {
            var info = new RecordingInfo();

            var recurr = i.recurr;
            if (recurr != null)
            {
                if (recurr.OID != 0)
                {
                    info.SeriesTimerId = recurr.OID.ToString(_usCulture);
                }
            }

            var schd = i.schd;

            if (schd != null)
            {
                info.ChannelId = schd.ChannelOid.ToString(_usCulture);
                info.Id = schd.OID.ToString(_usCulture);
                if (File.Exists(schd.RecordingFileName))
                {
                    info.Path = schd.RecordingFileName;
                }
                else
                {
                    info.Url = _baseUrl + "/live?recording=" + schd.OID;
                }
               
                info.Status = ParseStatus(schd.Status);
                info.StartDate = DateTime.Parse(schd.StartTime).ToUniversalTime();
                info.EndDate = DateTime.Parse(schd.EndTime).ToUniversalTime();

                info.IsHD = string.Equals(schd.Quality, "hdtv", StringComparison.OrdinalIgnoreCase);
                info.ImageUrl = string.IsNullOrEmpty(schd.FanArt) ? null : (_baseUrl + "/" + schd.FanArt);
                info.HasImage = !string.IsNullOrEmpty(schd.FanArt);
            }

            var epg = i.epgEvent;

            if (epg != null)
            {
                info.Audio = ListingsResponse.ParseAudio(epg.Audio);
                info.ProgramId = epg.OID.ToString(_usCulture);
                info.OfficialRating = epg.Rating;
                info.EpisodeTitle = epg.Subtitle;
                info.Name = epg.Title;
                info.Overview = epg.Desc;
                info.Genres = epg.Genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList();
                info.IsRepeat = !epg.FirstRun;
                info.IsSeries = true;    //!string.IsNullOrEmpty(epg.Subtitle); http://emby.media/community/index.php?/topic/21264-series-record-ability-missing-in-emby-epg/#entry239633
                info.CommunityRating = ListingsResponse.ParseCommunityRating(epg.StarRating);
                info.IsHD = string.Equals(epg.Quality, "hdtv", StringComparison.OrdinalIgnoreCase);
                info.IsNews = epg.Genres.Contains("news", StringComparer.OrdinalIgnoreCase);
                info.IsMovie = epg.Genres.Contains("movie", StringComparer.OrdinalIgnoreCase);
                info.IsKids = epg.Genres.Contains("kids", StringComparer.OrdinalIgnoreCase);

                info.IsSports = epg.Genres.Contains("sports", StringComparer.OrdinalIgnoreCase) ||
                    epg.Genres.Contains("Sports non-event", StringComparer.OrdinalIgnoreCase) ||
                    epg.Genres.Contains("Sports event", StringComparer.OrdinalIgnoreCase) ||
                    epg.Genres.Contains("Sports talk", StringComparer.OrdinalIgnoreCase) ||
                    epg.Genres.Contains("Sports news", StringComparer.OrdinalIgnoreCase);
            }

            return info;
        }
        private SeriesTimerInfo GetSeriesTimerInfo(EpgEventJSONObject i)
        {
            var info = new SeriesTimerInfo();

            var recurr = i.recurr;
            if (recurr != null)
            {
                info.ChannelId = GetChannelId(recurr);

                info.Id = recurr.OID.ToString(_usCulture);

                info.StartDate = DateTime.Parse(recurr.StartTime).ToUniversalTime();
                info.EndDate = DateTime.Parse(recurr.EndTime).ToUniversalTime();

                info.PrePaddingSeconds = int.Parse(recurr.PrePadding, _usCulture) * 60;
                info.PostPaddingSeconds = int.Parse(recurr.PostPadding, _usCulture) * 60;

                info.Name = recurr.RecurringName ?? recurr.EPGTitle;
                info.RecordNewOnly = recurr.OnlyNew;
                info.RecordAnyChannel = recurr.allChannels;

                info.Days = (recurr.Day ?? string.Empty).Split(',')
                    .Select(d => (DayOfWeek)Enum.Parse(typeof(DayOfWeek), d.Trim(), true))
                    .ToList();

                info.Priority = recurr.Priority;
            }

            var epg = i.epgEvent;

            if (epg != null)
            {
                info.ProgramId = epg.OID.ToString(_usCulture);
                info.Overview = epg.Desc;
            }

            return info;
        }
        private TimerInfo GetTimerInfo(EpgEventJSONObject i)
        {
            var info = new TimerInfo();

            var recurr = i.recurr;
            if (recurr != null)
            {
                if (recurr.OID != 0)
                {
                    info.SeriesTimerId = recurr.OID.ToString(_usCulture);
                }

                info.Name = recurr.RecurringName;
            }

            var schd = i.schd;

            if (schd != null)
            {
                info.ChannelId = schd.ChannelOid.ToString(_usCulture);
                info.Id = schd.OID.ToString(_usCulture);
                info.Status = ParseStatus(schd.Status);
                info.StartDate = DateTime.Parse(schd.StartTime).ToUniversalTime();
                info.EndDate = DateTime.Parse(schd.EndTime).ToUniversalTime();

                info.PrePaddingSeconds = int.Parse(schd.PrePadding, _usCulture) * 60;
                info.PostPaddingSeconds = int.Parse(schd.PostPadding, _usCulture) * 60;

                info.Name = schd.Name;
            }

            var epg = i.epgEvent;

            if (epg != null)
            {
                //info.Audio = ListingsResponse.ParseAudio(epg.Audio);
                info.ProgramId = epg.OID.ToString(_usCulture);
                //info.OfficialRating = epg.Rating;
                //info.EpisodeTitle = epg.Subtitle;
                info.Name = epg.Title;
                info.Overview = epg.Desc;
                //info.Genres = epg.Genres;
                //info.IsRepeat = !epg.FirstRun;
                //info.CommunityRating = ListingsResponse.ParseCommunityRating(epg.StarRating);
                //info.IsHD = string.Equals(epg.Quality, "hdtv", StringComparison.OrdinalIgnoreCase);
            }

            return info;
        }
示例#6
0
        private MyRecordingInfo GetRecordingInfo(EpgEventJSONObject i)
        {
            var info = new MyRecordingInfo();

            var recurr = i.recurr;

            if (recurr != null)
            {
                if (recurr.OID != 0)
                {
                    info.SeriesTimerId = recurr.OID.ToString(_usCulture);
                }
            }

            var schd = i.schd;

            if (schd != null)
            {
                info.ChannelId = schd.ChannelOid.ToString(_usCulture);
                info.Id        = schd.OID.ToString(_usCulture);
                if (_fileSystem.FileExists(schd.RecordingFileName))
                {
                    info.Path = schd.RecordingFileName;
                }
                else
                {
                    info.Url = _baseUrl + "/live?recording=" + schd.OID;
                }

                info.Status    = ParseStatus(schd.Status);
                info.StartDate = DateTime.Parse(schd.StartTime).ToUniversalTime();
                info.EndDate   = DateTime.Parse(schd.EndTime).ToUniversalTime();

                info.IsHD     = string.Equals(schd.Quality, "hdtv", StringComparison.OrdinalIgnoreCase);
                info.ImageUrl = string.IsNullOrEmpty(schd.FanArt) ? null : (_baseUrl + "/" + schd.FanArt);
                info.HasImage = !string.IsNullOrEmpty(schd.FanArt);
            }

            var epg = i.epgEvent;

            if (epg != null)
            {
                info.Audio           = ListingsResponse.ParseAudio(epg.Audio);
                info.ProgramId       = epg.OID.ToString(_usCulture);
                info.OfficialRating  = epg.Rating;
                info.EpisodeTitle    = epg.Subtitle;
                info.Name            = epg.Title;
                info.Overview        = epg.Desc;
                info.Genres          = epg.Genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList();
                info.IsRepeat        = !epg.FirstRun;
                info.IsSeries        = true; //!string.IsNullOrEmpty(epg.Subtitle); http://emby.media/community/index.php?/topic/21264-series-record-ability-missing-in-emby-epg/#entry239633
                info.CommunityRating = ListingsResponse.ParseCommunityRating(epg.StarRating);
                info.IsHD            = string.Equals(epg.Quality, "hdtv", StringComparison.OrdinalIgnoreCase);
                info.IsNews          = epg.Genres.Contains("news", StringComparer.OrdinalIgnoreCase);
                info.IsMovie         = epg.Genres.Contains("movie", StringComparer.OrdinalIgnoreCase);
                info.IsKids          = epg.Genres.Contains("kids", StringComparer.OrdinalIgnoreCase);

                info.IsSports = epg.Genres.Contains("sports", StringComparer.OrdinalIgnoreCase) ||
                                epg.Genres.Contains("Sports non-event", StringComparer.OrdinalIgnoreCase) ||
                                epg.Genres.Contains("Sports event", StringComparer.OrdinalIgnoreCase) ||
                                epg.Genres.Contains("Sports talk", StringComparer.OrdinalIgnoreCase) ||
                                epg.Genres.Contains("Sports news", StringComparer.OrdinalIgnoreCase);
            }

            return(info);
        }