diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 7878f1618..e0f7de8a5 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -244,8 +244,6 @@ CAudioPlayerGui::~CAudioPlayerGui() //------------------------------------------------------------------------ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) { - CNeutrinoApp::getInstance()->StopSubtitles(); - CAudioPlayer::getInstance()->init(); m_state = CAudioPlayerGui::STOP; @@ -336,8 +334,6 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , m_LastMode ); g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR, 0 ); - CNeutrinoApp::getInstance()->StartSubtitles(); - // always exit all return menu_return::RETURN_EXIT_ALL; } @@ -684,12 +680,12 @@ int CAudioPlayerGui::show() InputSelector.addItem(new CMenuForwarder( LOCALE_AUDIOPLAYER_ADD_LOC, true, NULL, InetRadioInputChanger, cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); - -/* sprintf(cnt, "%d", ++count); - InputSelector.addItem(new CMenuForwarder( + if(g_settings.shoutcast_dev_id != "XXXXXXXXXXXXXXXX"){ + sprintf(cnt, "%d", ++count); + InputSelector.addItem(new CMenuForwarder( LOCALE_AUDIOPLAYER_ADD_SC, true, NULL, InetRadioInputChanger, cnt, CRCInput::convertDigitToKey(count + 1)), old_select == count); -*/ + } sprintf(cnt, "%d", ++count); InputSelector.addItem(new CMenuForwarder( LOCALE_AUDIOPLAYER_ADD_IC, true, NULL, InetRadioInputChanger, @@ -707,9 +703,10 @@ int CAudioPlayerGui::show() paintLCD(); break; case 1: -/* openSCbrowser(); + if(g_settings.shoutcast_dev_id != "XXXXXXXXXXXXXXXX") + openSCbrowser(); break; - case 2:*/ + case 2: readDir_ic(); CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); paintLCD(); @@ -1400,7 +1397,10 @@ bool CAudioPlayerGui::openFilebrowser(void) bool CAudioPlayerGui::openSCbrowser(void) { bool result = false; - CFileBrowser filebrowser(SC_BASE_DIR, CFileBrowser::ModeSC); + //shoutcast + const char *sc_base_dir = "http://api.shoutcast.com"; + + CFileBrowser filebrowser(sc_base_dir, CFileBrowser::ModeSC); filebrowser.Multi_Select = true; filebrowser.Dirs_Selectable = true; @@ -1408,7 +1408,7 @@ bool CAudioPlayerGui::openSCbrowser(void) hide(); - if (filebrowser.exec(SC_INIT_DIR)) + if (filebrowser.exec(filebrowser.sc_init_dir.c_str())) { #ifdef AUDIOPLAYER_TIME_DEBUG timeval start; diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 6af4e4551..d781577ba 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -368,6 +368,8 @@ CFileBrowser::CFileBrowser(const char * const _base, const tFileBrowserMode mode void CFileBrowser::commonInit() { frameBuffer = CFrameBuffer::getInstance(); + //shoutcast + sc_init_dir = "/legacy/genrelist?k=" + g_settings.shoutcast_dev_id; Filter = NULL; use_filter = true; @@ -397,6 +399,7 @@ void CFileBrowser::commonInit() height = theight + listmaxshow * fheight + 2 * foheight; m_SMSKeyInput.setTimeout(SMSKEY_TIMEOUT); + } //------------------------------------------------------------------------ @@ -643,6 +646,10 @@ and add to neutrino playlist 4th step: play from neutrio playlist */ + //shoutcast + const std::string sc_get_top500 = "/legacy/Top500?k=" + g_settings.shoutcast_dev_id; + const std::string sc_get_genre = "/legacy/stationsearch?k=" + g_settings.shoutcast_dev_id + "&search="; + const std::string sc_tune_in_base = "http://yp.shoutcast.com"; // printf("readDir_sc %s\n",dirname.c_str()); std::string answer=""; @@ -708,7 +715,7 @@ printf("CFileBrowser::readDir_sc: read done, size %d\n", answer.size()); CFile file; file.Mode = S_IFDIR + 0777 ; file.Name = " Top500"; // use space to have it at the beginning of the list - file.Url = SC_GET_TOP500; + file.Url = sc_get_top500; file.Size = 0; file.Time = 0; flist->push_back(file); @@ -716,7 +723,7 @@ printf("CFileBrowser::readDir_sc: read done, size %d\n", answer.size()); CFile file2; file2.Mode = S_IFDIR + 0777 ; file2.Name = ".."; - file2.Url = SC_INIT_DIR; + file2.Url = sc_init_dir; file2.Size = 0; file2.Time = 0; flist->push_back(file2); @@ -726,7 +733,7 @@ printf("CFileBrowser::readDir_sc: read done, size %d\n", answer.size()); if (xml_decode == 1) { file.Mode = S_IFDIR + 0777 ; file.Name = xmlGetAttribute(element, "name"); - file.Url = (std::string)SC_GET_GENRE + file.Name; + file.Url = sc_get_genre + file.Name; file.Size = 0; file.Time = 0; flist->push_back(file); @@ -743,7 +750,7 @@ printf("CFileBrowser::readDir_sc: read done, size %d\n", answer.size()); if (ptr && (strcmp(ptr, "audio/mpeg")==0)) { file.Mode = S_IFREG + 0777 ; file.Name = xmlGetAttribute(element, "name"); - file.Url = (std::string)SC_TUNE_IN_BASE + tunein_base + (std::string)"?id=" + xmlGetAttribute(element, "id") + (std::string)"&k=" + SC_DEV_ID; + file.Url = sc_tune_in_base + tunein_base + (std::string)"?id=" + xmlGetAttribute(element, "id") + (std::string)"&k=" + g_settings.shoutcast_dev_id; //printf("adding %s (%s)\n", file.Name.c_str(), file.Url.c_str()); ptr = xmlGetAttribute(element, "br"); if (ptr) { diff --git a/src/gui/filebrowser.h b/src/gui/filebrowser.h index fe448418c..3a20ab783 100644 --- a/src/gui/filebrowser.h +++ b/src/gui/filebrowser.h @@ -56,18 +56,6 @@ #define ENABLE_INTERNETRADIO #define VLC_URI "vlc://" -#if 0 -#define SC_BASE_DIR "http://www.shoutcast.com" -#define SC_INIT_DIR "/sbin/newxml.phtml" -#else -#define SC_DEV_ID "XXXXXXXXXXXXXXXX" -#define SC_BASE_DIR "http://api.shoutcast.com" -#define SC_TUNE_IN_BASE "http://yp.shoutcast.com" -#define SC_INIT_DIR "/legacy/genrelist?k="SC_DEV_ID -#define SC_GET_GENRE "/legacy/stationsearch?k="SC_DEV_ID"&search=" -#define SC_GET_TOP500 "/legacy/Top500?k="SC_DEV_ID -#endif - bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str); bool chooserDir(char *setting_dir, bool test_dir, const char *action_str, size_t str_leng); @@ -210,6 +198,8 @@ class CFileBrowser ModeSC } tFileBrowserMode; + //shoutcast + std::string sc_init_dir; /** * @param selection select the specified entry, ignored if selection == -1 */ diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c8e898c49..006445865 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -792,6 +792,7 @@ printf("***************************** rec dir %s timeshift dir %s\n", g_settings g_settings.audioplayer_repeat_on = configfile.getInt32("audioplayer_repeat_on",0); g_settings.audioplayer_show_playlist = configfile.getInt32("audioplayer_show_playlist",1); g_settings.audioplayer_enable_sc_metadata = configfile.getInt32("audioplayer_enable_sc_metadata",1); + g_settings.shoutcast_dev_id = configfile.getString("shoutcast_dev_id","XXXXXXXXXXXXXXXX"); //Filebrowser g_settings.filebrowser_showrights = configfile.getInt32("filebrowser_showrights", 1); @@ -1292,6 +1293,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "audioplayer_repeat_on", g_settings.audioplayer_repeat_on ); configfile.setInt32( "audioplayer_show_playlist", g_settings.audioplayer_show_playlist ); configfile.setInt32( "audioplayer_enable_sc_metadata", g_settings.audioplayer_enable_sc_metadata ); + configfile.setString( "shoutcast_dev_id", g_settings.shoutcast_dev_id ); //Filebrowser configfile.setInt32("filebrowser_showrights", g_settings.filebrowser_showrights); diff --git a/src/system/settings.h b/src/system/settings.h index aee14274b..f9aea2939 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -429,7 +429,7 @@ struct SNeutrinoSettings int audioplayer_repeat_on; int audioplayer_show_playlist; int audioplayer_enable_sc_metadata; - + std::string shoutcast_dev_id; //Filebrowser int filebrowser_showrights; int filebrowser_sortmethod;