audioplayer. add streamripper control to record current stream

Origin commit data
------------------
Branch: ni/coolstream
Commit: 24affa8a8b
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-08-17 (Thu, 17 Aug 2017)

Origin message was:
------------------
- audioplayer. add streamripper control to record current stream

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-08-17 21:13:19 +02:00
parent ceab6aafbb
commit 025b8adad6
9 changed files with 84 additions and 2 deletions

View File

@@ -198,6 +198,9 @@ audioplayer.select_title_by_name Titelsuche nach Name (SMS)
audioplayer.show_playlist Playlist anzeigen
audioplayer.shuffle Zufällig
audioplayer.spectrum LCD Skala
audioplayer.streamripper_dir Streamripper-Verzeichnis
audioplayer.streamripper_start Streamripper starten
audioplayer.streamripper_stop Streamripper stoppen
audioplayer.stop Stopp
audioplayer.title_artist Titel, Interpret
blank_screen Blanker Bildschirm
@@ -1123,6 +1126,7 @@ menu.hint_audioplayer_order Ändern der Sortierreihenfolge der Wiedergabeliste
menu.hint_audioplayer_playlist Aktiviert die Anzeige der Titel in der Wiedergabeliste
menu.hint_audioplayer_repeat Aktiviert das Wiederholen der Wiedergabeliste, wenn das Ende erreicht ist
menu.hint_audioplayer_sc_metadata Aktiviert das Anzeigen der Audio-Metadaten
menu.hint_audioplayer_streamripper_dir Wählen Sie das Aufnahmeverzeichnis für den Streamripper
menu.hint_audioplayer_title Aktivieren Sie die Titelsuche (SMS-Stil) in der Playliste
menu.hint_auto_lang Wählen Sie, ob automatisch ihre bevorzugte Tonspur ausgewählt wird, wenn sie vorhanden ist
menu.hint_auto_subs Automatische Anzeige der Untertitel in Ihrer bevorzugten Sprache

View File

@@ -198,6 +198,9 @@ audioplayer.select_title_by_name Search title by name (SMS)
audioplayer.show_playlist Show playlist
audioplayer.shuffle Shuffle
audioplayer.spectrum LCD spectrum
audioplayer.streamripper_dir Streamripper directory
audioplayer.streamripper_start Start streamripper
audioplayer.streamripper_stop Stop streamripper
audioplayer.stop Stop
audioplayer.title_artist Title, artist
blank_screen Blank screen
@@ -1123,6 +1126,7 @@ menu.hint_audioplayer_order Change playlist sort order
menu.hint_audioplayer_playlist Show playlist items
menu.hint_audioplayer_repeat Enable playlist repeat when end of list reached
menu.hint_audioplayer_sc_metadata Enable streaming audio metadata parsing
menu.hint_audioplayer_streamripper_dir Default streamripper target directory
menu.hint_audioplayer_title Enable SMS-style title search in playlist
menu.hint_auto_lang Auto-switch audio to preferred language
menu.hint_auto_subs Auto-start subtitles for preferred language

View File

