Ejemplo n.º 1
0
        public ErrCode SearchPgLists(List <EpgSearchKeyInfo> key, ref Dictionary <UInt64, EpgServiceAllEventInfo> serviceDic, EpgViewPeriod period = null)
        {
            ErrCode err = ErrCode.CMD_SUCCESS;

            //Epgデータ未取得時、SendSearchPg()の最古データは取得してみないと分からない。
            var  list            = new List <EpgEventInfo>();
            bool noSearchCurrent = period != null && IsEpgLoaded && period.End <= EventTimeMinCurrent;

            if (noSearchCurrent == false)
            {
                try { err = CommonManager.CreateSrvCtrl().SendSearchPg(key, ref list); } catch { err = ErrCode.CMD_ERR; }
                if (err != ErrCode.CMD_SUCCESS)
                {
                    return(err);
                }
                if (period != null && period.StrictLoad)
                {
                    list = PeriodApplied(list, period);
                }
            }

            var  list2       = new List <EpgEventInfo>();
            bool noSearchArc = period == null || EventTimeMaxArc != DateTime.MinValue && period.StartLoad > EventTimeMaxArc;

            if (noSearchArc == false)
            {
                try
                {
                    var pram = new SearchPgParam();
                    pram.keyList   = key;
                    pram.enumStart = period.StartLoad.ToFileTimeUtc();
                    pram.enumEnd   = period.End == DateTime.MaxValue ? long.MaxValue : period.End.ToFileTimeUtc();
                    CommonManager.CreateSrvCtrl().SendSearchPgArc(pram, ref list2);
                }
                catch { }
            }

            //サービス毎のリストに変換
            var sList = list.GroupBy(info => info.Create64Key()).Select(gr => new EpgServiceEventInfo {
                serviceInfo = EpgServiceInfo.FromKey(gr.Key), eventList = gr.ToList()
            }).ToList();
            var sList2 = list2.GroupBy(info => info.Create64Key()).Select(gr => new EpgServiceEventInfo {
                serviceInfo = EpgServiceInfo.FromKey(gr.Key), eventList = gr.ToList()
            }).ToList();

            serviceDic = EpgServiceAllEventInfo.CreateEpgServiceDictionary(sList, sList2);

            //サービス名の補正、イベントデータの再使用
            CorrectServiceInfo(serviceDic.Values, period == null || EventTimeBaseArc < period.End || EventTimeMinCurrent < period.End);

            return(err);
        }
Ejemplo n.º 2
0
 /// <summary>過去番組検索</summary>
 public ErrCode SendSearchPgArc(SearchPgParam param, ref List <EpgEventInfo> val)
 {
     object o = val; return(SendAndReceiveCmdData2(CtrlCmd.CMD_EPG_SRV_SEARCH_PG_ARC2, param, ref o));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// baseTimeから1週間分(EventBaseTimeをしきい値とし、このとき上限なし)のEPGデータを検索する
        /// </summary>
        public ErrCode SearchWeeklyEpgData(DateTime baseTime, EpgSearchKeyInfo key, out Dictionary <ulong, EpgServiceAllEventInfo> list)
        {
            list = null;
            List <EpgEventInfo> eventList;
            List <EpgEventInfo> arcList = null;
            ErrCode             ret     = SearchPg(new List <EpgSearchKeyInfo>()
            {
                key
            }, out eventList);

            if (ret == ErrCode.CMD_SUCCESS)
            {
                ret      = ErrCode.CMD_ERR;
                baseTime = baseTime > EventBaseTime ? EventBaseTime : baseTime;
                arcList  = new List <EpgEventInfo>();
                //1週間分の過去番組情報
                var param = new SearchPgParam();
                param.keyList = new List <EpgSearchKeyInfo>()
                {
                    key
                };
                param.enumStart = baseTime.ToFileTime();
                param.enumEnd   = baseTime.AddDays(baseTime < EventBaseTime ? 7 : 14).ToFileTime();
                try
                {
                    CommonManager.CreateSrvCtrl().SendSearchPgArc(param, ref arcList);
                    ret = ErrCode.CMD_SUCCESS;
                }
                catch { }
            }
            if (ret == ErrCode.CMD_SUCCESS)
            {
                list = new Dictionary <ulong, EpgServiceAllEventInfo>();
                //サービス毎のリストに変換
                foreach (EpgEventInfo info in eventList)
                {
                    if (baseTime < EventBaseTime ? (info.StartTimeFlag != 0 && info.start_time >= baseTime && info.start_time < baseTime.AddDays(7))
                                                 : (info.StartTimeFlag == 0 || info.start_time >= baseTime))
                    {
                        ulong id = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                        EpgServiceAllEventInfo allInfo;
                        if (list.TryGetValue(id, out allInfo) == false)
                        {
                            if (ChSet5.Instance.ChList.ContainsKey(id) == false)
                            {
                                //サービス情報ないので無効
                                continue;
                            }
                            allInfo = new EpgServiceAllEventInfo(CommonManager.ConvertChSet5To(ChSet5.Instance.ChList[id]));
                            if (serviceEventList.ContainsKey(id))
                            {
                                //リモコンキー情報を補完
                                allInfo.serviceInfo.remote_control_key_id = serviceEventList[id].serviceInfo.remote_control_key_id;
                            }
                            list.Add(id, allInfo);
                        }
                        allInfo.eventList.Add(info);
                    }
                }
                foreach (EpgEventInfo info in arcList)
                {
                    ulong id = CommonManager.Create64Key(info.original_network_id, info.transport_stream_id, info.service_id);
                    EpgServiceAllEventInfo allInfo;
                    if (list.TryGetValue(id, out allInfo) == false)
                    {
                        if (ChSet5.Instance.ChList.ContainsKey(id) == false)
                        {
                            //サービス情報ないので無効
                            continue;
                        }
                        allInfo = new EpgServiceAllEventInfo(CommonManager.ConvertChSet5To(ChSet5.Instance.ChList[id]));
                        if (serviceEventList.ContainsKey(id))
                        {
                            //リモコンキー情報を補完
                            allInfo.serviceInfo.remote_control_key_id = serviceEventList[id].serviceInfo.remote_control_key_id;
                        }
                        list.Add(id, allInfo);
                    }
                    allInfo.eventArcList.Add(info);
                }
            }
            return(ret);
        }