yt: make search order selectable

Origin commit data
------------------
Branch: ni/coolstream
Commit: fd5f9f118d
Author: martii <m4rtii@gmx.de>
Date: 2013-10-06 (Sun, 06 Oct 2013)


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

------------------
This commit was generated by Migit
This commit is contained in:
martii
2013-10-06 12:11:20 +02:00
committed by Jacek Jendrzej
parent 2d01291316
commit 77e401b9e5
8 changed files with 47 additions and 3 deletions

View File

@@ -606,6 +606,7 @@ void CMovieBrowser::initGlobalSettings(void)
m_settings.browserRowWidth[5] = m_defaultRowWidth[m_settings.browserRowItem[5]]; //30;
m_settings.ytmode = cYTFeedParser::MOST_POPULAR;
m_settings.ytorderby = cYTFeedParser::ORDERBY_PUBLISHED;
m_settings.ytresults = 10;
m_settings.ytregion = "default";
m_settings.ytquality = 37;
@@ -772,6 +773,7 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings)
settings->browserRowWidth[i] = configfile.getInt32(cfg_key, 50);
}
settings->ytmode = configfile.getInt32("mb_ytmode", cYTFeedParser::MOST_POPULAR);
settings->ytorderby = configfile.getInt32("mb_ytorderby", cYTFeedParser::ORDERBY_PUBLISHED);
settings->ytresults = configfile.getInt32("mb_ytresults", 10);
settings->ytquality = configfile.getInt32("mb_ytquality", 37); // itag value (MP4, 1080p)
settings->ytconcconn = configfile.getInt32("mb_ytconcconn", 4); // concurrent connections
@@ -839,6 +841,7 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings)
configfile.setInt32(cfg_key, settings->browserRowWidth[i]);
}
configfile.setInt32("mb_ytmode", settings->ytmode);
configfile.setInt32("mb_ytorderby", settings->ytorderby);
configfile.setInt32("mb_ytresults", settings->ytresults);
configfile.setInt32("mb_ytquality", settings->ytquality);
configfile.setInt32("mb_ytconcconn", settings->ytconcconn);
@@ -3593,7 +3596,7 @@ void CMovieBrowser::loadYTitles(int mode, std::string search, std::string id)
ytparser.SetConcurrentDownloads(m_settings.ytconcconn);
if (!ytparser.Parsed() || (ytparser.GetFeedMode() != mode)) {
if (ytparser.ParseFeed((cYTFeedParser::yt_feed_mode_t)mode, search, id)) {
if (ytparser.ParseFeed((cYTFeedParser::yt_feed_mode_t)mode, search, id, (cYTFeedParser::yt_feed_orderby_t)m_settings.ytorderby)) {
ytparser.DownloadThumbnails();
} else {
//FIXME show error
@@ -3642,6 +3645,16 @@ const CMenuOptionChooser::keyval YT_FEED_OPTIONS[] =
#define YT_FEED_OPTION_COUNT (sizeof(YT_FEED_OPTIONS)/sizeof(CMenuOptionChooser::keyval))
const CMenuOptionChooser::keyval YT_ORDERBY_OPTIONS[] =
{
{ cYTFeedParser::ORDERBY_PUBLISHED, LOCALE_MOVIEBROWSER_YT_ORDERBY_PUBLISHED },
{ cYTFeedParser::ORDERBY_RELEVANCE, LOCALE_MOVIEBROWSER_YT_ORDERBY_RELEVANCE },
{ cYTFeedParser::ORDERBY_VIEWCOUNT, LOCALE_MOVIEBROWSER_YT_ORDERBY_VIEWCOUNT },
{ cYTFeedParser::ORDERBY_RATING, LOCALE_MOVIEBROWSER_YT_ORDERBY_RATING },
};
#define YT_ORDERBY_OPTION_COUNT (sizeof(YT_ORDERBY_OPTIONS)/sizeof(CMenuOptionChooser::keyval))
neutrino_locale_t CMovieBrowser::getFeedLocale(void)
{
neutrino_locale_t ret = LOCALE_MOVIEBROWSER_YT_MOST_POPULAR;
@@ -3739,6 +3752,7 @@ bool CMovieBrowser::showYTMenu()
std::string search = m_settings.ytsearch;
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_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
mainMenu.addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_YT_ORDERBY, &m_settings.ytorderby, YT_ORDERBY_OPTIONS, YT_ORDERBY_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true));
sprintf(cnt, "%d", cYTFeedParser::SEARCH);
mainMenu.addItem(new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));