@@ -216,7 +216,7 @@ CAudioPlayerGui::~CAudioPlayerGui()
delete m_titlebox;
}
const struct button_label AudioPlayerButtons[][4] =
/*const*/ struct button_label AudioPlayerButtons[][4] =
{
{
{ NEUTRINO_ICON_BUTTON_STOP , LOCALE_AUDIOPLAYER_STOP },
@@ -249,6 +249,7 @@ const struct button_label AudioPlayerButtons[][4] =
{
{ NEUTRINO_ICON_BUTTON_STOP , LOCALE_AUDIOPLAYER_STOP },
{ NEUTRINO_ICON_BUTTON_PAUSE , LOCALE_AUDIOPLAYER_PAUSE },
{ NEUTRINO_ICON_BUTTON_RECORD_ACTIVE, LOCALE_AUDIOPLAYER_STREAMRIPPER_START },
},
{
{ NEUTRINO_ICON_BUTTON_GREEN , LOCALE_AUDIOPLAYER_ADD },
@@ -321,6 +322,9 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
m_idletime = time(NULL);
m_screensaver = false;
m_streamripper_available = !find_executable("streamripper").empty() && !find_executable("streamripper.sh").empty();
m_streamripper_active = false;
if (parent)
parent->hide();
@@ -838,6 +842,32 @@ int CAudioPlayerGui::show()
update = true;
}
}
else if (msg == (neutrino_msg_t) g_settings.key_record)
{
if (m_key_level == 1)
{
if (m_curr_audiofile.FileType == CFile::STREAM_AUDIO && m_streamripper_available)
{
if (m_streamripper_active)
{
ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_AUDIOPLAYER_STREAMRIPPER_STOP, HINTBOX_MIN_WIDTH, 2);
my_system(2, "streamripper.sh", "stop");
m_streamripper_active = false;
}
else
{
ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_AUDIOPLAYER_STREAMRIPPER_START, HINTBOX_MIN_WIDTH, 2);
printf("streamripper.sh start \"%s\"\n", m_playlist[m_current].MetaData.url.c_str());
puts("[audioplayer.cpp] executing streamripper");
if (my_system(3, "streamripper.sh", "start", m_playlist[m_current].MetaData.url.c_str()) != 0)
perror("[audioplayer.cpp]: streamripper.sh failed\n");
else
m_streamripper_active = true;
}
update = true;
}
}
}
else if (CRCInput::isNumeric(msg) && !(m_playlist.empty()))
{ //numeric zap or SMS zap
if (m_select_title_by_name)
@@ -1730,7 +1760,18 @@ void CAudioPlayerGui::paintFoot()
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
::paintButtons(button_x, button_y, button_width, 4, AudioPlayerButtons[0], button_width, m_button_height);
else
::paintButtons(button_x, button_y, button_width, 2, AudioPlayerButtons[6], button_width, m_button_height);
{
int b = 2;
if (m_streamripper_available)
{
b = 3;
if (m_streamripper_active)
AudioPlayerButtons[6][2].locale = LOCALE_AUDIOPLAYER_STREAMRIPPER_STOP;
else
AudioPlayerButtons[6][2].locale = LOCALE_AUDIOPLAYER_STREAMRIPPER_START;
}
::paintButtons(button_x, button_y, button_width, b, AudioPlayerButtons[6], button_width, m_button_height);
}
}
else // key_level == 2
{
@@ -2028,6 +2069,13 @@ void CAudioPlayerGui::stop()
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
CAudioPlayer::getInstance()->stop();
if (m_streamripper_active)
{
ShowHint(LOCALE_MESSAGEBOX_INFO, LOCALE_AUDIOPLAYER_STREAMRIPPER_STOP, HINTBOX_MIN_WIDTH, 2);
my_system(2, "streamripper.sh", "stop");
m_streamripper_active = false;
}
}
void CAudioPlayerGui::pause()

View File

@@ -109,6 +109,8 @@ class CAudioPlayerGui : public CMenuTarget
bool m_select_title_by_name;
bool m_show_playlist;
bool m_playlistHasChanged;
bool m_streamripper_available;
bool m_streamripper_active;
CAudioPlayList m_playlist;
CAudioPlayList m_radiolist;

View File

@@ -80,6 +80,15 @@ int CAudioPlayerSetup::exec(CMenuTarget* parent, const std::string &actionKey)
return res;
}
if(actionKey == "streamripperdir")
{
CFileBrowser b;
b.Dir_Mode=true;
if (b.exec(g_settings.network_nfs_streamripperdir.c_str()))
g_settings.network_nfs_streamripperdir = b.getSelectedFile()->Name;
return res;
}
res = showAudioPlayerSetup();
return res;
@@ -136,6 +145,10 @@ int CAudioPlayerSetup::showAudioPlayerSetup()
mf->setHint("", LOCALE_MENU_HINT_AUDIOPLAYER_DEFDIR);
audioplayerSetup->addItem(mf);
mf = new CMenuForwarder(LOCALE_AUDIOPLAYER_STREAMRIPPER_DIR, true, g_settings.network_nfs_streamripperdir, this, "streamripperdir");
mf->setHint("", LOCALE_MENU_HINT_AUDIOPLAYER_STREAMRIPPER_DIR);
audioplayerSetup->addItem(mf);
mc = new CMenuOptionChooser(LOCALE_AUDIOPLAYER_ENABLE_SC_METADATA, &g_settings.audioplayer_enable_sc_metadata, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true);
mc->setHint("", LOCALE_MENU_HINT_AUDIOPLAYER_SC_METADATA);
audioplayerSetup->addItem(mc);

