update the cc from R16

This commit is contained in:
刘国建 2018-09-26 11:44:30 +08:00
parent 5621337281
commit e211f328b4
7 changed files with 139 additions and 59 deletions

View File

@ -1 +1 @@
{"version":"1.0.0.8", "md5":"76078e2fcf6ddd0ee1d31ef93a715f9f"} {"version":"1.0.0.9", "md5":"ba700cada4fd3bd2a74c50fd6108431e"}

View File

@ -13,6 +13,9 @@ const (
// server err code // server err code
SERVER_RET_NIL_OR_INVALID_LIST = 4004 SERVER_RET_NIL_OR_INVALID_LIST = 4004
// server code,用于触发服务器的命令是否成功的返回code成功就返回9000
SERVER_RET_TRIG_CMD_OK = 9000
) )
const ( const (
@ -79,7 +82,7 @@ const (
URL_Common_GetPlaylist_Rcmd = "vbox/music/common/getplaylist" URL_Common_GetPlaylist_Rcmd = "vbox/music/common/getplaylist"
//自然声获取list接口 //自然声获取list接口
URL_Natual_GetPlaylist_Rcmd = "vbox/radio/nature/get" URL_Next_Song_Get_Rcmd = "vbox/radio/nature/get"
//电台detail接口 //电台detail接口
URL_Radio_Detail_Rcmd = "vbox/radio/geturl" URL_Radio_Detail_Rcmd = "vbox/radio/geturl"
@ -399,9 +402,11 @@ type reqCommonGetPlayListRcmd struct {
PlayMode globals.MusicPlayMode `json:"playMode"` PlayMode globals.MusicPlayMode `json:"playMode"`
} }
type reqGetNaturalPlayListRcmd struct { type reqGetNextSongRcmd struct {
SongId string `json:"id"` SongId string `json:"id"`
ExtraData string `json:"extraData"` ExtraData string `json:"extraData"`
PlaySource int `json:"playSource,omitempty"`
Cmd int `json:"cmd,omitempty"`
} }
type reqGetRadioPlayListRcmd struct { type reqGetRadioPlayListRcmd struct {
@ -593,7 +598,9 @@ type MusicListServerType struct {
Order globals.MusicLenType Order globals.MusicLenType
//内部用主要用于区别自然声的下一首还是获取list //内部用主要用于区别自然声的下一首还是获取list
NextMusic bool TrigServer bool
Cmd int //需要当前触发服务器的命令,便于以后扩展,当前只有下一首
Source int //play Source
} }
//获取歌单信息 //获取歌单信息

View File

@ -48,7 +48,7 @@ func init() {
RegisteApi(reqBirthdayInfo{}, ApiContainer{Url: URL_BIRTHDAY_INFO, ReqparamIsString: true, IsEncrypted: true}) RegisteApi(reqBirthdayInfo{}, ApiContainer{Url: URL_BIRTHDAY_INFO, ReqparamIsString: true, IsEncrypted: true})
RegisteApi(reqCommonGetPlayListRcmd{}, ApiContainer{Url: URL_Common_GetPlaylist_Rcmd, ReqparamIsString: true, IsEncrypted: true}) RegisteApi(reqCommonGetPlayListRcmd{}, ApiContainer{Url: URL_Common_GetPlaylist_Rcmd, ReqparamIsString: true, IsEncrypted: true})
RegisteApi(reqGetNaturalPlayListRcmd{}, ApiContainer{Url: URL_Natual_GetPlaylist_Rcmd, ReqparamIsString: true, IsEncrypted: true}) RegisteApi(reqGetNextSongRcmd{}, ApiContainer{Url: URL_Next_Song_Get_Rcmd, ReqparamIsString: true, IsEncrypted: true})
RegisteApi(reqRadioDetailInfo{}, ApiContainer{Url: URL_Radio_Detail_Rcmd, ReqparamIsString: true, IsEncrypted: true}) RegisteApi(reqRadioDetailInfo{}, ApiContainer{Url: URL_Radio_Detail_Rcmd, ReqparamIsString: true, IsEncrypted: true})
RegisteApi(reqGetRadioPlayListRcmd{}, ApiContainer{Url: URL_Get_Radio_List_Rcmd, ReqparamIsString: true, IsEncrypted: true}) RegisteApi(reqGetRadioPlayListRcmd{}, ApiContainer{Url: URL_Get_Radio_List_Rcmd, ReqparamIsString: true, IsEncrypted: true})
@ -151,41 +151,50 @@ func GetMusicListDoNew(musicList MusicListServerType) (*ServerMusicList, int, *s
var code int var code int
var detail string var detail string
var err error var err error
switch musicList.Src {
case SERVER_RCMD: if musicList.TrigServer {
req := reqServerRcmd{PlayMode: musicList.Mode, WantTts: musicList.WantTts} if int(PlayerType_Wifi) == musicList.Source {
code, detail, err = postInterface(req, &res) if musicList.Src == NATURAL_SOUND_LIST {
case SIMILAR_SONG: var req reqGetNextSongRcmd
req := reqSongSimilarList{Size: musicList.Size, SongId: *musicList.Id, ModeId: musicList.ModeId}
code, detail, err = postInterface(req, &res)
res.ExtraData = musicList.ExtraData
case MUSIC_SPECIAL_RCMD:
log.Println(log.WarningLog, "Get special music from server...")
req := reqMusicSpecialRcmd{Type: musicList.Src, PlayMode: musicList.Mode}
code, detail, err = postInterface(req, &res)
default:
if musicList.Src > MUSIC_COMMON_TYPE_LIST && musicList.Src < RADIO_COMMON_TYPE_LIST {
log.Println(log.WarningLog, "Get common play list from server, type Id: ", musicList.Src)
var req reqCommonGetPlayListRcmd
if musicList.Id == nil {
req = reqCommonGetPlayListRcmd{Type: musicList.Src, Size: musicList.Size,
Start: musicList.Start, ModeId: musicList.ModeId, PlayMode: musicList.Mode}
} else {
req = reqCommonGetPlayListRcmd{Type: musicList.Src, Id: *musicList.Id, Size: musicList.Size,
Start: musicList.Start, ModeId: musicList.ModeId, PlayMode: musicList.Mode}
}
code, detail, err = postInterface(req, &res)
} else if musicList.Src > RADIO_COMMON_TYPE_LIST {
log.Println(log.WarningLog, "Get radio play list from server, type Id: ", musicList.Src)
if musicList.Src == NATURAL_SOUND_LIST && musicList.NextMusic {
var req reqGetNaturalPlayListRcmd
if musicList.Id == nil { if musicList.Id == nil {
req = reqGetNaturalPlayListRcmd{ExtraData: musicList.ExtraData} req = reqGetNextSongRcmd{ExtraData: musicList.ExtraData}
} else { } else {
req = reqGetNaturalPlayListRcmd{SongId: *musicList.Id, ExtraData: musicList.ExtraData} req = reqGetNextSongRcmd{SongId: *musicList.Id, ExtraData: musicList.ExtraData}
} }
code, detail, err = postInterface(req, &res) code, detail, err = postInterface(req, &res)
} else { }
} else if int(PlayerType_Dlna) == musicList.Source {
var req reqGetNextSongRcmd
req = reqGetNextSongRcmd{ExtraData: musicList.ExtraData, PlaySource:musicList.Source, Cmd:musicList.Cmd}
code, detail, err = postInterface(req, &res)
}
} else {
switch musicList.Src {
case SERVER_RCMD:
req := reqServerRcmd{PlayMode: musicList.Mode, WantTts: musicList.WantTts}
code, detail, err = postInterface(req, &res)
case SIMILAR_SONG:
req := reqSongSimilarList{Size: musicList.Size, SongId: *musicList.Id, ModeId: musicList.ModeId}
code, detail, err = postInterface(req, &res)
res.ExtraData = musicList.ExtraData
case MUSIC_SPECIAL_RCMD:
log.Println(log.WarningLog, "Get special music from server...")
req := reqMusicSpecialRcmd{Type: musicList.Src, PlayMode: musicList.Mode}
code, detail, err = postInterface(req, &res)
default:
if musicList.Src > MUSIC_COMMON_TYPE_LIST && musicList.Src < RADIO_COMMON_TYPE_LIST {
log.Println(log.WarningLog, "Get common play list from server, type Id: ", musicList.Src)
var req reqCommonGetPlayListRcmd
if musicList.Id == nil {
req = reqCommonGetPlayListRcmd{Type: musicList.Src, Size: musicList.Size,
Start: musicList.Start, ModeId: musicList.ModeId, PlayMode: musicList.Mode}
} else {
req = reqCommonGetPlayListRcmd{Type: musicList.Src, Id: *musicList.Id, Size: musicList.Size,
Start: musicList.Start, ModeId: musicList.ModeId, PlayMode: musicList.Mode}
}
code, detail, err = postInterface(req, &res)
} else if musicList.Src > RADIO_COMMON_TYPE_LIST {
log.Println(log.WarningLog, "Get radio play list from server, type Id: ", musicList.Src)
var req reqGetRadioPlayListRcmd var req reqGetRadioPlayListRcmd
if musicList.Id == nil { if musicList.Id == nil {
req = reqGetRadioPlayListRcmd{AlbumId: musicList.AlbumID, BizType: musicList.BizType, Offset: musicList.Start, Limit: musicList.Size, Order: musicList.Order, ExtraData: musicList.ExtraData} req = reqGetRadioPlayListRcmd{AlbumId: musicList.AlbumID, BizType: musicList.BizType, Offset: musicList.Start, Limit: musicList.Size, Order: musicList.Order, ExtraData: musicList.ExtraData}
@ -193,11 +202,10 @@ func GetMusicListDoNew(musicList MusicListServerType) (*ServerMusicList, int, *s
req = reqGetRadioPlayListRcmd{SongId: *musicList.Id, AlbumId: musicList.AlbumID, BizType: musicList.BizType, Offset: musicList.Start, Limit: musicList.Size, Order: musicList.Order, ExtraData: musicList.ExtraData} req = reqGetRadioPlayListRcmd{SongId: *musicList.Id, AlbumId: musicList.AlbumID, BizType: musicList.BizType, Offset: musicList.Start, Limit: musicList.Size, Order: musicList.Order, ExtraData: musicList.ExtraData}
} }
code, detail, err = postInterface(req, &res) code, detail, err = postInterface(req, &res)
} else {
return getMusicListDo(musicList.Src, musicList.Id, musicList.Params, musicList.Start, musicList.Size,
musicList.Mode, musicList.ExtraData)
} }
} else {
return getMusicListDo(musicList.Src, musicList.Id, musicList.Params, musicList.Start, musicList.Size,
musicList.Mode, musicList.ExtraData)
} }
} }

View File

@ -433,15 +433,44 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
} }
case PlayerType_Dlna: case PlayerType_Dlna:
/*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216 if retData.Desc != MSC_CMD_ONE_SHOT_WAKEUP && retData.Desc != MSC_CMD_ONE_SHOT {
log.Println(log.DebugLog, "not one shot cmd for dlna in pause mode, just return")
/*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216
if retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP { if retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP {
log.Println(log.WarningLog, "can not use one shot cmd ", TTS_NOT_UNSUPPORT) log.Println(log.WarningLog, "can not use one shot cmd ", TTS_NOT_UNSUPPORT)
http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), "下一首", TTS_NOT_UNSUPPORT) //上传信息流 http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), "下一首", TTS_NOT_UNSUPPORT) //上传信息流
} else {
http.PushInfoToServerForApp(http.InfoForApp{ResponseId: retData.RspId, Cmd: retData.Cmd, Data: TTS_NOT_UNSUPPORT, Tts: TTS_NOT_UNSUPPORT,
PlayMode: CurPlayingMode, DataType: http.DATA_TYPE_STRING})
}*/
} else { } else {
http.PushInfoToServerForApp(http.InfoForApp{ResponseId: retData.RspId, Cmd: retData.Cmd, Data: TTS_NOT_UNSUPPORT, Tts: TTS_NOT_UNSUPPORT, log.Println(log.DebugLog, "one shot cmd for dlna, so trig next from server")
PlayMode: CurPlayingMode, DataType: http.DATA_TYPE_STRING}) serverListParams := http.MusicListServerType{
}*/ Src: MUSIC_LIST_NULL,
Id: nil,
Params: nil,
Start: 0,
Size: PAGE_SIZE,
WantTts: false,
ExtraData: PlayListSrcRec.ExtraData,
BizType: PlayListSrcRec.BizType,
TrigServer: true,
Cmd: retData.Cmd,
Source: int(PlayerType_Dlna),
Mode: CurPlayingMode,
}
_, err := GetMusicListNew(PlayerType_Wifi, true, serverListParams)
if nil != err {
NoticePlayerSendSCmd(SCMD_SuperTask_Tts_Play, MusicErrTtsMap[string(MUSIC_LIST_NULL)], CONST_AUDIO_ID, AdSrcType_TTS,
TTS_LEVEL_1, true, false)
log.Println(log.ErrorLog, err.Error())
} else {
go http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), TTS_MUSIC_NEXT, TTS_MUSIC_NEXT) //上传信息流
}
}
return return
default: default:
@ -459,15 +488,44 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
})*/ })*/
} }
case PlayerType_Dlna: case PlayerType_Dlna:
/*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216 if retData.Desc != MSC_CMD_ONE_SHOT_WAKEUP && retData.Desc != MSC_CMD_ONE_SHOT {
log.Println(log.DebugLog, "not one shot cmd for dlna in pause mode, just return")
/*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216
if retData.Desc == MSC_CMD_ONE_SHOT || retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP { if retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP {
log.Println(log.WarningLog, "can not use one shot cmd ", TTS_NOT_UNSUPPORT) log.Println(log.WarningLog, "can not use one shot cmd ", TTS_NOT_UNSUPPORT)
http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), "下一首", TTS_NOT_UNSUPPORT) //上传信息流 http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), "下一首", TTS_NOT_UNSUPPORT) //上传信息流
} else {
http.PushInfoToServerForApp(http.InfoForApp{ResponseId: retData.RspId, Cmd: retData.Cmd, Data: TTS_NOT_UNSUPPORT, Tts: TTS_NOT_UNSUPPORT,
PlayMode: CurPlayingMode, DataType: http.DATA_TYPE_STRING})
}*/
} else { } else {
http.PushInfoToServerForApp(http.InfoForApp{ResponseId: retData.RspId, Cmd: retData.Cmd, Data: TTS_NOT_UNSUPPORT, Tts: TTS_NOT_UNSUPPORT, log.Println(log.DebugLog, "one shot cmd for dlna, so trig next from server")
PlayMode: CurPlayingMode, DataType: http.DATA_TYPE_STRING}) serverListParams := http.MusicListServerType{
}*/ Src: MUSIC_LIST_NULL,
Id: nil,
Params: nil,
Start: 0,
Size: PAGE_SIZE,
WantTts: false,
ExtraData: PlayListSrcRec.ExtraData,
BizType: PlayListSrcRec.BizType,
TrigServer: true,
Cmd: retData.Cmd,
Source: int(PlayerType_Dlna),
Mode: CurPlayingMode,
}
_, err := GetMusicListNew(PlayerType_Wifi, true, serverListParams)
if nil != err {
NoticePlayerSendSCmd(SCMD_SuperTask_Tts_Play, MusicErrTtsMap[string(MUSIC_LIST_NULL)], CONST_AUDIO_ID, AdSrcType_TTS,
TTS_LEVEL_1, true, false)
log.Println(log.ErrorLog, err.Error())
} else {
go http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), TTS_MUSIC_NEXT, TTS_MUSIC_NEXT) //上传信息流
}
}
return return
default: default:
log.Println(log.ErrorLog, "err playerId:", GetCurPlayerId()) log.Println(log.ErrorLog, "err playerId:", GetCurPlayerId())
@ -498,7 +556,9 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
ExtraData: PlayListSrcRec.ExtraData, ExtraData: PlayListSrcRec.ExtraData,
BizType: PlayListSrcRec.BizType, BizType: PlayListSrcRec.BizType,
NextMusic: true, TrigServer: true,
Cmd: retData.Cmd,
Source: int(PlayerType_Wifi),
Mode: CurPlayingMode, Mode: CurPlayingMode,
} }

View File

@ -574,6 +574,11 @@ func GetMusicListNew(playerType PlayerType, ttsNow bool, serverList http.MusicLi
return nil, MusicList_ERR_MUSICINFO_NULL return nil, MusicList_ERR_MUSICINFO_NULL
} }
if http.SERVER_RET_TRIG_CMD_OK == code {
log.Println(log.WarningLog, "server is return OK")
return nil, nil
}
if len(err.Error()) > 0 { if len(err.Error()) > 0 {
if ttsNow { if ttsNow {
forcePausePlayer(playerType) forcePausePlayer(playerType)

View File

@ -420,9 +420,9 @@ func updateDlnaPlayerStatus(status PlayerDetail) uint8 {
PlayerType_Dlna, PlayerType_Dlna,
precent) precent)
if MUSIC_ST_PLAYING == status.Status { if MUSIC_ST_PLAYING == status.Status {
log.Printf(log.DebugLog, "%s\r", printStr) fmt.Printf("%s\r", printStr)
} else { } else {
log.Printf(log.DebugLog, "%s\n", printStr) fmt.Printf("%s\n", printStr)
} }
return precent return precent
} }