Skip to content

Commit de97530

Browse files
committed
v0.7.414
1 parent 223bae1 commit de97530

File tree

6 files changed

+33
-29
lines changed

6 files changed

+33
-29
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ Work is in progress...
317317

318318
---
319319
## Version history
320+
#### v0.7.414
321+
- fixed non latin long titles of songs error
322+
320323
#### v0.7.402
321324
**!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** \
322325
**Please backup playlist.csv and wifi.csv before updating.**

yoRadio/audiohandlers.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ void audio_showstation(const char *info) {
5757
void audio_showstreamtitle(const char *info) {
5858
if (strlen(info) > 0) {
5959
bool p = printable(info);
60+
#ifdef DEBUG_TITLES
61+
config.setTitle(DEBUG_TITLES);
62+
#else
6063
config.setTitle(p?info:"*****");
64+
#endif
6165
netserver.requestOnChange(TITLE, 0);
6266
}
6367
}

yoRadio/config.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ void DBGVB(const char *format, ...) {
1717
#endif
1818
}
1919

20+
void u8fix(char *src){
21+
char last = src[strlen(src)-1];
22+
if ((uint8_t)last >= 0xC2) src[strlen(src)-1]='\0';
23+
}
24+
2025
void Config::init() {
2126
EEPROM.begin(EEPROM_SIZE);
2227
#if IR_PIN!=255
@@ -223,12 +228,14 @@ byte Config::setLastSSID(byte val) {
223228
void Config::setTitle(const char* title) {
224229
memset(config.station.title, 0, BUFLEN);
225230
strlcpy(config.station.title, title, BUFLEN);
231+
u8fix(config.station.title);
226232
display.putRequest({NEWTITLE, 0});
227233
}
228234

229235
void Config::setStation(const char* station) {
230236
memset(config.station.name, 0, BUFLEN);
231237
strlcpy(config.station.name, station, BUFLEN);
238+
u8fix(config.station.title);
232239
}
233240

234241
void Config::indexPlaylist() {

yoRadio/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define INDEX_PATH "/data/index.dat"
1515

1616
void DBGVB(const char *format, ...);
17+
void u8fix(char *src);
1718

1819
struct theme_t {
1920
uint16_t background;

yoRadio/display.cpp

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,6 @@ void Display::station() {
558558
nextion.newNameset(config.station.name);
559559
nextion.bitrate(config.station.bitrate);
560560
nextion.bitratePic(ICON_NA);
561-
#endif
562-
#ifdef DEBUG_TITLES
563-
meta.setText(dsp.utf8Rus("Utenim adminim veniam FM", true));
564561
#endif
565562
//dsp.loop(true);
566563
//netserver.requestOnChange(STATION, 0);
@@ -570,44 +567,36 @@ void Display::returnTile() {
570567
meta.setText(dsp.utf8Rus(config.station.name, true));
571568
#ifdef USE_NEXTION
572569
nextion.newNameset(config.station.name);
573-
#endif
574-
#ifdef DEBUG_TITLES
575-
meta.setText(dsp.utf8Rus("Utenim adminim veniam FM", true));
576570
#endif
577571
meta.reset();
578572
//dsp.loop(true);
579573
}
580574

575+
char *split(char *str, const char *delim) {
576+
char *dmp = strstr(str, delim);
577+
if (dmp == NULL) return NULL;
578+
*dmp = '\0';
579+
return dmp + strlen(delim);
580+
}
581+
581582
void Display::title() {
582-
/*
583-
memset(config.station.title, 0, BUFLEN);
584-
strlcpy(config.station.title, str, BUFLEN);
585-
*/
586-
char ttl[BUFLEN / 2] = { 0 };
587-
char sng[BUFLEN / 2] = { 0 };
583+
DBGVB("call of %s(), config.station.title=%s", __func__, config.station.title);
588584
if (strlen(config.station.title) > 0) {
589-
char* ici;
590-
if ((ici = strstr(config.station.title, " - ")) != NULL && TITLE_SIZE2 != 0) {
591-
strlcpy(sng, ici + 3, BUFLEN / 2);
592-
strlcpy(ttl, config.station.title, strlen(config.station.title) - strlen(ici) + 1);
593-
594-
} else {
595-
strlcpy(ttl, config.station.title, BUFLEN / 2);
596-
sng[0] = '\0';
585+
char tmpbuf[strlen(config.station.title)+1];
586+
strlcpy(tmpbuf, config.station.title, strlen(config.station.title)+1);
587+
char *stitle = split(tmpbuf, " - ");
588+
if(stitle && TITLE_SIZE2 != 0){
589+
title1.setText(dsp.utf8Rus(tmpbuf, true));
590+
title2.setText(dsp.utf8Rus(stitle, true));
591+
}else{
592+
title1.setText(dsp.utf8Rus(tmpbuf, true));
593+
title2.setText(dsp.utf8Rus("", true));
597594
}
598-
#ifdef DEBUG_TITLES
599-
strlcpy(ttl, "Duis aute irure dolor in reprehenderit in voluptate velit", BUFLEN / 2);
600-
strlcpy(sng, "Excepteur sint occaecat cupidatat non proident", BUFLEN / 2);
601-
#endif
602-
title1.setText(dsp.utf8Rus(ttl, true));
603-
if (TITLE_SIZE2 != 0) title2.setText(dsp.utf8Rus(sng, true));
604595
#ifdef USE_NEXTION
605596
nextion.newTitle(config.station.title);
606597
#endif
607-
//dsp.loop(true);
608598
if (player_on_track_change) player_on_track_change();
609599
}
610-
//netserver.requestOnChange(TITLE, 0);
611600
}
612601

613602
void Display::heap() {

yoRadio/options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef options_h
22
#define options_h
33

4-
#define VERSION "0.7.402"
4+
#define VERSION "0.7.414"
55

66
/*******************************************************
77
DO NOT EDIT THIS FILE.

0 commit comments

Comments
 (0)