Beispiel #1
0
        private ObservableCollectionCustomized <IBroadcastModel> getNBAPrettyData(BroadcastViewModel instance, JArray jarrRaw, string strChannel, string strDayPart, bool isYesterday = false)
        {
            ObservableCollectionCustomized <IBroadcastModel> listRet = new ObservableCollectionCustomized <IBroadcastModel>();

            JObject    jobjRaw;
            SpotvModel model;

            //	"kind": "재방송",
            //"sch_date": "2017-02-14",
            //"sch_hour": 5,
            //"sch_min": "30",
            //"title": "2014 WTA 카타르 토탈 오픈 결승 할렙:커버"

            string title;
            string kind;
            string scheduleDate;
            string scheduleHour;
            string scheduleMinute;

            for (int i = 0; i < jarrRaw.Count; ++i)
            {
                jobjRaw = jarrRaw[i] as JObject;

                title = (string)(jobjRaw["title"]);

                if (!title.Contains("NBA") && !title.Contains("nba"))
                {
                    continue;
                }

                kind           = (string)(jobjRaw["kind"]);
                scheduleDate   = (string)(jobjRaw["sch_date"]);
                scheduleHour   = (string)(jobjRaw["sch_hour"]);
                scheduleMinute = (string)(jobjRaw["sch_min"]);

                if (!getIsValidNightHour(strDayPart, isYesterday, int.Parse(scheduleHour)))
                {
                    continue;
                }

                model = new SpotvModel();

                model.Kind           = kind;
                model.ScheduleDate   = scheduleDate;
                model.ScheduleHour   = scheduleHour;
                model.ScheduleMinute = scheduleMinute;
                model.Title          = title;
                //model.ScheduleDateTime = dateTime;

                model.Channel = strChannel;

                // morning over 12, change to afternoon.
                model.DayPart = SpotvService.getDayPartToDisplay(strDayPart, model.ScheduleHour);

                listRet.Add(model);
            }

            return(listRet);
        }
Beispiel #2
0
        private async Task <BroadcastModelGroup> getSpotvDataByChannel(DateTime dateTime, string strChannel)
        {
            BroadcastModelGroup group = new BroadcastModelGroup();

            group.Channel     = strChannel;
            group.ChannelShow = SpotvService.getChannelToDisplay(strChannel);

            // add yesterday midnight.
            ObservableCollectionCustomized <IBroadcastModel> gotModelList = await getSpotvData(dateTime.AddDays(-1), SpotvService.DAY_PART_NIGHT, strChannel, true);

            group.AddRange(gotModelList);

            gotModelList = await getSpotvData(dateTime, SpotvService.DAY_PART_MORNING, strChannel);

            group.AddRange(gotModelList);
            gotModelList = await getSpotvData(dateTime, SpotvService.DAY_PART_EVENING, strChannel);

            group.AddRange(gotModelList);
            gotModelList = await getSpotvData(dateTime, SpotvService.DAY_PART_NIGHT, strChannel);

            group.AddRange(gotModelList);

            return(group);
        }