View File

@@ -654,6 +654,7 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.network_nfs[i].mac = configfile.getString("network_nfs_mac_" + i_str, "11:22:33:44:55:66");
}
g_settings.network_nfs_audioplayerdir = configfile.getString( "network_nfs_audioplayerdir", "/media/sda1/music" );
g_settings.network_nfs_streamripperdir = configfile.getString( "network_nfs_streamripperdir", "/media/sda1/music/streamripper" );
g_settings.network_nfs_picturedir = configfile.getString( "network_nfs_picturedir", "/media/sda1/pictures" );
g_settings.network_nfs_moviedir = configfile.getString( "network_nfs_moviedir", "/media/sda1/movies" );
g_settings.network_nfs_recordingdir = configfile.getString( "network_nfs_recordingdir", "/media/sda1/movies" );
@@ -1412,6 +1413,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setString(cfg_key, g_settings.network_nfs[i].mac);
}
configfile.setString( "network_nfs_audioplayerdir", g_settings.network_nfs_audioplayerdir);
configfile.setString( "network_nfs_streamripperdir", g_settings.network_nfs_streamripperdir);
configfile.setString( "network_nfs_picturedir", g_settings.network_nfs_picturedir);
configfile.setString( "network_nfs_moviedir", g_settings.network_nfs_moviedir);
configfile.setString( "network_nfs_recordingdir", g_settings.network_nfs_recordingdir);

View File

@@ -225,6 +225,9 @@ typedef enum
LOCALE_AUDIOPLAYER_SHOW_PLAYLIST,
LOCALE_AUDIOPLAYER_SHUFFLE,
LOCALE_AUDIOPLAYER_SPECTRUM,
LOCALE_AUDIOPLAYER_STREAMRIPPER_DIR,
LOCALE_AUDIOPLAYER_STREAMRIPPER_START,
LOCALE_AUDIOPLAYER_STREAMRIPPER_STOP,
LOCALE_AUDIOPLAYER_STOP,
LOCALE_AUDIOPLAYER_TITLE_ARTIST,
LOCALE_BLANK_SCREEN,
@@ -1150,6 +1153,7 @@ typedef enum
LOCALE_MENU_HINT_AUDIOPLAYER_PLAYLIST,
LOCALE_MENU_HINT_AUDIOPLAYER_REPEAT,
LOCALE_MENU_HINT_AUDIOPLAYER_SC_METADATA,
LOCALE_MENU_HINT_AUDIOPLAYER_STREAMRIPPER_DIR,
LOCALE_MENU_HINT_AUDIOPLAYER_TITLE,
LOCALE_MENU_HINT_AUTO_LANG,
LOCALE_MENU_HINT_AUTO_SUBS,

View File

@@ -225,6 +225,9 @@ const char * locale_real_names[] =
"audioplayer.show_playlist",
"audioplayer.shuffle",
"audioplayer.spectrum",
"audioplayer.streamripper_dir",
"audioplayer.streamripper_start",
"audioplayer.streamripper_stop",
"audioplayer.stop",
"audioplayer.title_artist",
"blank_screen",
@@ -1150,6 +1153,7 @@ const char * locale_real_names[] =
"menu.hint_audioplayer_playlist",
"menu.hint_audioplayer_repeat",
"menu.hint_audioplayer_sc_metadata",
"menu.hint_audioplayer_streamripper_dir",
"menu.hint_audioplayer_title",
"menu.hint_auto_lang",
"menu.hint_auto_subs",

View File

@@ -462,6 +462,7 @@ struct SNeutrinoSettings
std::string password;
} network_nfs[NETWORK_NFS_NR_OF_ENTRIES];
std::string network_nfs_audioplayerdir;
std::string network_nfs_streamripperdir;
std::string network_nfs_picturedir;
std::string network_nfs_moviedir;
std::string network_nfs_recordingdir;