Skip to content

Commit

Permalink
fix: 优化EPG查询和解析。
Browse files Browse the repository at this point in the history
  • Loading branch information
super321 committed Jan 27, 2025
1 parent 14764c8 commit 8232b52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/app/iptv/hwctc/epg_gdhdpublic.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type gdhdpublicChannelProgramList struct {
func (c *Client) getGdhdpublicChannelProgramList(ctx context.Context, token *Token, channel *iptv.Channel) (*iptv.ChannelProgramList, error) {
// 获取未来一天的日期
tomorrow := time.Now().AddDate(0, 0, 1)
tomorrow = time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), 0, 0, 0, 0, tomorrow.Location())

// 根据当前频道的时移范围,预估EPG的查询时间范围(加上未来一天)
epgBackDay := int(channel.TimeShiftLength.Hours()/24) + 1
Expand All @@ -50,7 +51,7 @@ func (c *Client) getGdhdpublicChannelProgramList(ctx context.Context, token *Tok
return nil, err
}
c.logger.Sugar().Warnf("Failed to get the program list for channel %s on %s. Error: %v", channel.ChannelName, dateStr, err)
break
continue
}

dateProgramList = append(dateProgramList, *dateProgram)
Expand Down
2 changes: 1 addition & 1 deletion internal/app/iptv/hwctc/epg_vsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (c *Client) getVspChannelProgramList(ctx context.Context, token *Token, cha
return nil, err
}
c.logger.Sugar().Warnf("Failed to get the program list for channel %s on %s. Error: %v", channel.ChannelName, startDate.Format("20060102"), err)
break
continue
}

dateProgramList = append(dateProgramList, iptv.DateProgram{
Expand Down

0 comments on commit 8232b52

Please sign in to comment.