player_queue_102
This commit is contained in:
@@ -3774,6 +3774,7 @@ bool Audio::parseHttpResponseHeader() { // this is the response to a GET / reque
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
AUDIO_INFO("unknown content found at: %s", m_lastHost);
|
AUDIO_INFO("unknown content found at: %s", m_lastHost);
|
||||||
|
AUDIO_ERROR("unknown content found at: %s", m_lastHost);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1418,6 +1418,7 @@ bool Audio::parseHttpResponseHeader() { // this is the response to a GET / reque
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
AUDIO_INFO("unknown content found at: %s", m_lastHost);
|
AUDIO_INFO("unknown content found at: %s", m_lastHost);
|
||||||
|
AUDIO_ERROR("unknown content found at: %s", m_lastHost);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef options_h
|
#ifndef options_h
|
||||||
#define options_h
|
#define options_h
|
||||||
|
|
||||||
#define YOVERSION "0.9.099"
|
#define YOVERSION "0.9.102"
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
DO NOT EDIT THIS FILE.
|
DO NOT EDIT THIS FILE.
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ void Player::init() {
|
|||||||
Serial.print("##[BOOT]#\tplayer.init\t");
|
Serial.print("##[BOOT]#\tplayer.init\t");
|
||||||
playerQueue=NULL;
|
playerQueue=NULL;
|
||||||
playerQueue = xQueueCreate( 5, sizeof( playerRequestParams_t ) );
|
playerQueue = xQueueCreate( 5, sizeof( playerRequestParams_t ) );
|
||||||
|
|
||||||
|
memset(_plError, 0, PLERR_LN);
|
||||||
#ifdef MQTT_ROOT_TOPIC
|
#ifdef MQTT_ROOT_TOPIC
|
||||||
memset(burl, 0, MQTT_BURL_SIZE);
|
memset(burl, 0, MQTT_BURL_SIZE);
|
||||||
#endif
|
#endif
|
||||||
@@ -79,11 +81,19 @@ void Player::stopInfo() {
|
|||||||
requestToStart = true;
|
requestToStart = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::setError(const char *e){
|
||||||
|
strlcpy(_plError, e, PLERR_LN);
|
||||||
|
if(hasError()) {
|
||||||
|
config.setTitle(_plError);
|
||||||
|
telnet.printf("##ERROR#:\t%s\n", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Player::_stop(bool alreadyStopped){
|
void Player::_stop(bool alreadyStopped){
|
||||||
if(config.store.play_mode==PM_SDCARD) config.sdResumePos = player.getFilePos();
|
if(config.store.play_mode==PM_SDCARD) config.sdResumePos = player.getFilePos();
|
||||||
_status = STOPPED;
|
_status = STOPPED;
|
||||||
setOutputPins(false);
|
setOutputPins(false);
|
||||||
config.setTitle((display.mode()==LOST || display.mode()==UPDATING)?"":const_PlStopped);
|
if(!hasError()) config.setTitle((display.mode()==LOST || display.mode()==UPDATING)?"":const_PlStopped);
|
||||||
config.station.bitrate = 0;
|
config.station.bitrate = 0;
|
||||||
#ifdef USE_NEXTION
|
#ifdef USE_NEXTION
|
||||||
nextion.bitrate(config.station.bitrate);
|
nextion.bitrate(config.station.bitrate);
|
||||||
@@ -155,6 +165,7 @@ void Player::setOutputPins(bool isPlaying) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Player::_play(uint16_t stationId) {
|
void Player::_play(uint16_t stationId) {
|
||||||
|
setError("");
|
||||||
remoteStationName = false;
|
remoteStationName = false;
|
||||||
config.setDspOn(1);
|
config.setDspOn(1);
|
||||||
display.putRequest(PSTOP);
|
display.putRequest(PSTOP);
|
||||||
@@ -179,12 +190,14 @@ void Player::_play(uint16_t stationId) {
|
|||||||
if (player_on_start_play) player_on_start_play();
|
if (player_on_start_play) player_on_start_play();
|
||||||
}else{
|
}else{
|
||||||
telnet.printf("##ERROR#:\tError connecting to %s\n", config.station.url);
|
telnet.printf("##ERROR#:\tError connecting to %s\n", config.station.url);
|
||||||
|
SET_PLAY_ERROR("Error connecting to %s", config.station.url);
|
||||||
_stop(true);
|
_stop(true);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MQTT_ROOT_TOPIC
|
#ifdef MQTT_ROOT_TOPIC
|
||||||
void Player::browseUrl(){
|
void Player::browseUrl(){
|
||||||
|
setError("");
|
||||||
remoteStationName = true;
|
remoteStationName = true;
|
||||||
config.setDspOn(1);
|
config.setDspOn(1);
|
||||||
resumeAfterUrl = _status==PLAYING;
|
resumeAfterUrl = _status==PLAYING;
|
||||||
@@ -202,6 +215,7 @@ void Player::browseUrl(){
|
|||||||
if (player_on_start_play) player_on_start_play();
|
if (player_on_start_play) player_on_start_play();
|
||||||
}else{
|
}else{
|
||||||
telnet.printf("##ERROR#:\tError connecting to %s\n", burl);
|
telnet.printf("##ERROR#:\tError connecting to %s\n", burl);
|
||||||
|
SET_PLAY_ERROR("Error connecting to %s", burl);
|
||||||
_stop(true);
|
_stop(true);
|
||||||
}
|
}
|
||||||
memset(burl, 0, MQTT_BURL_SIZE);
|
memset(burl, 0, MQTT_BURL_SIZE);
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
#define MQTT_BURL_SIZE 512
|
#define MQTT_BURL_SIZE 512
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define PLERR_LN 64
|
||||||
|
#define SET_PLAY_ERROR(...) {char buff[512 + 64]; sprintf(buff,__VA_ARGS__); setError(buff);}
|
||||||
|
|
||||||
enum playerRequestType_e : uint8_t { PR_PLAY = 1, PR_STOP = 2, PR_PREV = 3, PR_NEXT = 4, PR_VOL = 5 };
|
enum playerRequestType_e : uint8_t { PR_PLAY = 1, PR_STOP = 2, PR_PREV = 3, PR_NEXT = 4, PR_VOL = 5 };
|
||||||
struct playerRequestParams_t
|
struct playerRequestParams_t
|
||||||
{
|
{
|
||||||
@@ -27,6 +30,7 @@ class Player: public Audio {
|
|||||||
bool _volTimer; /* delayed volume save */
|
bool _volTimer; /* delayed volume save */
|
||||||
uint32_t _resumeFilePos;
|
uint32_t _resumeFilePos;
|
||||||
plStatus_e _status;
|
plStatus_e _status;
|
||||||
|
char _plError[PLERR_LN];
|
||||||
private:
|
private:
|
||||||
void _stop(bool alreadyStopped = false);
|
void _stop(bool alreadyStopped = false);
|
||||||
void _play(uint16_t stationId);
|
void _play(uint16_t stationId);
|
||||||
@@ -45,6 +49,8 @@ class Player: public Audio {
|
|||||||
void init();
|
void init();
|
||||||
void loop();
|
void loop();
|
||||||
void initHeaders(const char *file);
|
void initHeaders(const char *file);
|
||||||
|
void setError(const char *e);
|
||||||
|
bool hasError() { return strlen(_plError)>0; }
|
||||||
void sendCommand(playerRequestParams_t request);
|
void sendCommand(playerRequestParams_t request);
|
||||||
#ifdef MQTT_ROOT_TOPIC
|
#ifdef MQTT_ROOT_TOPIC
|
||||||
void browseUrl();
|
void browseUrl();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER };
|
|||||||
const ProgressConfig bootPrgConf PROGMEM = { 90, 14, 4 };
|
const ProgressConfig bootPrgConf PROGMEM = { 90, 14, 4 };
|
||||||
|
|
||||||
/* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */
|
/* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */
|
||||||
const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 5 };
|
const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 2 };
|
||||||
|
|
||||||
/* STRINGS */
|
/* STRINGS */
|
||||||
const char numtxtFmt[] PROGMEM = "%d";
|
const char numtxtFmt[] PROGMEM = "%d";
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER };
|
|||||||
const ProgressConfig bootPrgConf PROGMEM = { 90, 14, 4 };
|
const ProgressConfig bootPrgConf PROGMEM = { 90, 14, 4 };
|
||||||
|
|
||||||
/* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */
|
/* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */
|
||||||
const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 4 };
|
const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 2 };
|
||||||
|
|
||||||
/* STRINGS */
|
/* STRINGS */
|
||||||
const char numtxtFmt[] PROGMEM = "%d";
|
const char numtxtFmt[] PROGMEM = "%d";
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ void audio_info(const char *info) {
|
|||||||
#endif
|
#endif
|
||||||
if (strstr(info, "skip metadata") != NULL) config.setTitle(config.station.name);
|
if (strstr(info, "skip metadata") != NULL) config.setTitle(config.station.name);
|
||||||
if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL) {
|
if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL) {
|
||||||
telnet.printf("##ERROR#:\t%s\n", info);
|
player.setError(info);
|
||||||
|
|
||||||
}
|
}
|
||||||
char* ici; char b[20]={0};
|
char* ici; char b[20]={0};
|
||||||
if ((ici = strstr(info, "BitRate: ")) != NULL) {
|
if ((ici = strstr(info, "BitRate: ")) != NULL) {
|
||||||
@@ -132,8 +133,8 @@ bool printable(const char *info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void audio_showstation(const char *info) {
|
void audio_showstation(const char *info) {
|
||||||
bool p = printable(info) && (strlen(info) > 0);
|
bool p = printable(info) && (strlen(info) > 0);(void)p;
|
||||||
config.setTitle(p?info:config.station.name);
|
//config.setTitle(p?info:config.station.name);
|
||||||
if(player.remoteStationName){
|
if(player.remoteStationName){
|
||||||
config.setStation(p?info:config.station.name);
|
config.setStation(p?info:config.station.name);
|
||||||
display.putRequest(NEWSTATION);
|
display.putRequest(NEWSTATION);
|
||||||
@@ -143,9 +144,7 @@ void audio_showstation(const char *info) {
|
|||||||
|
|
||||||
void audio_showstreamtitle(const char *info) {
|
void audio_showstreamtitle(const char *info) {
|
||||||
DBGH();
|
DBGH();
|
||||||
if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL){
|
if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL) player.setError(info);
|
||||||
telnet.printf("##ERROR#:\t%s\n", info);
|
|
||||||
}
|
|
||||||
bool p = printable(info) && (strlen(info) > 0);
|
bool p = printable(info) && (strlen(info) > 0);
|
||||||
#ifdef DEBUG_TITLES
|
#ifdef DEBUG_TITLES
|
||||||
config.setTitle(DEBUG_TITLES);
|
config.setTitle(DEBUG_TITLES);
|
||||||
@@ -155,7 +154,8 @@ void audio_showstreamtitle(const char *info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void audio_error(const char *info) {
|
void audio_error(const char *info) {
|
||||||
config.setTitle(info);
|
//config.setTitle(info);
|
||||||
|
player.setError(info);
|
||||||
telnet.printf("##ERROR#:\t%s\n", info);
|
telnet.printf("##ERROR#:\t%s\n", info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user