mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 17:01:08 +02:00
implement yt search history
Origin commit data
------------------
Commit: 4a0fdba710
Author: martii <m4rtii@gmx.de>
Date: 2013-08-15 (Thu, 15 Aug 2013)
This commit is contained in:
@@ -1417,7 +1417,9 @@ moviebrowser.update_if_dest_empty_only Übernehmen nur wenn Ziel leer
|
|||||||
moviebrowser.use_dir Verzeichnis verwenden
|
moviebrowser.use_dir Verzeichnis verwenden
|
||||||
moviebrowser.use_movie_dir Wiedergabeverzeichnis verwenden
|
moviebrowser.use_movie_dir Wiedergabeverzeichnis verwenden
|
||||||
moviebrowser.use_rec_dir Aufnahmeverzeichnis verwenden
|
moviebrowser.use_rec_dir Aufnahmeverzeichnis verwenden
|
||||||
moviebrowser.yt_concurrent_connections Gleichzeitige Verbindungen
|
moviebrowser.yt_concurrent_connections Gleichzeitige Verbindungen
|
||||||
|
moviebrowser.yt_history Frühere Suchen
|
||||||
|
moviebrowser.yt_max_history Max. Anzahl früherer Suchen
|
||||||
moviebrowser.yt_error Fehler beim laden des Youtube Feed
|
moviebrowser.yt_error Fehler beim laden des Youtube Feed
|
||||||
moviebrowser.yt_max_results Max. Anzahl der zu holenden Feeds
|
moviebrowser.yt_max_results Max. Anzahl der zu holenden Feeds
|
||||||
moviebrowser.yt_most_discussed Am meisten diskutiert
|
moviebrowser.yt_most_discussed Am meisten diskutiert
|
||||||
|
@@ -1419,6 +1419,8 @@ moviebrowser.use_movie_dir Use movie directory
|
|||||||
moviebrowser.use_rec_dir Use record directory
|
moviebrowser.use_rec_dir Use record directory
|
||||||
moviebrowser.yt_concurrent_connections Concurrent connections
|
moviebrowser.yt_concurrent_connections Concurrent connections
|
||||||
moviebrowser.yt_error Failed to load youtube feed
|
moviebrowser.yt_error Failed to load youtube feed
|
||||||
|
moviebrowser.yt_history Search history
|
||||||
|
moviebrowser.yt_max_history Max search history size
|
||||||
moviebrowser.yt_max_results Max results to fetch
|
moviebrowser.yt_max_results Max results to fetch
|
||||||
moviebrowser.yt_most_discussed Most discussed
|
moviebrowser.yt_most_discussed Most discussed
|
||||||
moviebrowser.yt_most_popular Most popular
|
moviebrowser.yt_most_popular Most popular
|
||||||
|
@@ -778,6 +778,17 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings)
|
|||||||
settings->ytregion = configfile.getString("mb_ytregion", "default");
|
settings->ytregion = configfile.getString("mb_ytregion", "default");
|
||||||
settings->ytsearch = configfile.getString("mb_ytsearch", "");
|
settings->ytsearch = configfile.getString("mb_ytsearch", "");
|
||||||
settings->ytvid = configfile.getString("mb_ytvid", "");
|
settings->ytvid = configfile.getString("mb_ytvid", "");
|
||||||
|
settings->ytsearch_history_max = configfile.getInt32("mb_ytsearch_history_max", 10);
|
||||||
|
settings->ytsearch_history_size = configfile.getInt32("mb_ytsearch_history_size", 0);
|
||||||
|
if (settings->ytsearch_history_size > settings->ytsearch_history_max)
|
||||||
|
settings->ytsearch_history_size = settings->ytsearch_history_max;
|
||||||
|
settings->ytsearch_history.clear();
|
||||||
|
for(int i = 0; i < settings->ytsearch_history_size; i++) {
|
||||||
|
std::string s = configfile.getString("mb_ytsearch_history_" + to_string(i));
|
||||||
|
if (s != "")
|
||||||
|
settings->ytsearch_history.push_back(configfile.getString("mb_ytsearch_history_" + to_string(i), ""));
|
||||||
|
}
|
||||||
|
settings->ytsearch_history_size = settings->ytsearch_history.size();
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,6 +846,15 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings)
|
|||||||
configfile.setString("mb_ytsearch", settings->ytsearch);
|
configfile.setString("mb_ytsearch", settings->ytsearch);
|
||||||
configfile.setString("mb_ytvid", settings->ytvid);
|
configfile.setString("mb_ytvid", settings->ytvid);
|
||||||
|
|
||||||
|
settings->ytsearch_history_size = settings->ytsearch_history.size();
|
||||||
|
if (settings->ytsearch_history_size > settings->ytsearch_history_max)
|
||||||
|
settings->ytsearch_history_size = settings->ytsearch_history_max;
|
||||||
|
configfile.setInt32("mb_ytsearch_history_max", settings->ytsearch_history_max);
|
||||||
|
configfile.setInt32("mb_ytsearch_history_size", settings->ytsearch_history_size);
|
||||||
|
std::list<std::string>:: iterator it = settings->ytsearch_history.begin();
|
||||||
|
for(int i = 0; i < settings->ytsearch_history_size; i++, ++it)
|
||||||
|
configfile.setString("mb_ytsearch_history_" + to_string(i), *it);
|
||||||
|
|
||||||
if (configfile.getModifiedFlag())
|
if (configfile.getModifiedFlag())
|
||||||
configfile.saveConfig(MOVIEBROWSER_SETTINGS_FILE);
|
configfile.saveConfig(MOVIEBROWSER_SETTINGS_FILE);
|
||||||
return (result);
|
return (result);
|
||||||
@@ -3639,6 +3659,55 @@ neutrino_locale_t CMovieBrowser::getFeedLocale(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CYTHistory : public CMenuTarget
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
int width;
|
||||||
|
int selected;
|
||||||
|
std::string *search;
|
||||||
|
MB_SETTINGS *settings;
|
||||||
|
public:
|
||||||
|
CYTHistory(MB_SETTINGS &_settings, std::string &_search);
|
||||||
|
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
CYTHistory::CYTHistory(MB_SETTINGS &_settings, std::string &_search)
|
||||||
|
{
|
||||||
|
width = w_max (40, 10);
|
||||||
|
selected = -1;
|
||||||
|
settings = &_settings;
|
||||||
|
search = &_search;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||||
|
{
|
||||||
|
if (actionKey == "") {
|
||||||
|
if (parent)
|
||||||
|
parent->hide();
|
||||||
|
CMenuWidget* m = new CMenuWidget(LOCALE_MOVIEBROWSER_YT_HISTORY, NEUTRINO_ICON_MOVIEPLAYER, width);
|
||||||
|
m->addKey(CRCInput::RC_spkr, this, "clear");
|
||||||
|
m->setSelected(selected);
|
||||||
|
m->addItem(GenericMenuSeparator);
|
||||||
|
m->addItem(GenericMenuBack);
|
||||||
|
m->addItem(GenericMenuSeparatorLine);
|
||||||
|
std::list<std::string>::iterator it = settings->ytsearch_history.begin();
|
||||||
|
for (int i = 0; i < settings->ytsearch_history_size; i++, ++it)
|
||||||
|
m->addItem(new CMenuForwarderNonLocalized((*it).c_str(), true, NULL, this, (*it).c_str(), CRCInput::convertDigitToKey(i + 1)));
|
||||||
|
m->exec(NULL, "");
|
||||||
|
m->hide();
|
||||||
|
delete m;
|
||||||
|
return menu_return::RETURN_REPAINT;
|
||||||
|
}
|
||||||
|
if (actionKey == "clear") {
|
||||||
|
settings->ytsearch_history.clear();
|
||||||
|
settings->ytsearch_history_size = 0;
|
||||||
|
return menu_return::RETURN_EXIT;
|
||||||
|
}
|
||||||
|
*search = actionKey;
|
||||||
|
g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_blue, 0);
|
||||||
|
return menu_return::RETURN_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
bool CMovieBrowser::showYTMenu()
|
bool CMovieBrowser::showYTMenu()
|
||||||
{
|
{
|
||||||
m_pcWindow->paintBackground();
|
m_pcWindow->paintBackground();
|
||||||
@@ -3663,18 +3732,23 @@ bool CMovieBrowser::showYTMenu()
|
|||||||
sprintf(cnt, "%d", cYTFeedParser::NEXT);
|
sprintf(cnt, "%d", cYTFeedParser::NEXT);
|
||||||
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_NEXT_RESULTS, ytparser.HaveNext(), NULL, selector, cnt, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
|
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_NEXT_RESULTS, ytparser.HaveNext(), NULL, selector, cnt, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
|
||||||
sprintf(cnt, "%d", cYTFeedParser::PREV);
|
sprintf(cnt, "%d", cYTFeedParser::PREV);
|
||||||
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_PREV_RESULTS, ytparser.HavePrev(), NULL, selector, cnt, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
|
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_PREV_RESULTS, ytparser.HavePrev(), NULL, selector, cnt, CRCInput::RC_nokey, ""));
|
||||||
|
|
||||||
mainMenu.addItem(GenericMenuSeparatorLine);
|
mainMenu.addItem(GenericMenuSeparatorLine);
|
||||||
|
|
||||||
std::string search = m_settings.ytsearch;
|
std::string search = m_settings.ytsearch;
|
||||||
CStringInputSMS stringInput(LOCALE_MOVIEBROWSER_YT_SEARCH, &search, 20, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789 -_/()<>=+.,:!?\\'");
|
CStringInputSMS stringInput(LOCALE_MOVIEBROWSER_YT_SEARCH, &search, 20, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789 -_/()<>=+.,:!?\\'");
|
||||||
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_SEARCH, true, search, &stringInput, NULL, CRCInput::RC_nokey, ""));
|
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_SEARCH, true, search, &stringInput, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
|
||||||
sprintf(cnt, "%d", cYTFeedParser::SEARCH);
|
sprintf(cnt, "%d", cYTFeedParser::SEARCH);
|
||||||
mainMenu.addItem(new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));
|
mainMenu.addItem(new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));
|
||||||
|
|
||||||
|
CYTHistory ytHistory(m_settings, search);
|
||||||
|
if (m_settings.ytsearch_history_size > 0)
|
||||||
|
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_HISTORY, true, NULL, &ytHistory, "", CRCInput::RC_0));
|
||||||
|
|
||||||
mainMenu.addItem(GenericMenuSeparatorLine);
|
mainMenu.addItem(GenericMenuSeparatorLine);
|
||||||
mainMenu.addItem(new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_YT_MAX_RESULTS, &m_settings.ytresults, true, 10, 50, NULL));
|
mainMenu.addItem(new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_YT_MAX_RESULTS, &m_settings.ytresults, true, 10, 50, NULL));
|
||||||
|
mainMenu.addItem(new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_YT_MAX_HISTORY, &m_settings.ytsearch_history_max, true, 10, 50, NULL));
|
||||||
|
|
||||||
char rstr[20];
|
char rstr[20];
|
||||||
sprintf(rstr, "%s", m_settings.ytregion.c_str());
|
sprintf(rstr, "%s", m_settings.ytregion.c_str());
|
||||||
@@ -3730,6 +3804,18 @@ bool CMovieBrowser::showYTMenu()
|
|||||||
reload = true;
|
reload = true;
|
||||||
m_settings.ytsearch = search;
|
m_settings.ytsearch = search;
|
||||||
m_settings.ytmode = newmode;
|
m_settings.ytmode = newmode;
|
||||||
|
m_settings.ytsearch_history.push_front(search);
|
||||||
|
std::list<std::string>::iterator it = m_settings.ytsearch_history.begin();
|
||||||
|
it++;
|
||||||
|
while (it != m_settings.ytsearch_history.end()) {
|
||||||
|
if (*it == search)
|
||||||
|
it = m_settings.ytsearch_history.erase(it);
|
||||||
|
else
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
m_settings.ytsearch_history_size = m_settings.ytsearch_history.size();
|
||||||
|
if (m_settings.ytsearch_history_size > m_settings.ytsearch_history_max)
|
||||||
|
m_settings.ytsearch_history_size = m_settings.ytsearch_history_max;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_settings.ytmode != newmode) {
|
else if (m_settings.ytmode != newmode) {
|
||||||
|
@@ -73,6 +73,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
#include <gui/widget/listframe.h>
|
#include <gui/widget/listframe.h>
|
||||||
#include <gui/widget/menue.h>
|
#include <gui/widget/menue.h>
|
||||||
#include <gui/widget/textbox.h>
|
#include <gui/widget/textbox.h>
|
||||||
@@ -231,9 +232,12 @@ typedef struct
|
|||||||
int ytresults;
|
int ytresults;
|
||||||
int ytquality;
|
int ytquality;
|
||||||
int ytconcconn;
|
int ytconcconn;
|
||||||
|
int ytsearch_history_size;
|
||||||
|
int ytsearch_history_max;
|
||||||
std::string ytregion;
|
std::string ytregion;
|
||||||
std::string ytvid;
|
std::string ytvid;
|
||||||
std::string ytsearch;
|
std::string ytsearch;
|
||||||
|
std::list<std::string> ytsearch_history;
|
||||||
} MB_SETTINGS;
|
} MB_SETTINGS;
|
||||||
|
|
||||||
// Priorities for Developmemt: P1: critical feature, P2: important feature, P3: for next release, P4: looks nice, lets see
|
// Priorities for Developmemt: P1: critical feature, P2: important feature, P3: for next release, P4: looks nice, lets see
|
||||||
|
@@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
int my_system(const char * cmd);
|
int my_system(const char * cmd);
|
||||||
int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */
|
int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */
|
||||||
|
|
||||||
@@ -64,4 +65,11 @@ class CFileHelpers
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class C> std::string to_string(C i)
|
||||||
|
{
|
||||||
|
std::stringstream s;
|
||||||
|
s << i;
|
||||||
|
return s.str();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1446,6 +1446,8 @@ typedef enum
|
|||||||
LOCALE_MOVIEBROWSER_USE_REC_DIR,
|
LOCALE_MOVIEBROWSER_USE_REC_DIR,
|
||||||
LOCALE_MOVIEBROWSER_YT_CONCURRENT_CONNECTIONS,
|
LOCALE_MOVIEBROWSER_YT_CONCURRENT_CONNECTIONS,
|
||||||
LOCALE_MOVIEBROWSER_YT_ERROR,
|
LOCALE_MOVIEBROWSER_YT_ERROR,
|
||||||
|
LOCALE_MOVIEBROWSER_YT_HISTORY,
|
||||||
|
LOCALE_MOVIEBROWSER_YT_MAX_HISTORY,
|
||||||
LOCALE_MOVIEBROWSER_YT_MAX_RESULTS,
|
LOCALE_MOVIEBROWSER_YT_MAX_RESULTS,
|
||||||
LOCALE_MOVIEBROWSER_YT_MOST_DISCUSSED,
|
LOCALE_MOVIEBROWSER_YT_MOST_DISCUSSED,
|
||||||
LOCALE_MOVIEBROWSER_YT_MOST_POPULAR,
|
LOCALE_MOVIEBROWSER_YT_MOST_POPULAR,
|
||||||
|
@@ -1446,6 +1446,8 @@ const char * locale_real_names[] =
|
|||||||
"moviebrowser.use_rec_dir",
|
"moviebrowser.use_rec_dir",
|
||||||
"moviebrowser.yt_concurrent_connections",
|
"moviebrowser.yt_concurrent_connections",
|
||||||
"moviebrowser.yt_error",
|
"moviebrowser.yt_error",
|
||||||
|
"moviebrowser.yt_history",
|
||||||
|
"moviebrowser.yt_max_history",
|
||||||
"moviebrowser.yt_max_results",
|
"moviebrowser.yt_max_results",
|
||||||
"moviebrowser.yt_most_discussed",
|
"moviebrowser.yt_most_discussed",
|
||||||
"moviebrowser.yt_most_popular",
|
"moviebrowser.yt_most_popular",
|
||||||
|
Reference in New Issue
Block a user