示例#1
0
文件: main.go 项目: soasme/gofm
func PrintChannelInfo(id string) {
	defer func() {
		if r := recover(); r != nil {
			fmt.Print("Fatal! not found this channel.\n>> ")
			return
		}
	}()
	fmt.Println("\rFetching Channels ", id, " ...")
	channel := new(model.Channel)
	ch := channel.FetchChannelInfo(id)
	fmt.Print(ch.Name + "(" + id + ") \n" +
		"Intro: " + ch.Intro + "\n" +
		"Hot Songs: " + strings.Join(ch.Hot_songs, " ") +
		" (totals: " + strconv.Itoa(ch.Song_num) + ")")
	fmt.Print("\n>> ")
}
示例#2
0
文件: main.go 项目: soasme/gofm
func PrintHotChannels() {
	defer func() {
		if r := recover(); r != nil {
			fmt.Print("Fatal! not found hot channels.\n>> ")
			return
		}
	}()
	fmt.Print("\rFetching Hot Channels...")
	channels := new(model.Channel)
	total, hot_channels := channels.FetchHotChannels()
	if total != 0 {
		fmt.Print("\r")
	}
	for _, c := range hot_channels {
		fmt.Print(c.Name, "(", c.Id, ") ")
	}
	fmt.Print("\n>> ")
}