Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale
- index 5321cd3..40cda13 100644
- --- a/data/locale/deutsch.locale
- +++ b/data/locale/deutsch.locale
- @@ -198,6 +198,8 @@ audioplayer.select_title_by_name Titelsuche nach Name (SMS)
- audioplayer.show_playlist Playlist anzeigen
- audioplayer.shuffle Zufällig
- audioplayer.spectrum LCD Skala
- +audioplayer.streamripper_start Streamripper starten
- +audioplayer.streamripper_stop Streamripper stoppen
- audioplayer.stop Stopp
- audioplayer.title_artist Titel, Interpret
- blank_screen Blanker Bildschirm
- diff --git a/data/locale/english.locale b/data/locale/english.locale
- index 4479fa8..7a0114c 100644
- --- a/data/locale/english.locale
- +++ b/data/locale/english.locale
- @@ -198,6 +198,8 @@ audioplayer.select_title_by_name Search title by name (SMS)
- audioplayer.show_playlist Show playlist
- audioplayer.shuffle Shuffle
- audioplayer.spectrum LCD spectrum
- +audioplayer.streamripper_start Start streamripper
- +audioplayer.streamripper_stop Stop streamripper
- audioplayer.stop Stop
- audioplayer.title_artist Title, artist
- blank_screen Blank screen
- diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp
- index a8e91e4..580f6ae 100644
- --- a/src/gui/audioplayer.cpp
- +++ b/src/gui/audioplayer.cpp
- @@ -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()
- diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h
- index 068a412..ff464b0 100644
- --- a/src/gui/audioplayer.h
- +++ b/src/gui/audioplayer.h
- @@ -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;
- diff --git a/src/system/locals.h b/src/system/locals.h
- index 83a40bd..491debd 100644
- --- a/src/system/locals.h
- +++ b/src/system/locals.h
- @@ -225,6 +225,8 @@ typedef enum
- LOCALE_AUDIOPLAYER_SHOW_PLAYLIST,
- LOCALE_AUDIOPLAYER_SHUFFLE,
- LOCALE_AUDIOPLAYER_SPECTRUM,
- + LOCALE_AUDIOPLAYER_STREAMRIPPER_START,
- + LOCALE_AUDIOPLAYER_STREAMRIPPER_STOP,
- LOCALE_AUDIOPLAYER_STOP,
- LOCALE_AUDIOPLAYER_TITLE_ARTIST,
- LOCALE_BLANK_SCREEN,
- diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h
- index ae019c6..105d8de 100644
- --- a/src/system/locals_intern.h
- +++ b/src/system/locals_intern.h
- @@ -225,6 +225,8 @@ const char * locale_real_names[] =
- "audioplayer.show_playlist",
- "audioplayer.shuffle",
- "audioplayer.spectrum",
- + "audioplayer.streamripper_start",
- + "audioplayer.streamripper_stop",
- "audioplayer.stop",
- "audioplayer.title_artist",
- "blank_screen",
- /bin/streamripper.sh:
- #!/bin/sh
- . /etc/init.d/globals
- usage() {
- echo "[${BASENAME}] Usage: $0 {start [url]|stop}"
- }
- case $1 in
- start)
- if [ $# -ne 2 ]; then
- usage
- exit 1
- fi
- streamripper "${2}" -a -s -d "$(get_setting network_nfs_recordingdir)/streamripper/" &
- ;;
- stop)
- killall streamripper
- ;;
- *)
- usage
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement