mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 09:21:09 +02:00
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:
@@ -1429,6 +1429,11 @@ moviebrowser.yt_most_responded Feeds mit den meisten Reaktionen
|
||||
moviebrowser.yt_most_shared Am häufigsten wiedergegebe Videos
|
||||
moviebrowser.yt_next_results Nächste Ergebnisse
|
||||
moviebrowser.yt_on_the_web Trendvideos
|
||||
moviebrowser.yt_orderby Sortierung nach
|
||||
moviebrowser.yt_orderby.published Veröffentlichungszeitpunkt
|
||||
moviebrowser.yt_orderby.rating Bewertung
|
||||
moviebrowser.yt_orderby.relevance Relevanz
|
||||
moviebrowser.yt_orderby.viewcount Zahl der Views
|
||||
moviebrowser.yt_pref_quality Bevorzugte Qualität
|
||||
moviebrowser.yt_prev_results Vorherige Ergebnisse
|
||||
moviebrowser.yt_recently_featured Vor kurzem empfohlen
|
||||
|
@@ -1429,6 +1429,11 @@ moviebrowser.yt_most_responded Most responded
|
||||
moviebrowser.yt_most_shared Most shared
|
||||
moviebrowser.yt_next_results Next results
|
||||
moviebrowser.yt_on_the_web Trending videos
|
||||
moviebrowser.yt_orderby Order by
|
||||
moviebrowser.yt_orderby.published publishing date
|
||||
moviebrowser.yt_orderby.rating rating
|
||||
moviebrowser.yt_orderby.relevance relevance
|
||||
moviebrowser.yt_orderby.viewcount view count
|
||||
moviebrowser.yt_pref_quality Prefered quality
|
||||
moviebrowser.yt_prev_results Previous results
|
||||
moviebrowser.yt_recently_featured Recently featured
|
||||
|
@@ -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));
|
||||
|
||||
|
@@ -229,6 +229,7 @@ typedef struct
|
||||
MB_INFO_ITEM lastRecordRow[MB_MAX_ROWS];
|
||||
int lastRecordRowWidth[MB_MAX_ROWS];
|
||||
int ytmode;
|
||||
int ytorderby;
|
||||
int ytresults;
|
||||
int ytquality;
|
||||
int ytconcconn;
|
||||
|
@@ -1456,6 +1456,11 @@ typedef enum
|
||||
LOCALE_MOVIEBROWSER_YT_MOST_SHARED,
|
||||
LOCALE_MOVIEBROWSER_YT_NEXT_RESULTS,
|
||||
LOCALE_MOVIEBROWSER_YT_ON_THE_WEB,
|
||||
LOCALE_MOVIEBROWSER_YT_ORDERBY,
|
||||
LOCALE_MOVIEBROWSER_YT_ORDERBY_PUBLISHED,
|
||||
LOCALE_MOVIEBROWSER_YT_ORDERBY_RATING,
|
||||
LOCALE_MOVIEBROWSER_YT_ORDERBY_RELEVANCE,
|
||||
LOCALE_MOVIEBROWSER_YT_ORDERBY_VIEWCOUNT,
|
||||
LOCALE_MOVIEBROWSER_YT_PREF_QUALITY,
|
||||
LOCALE_MOVIEBROWSER_YT_PREV_RESULTS,
|
||||
LOCALE_MOVIEBROWSER_YT_RECENTLY_FEATURED,
|
||||
|
@@ -1456,6 +1456,11 @@ const char * locale_real_names[] =
|
||||
"moviebrowser.yt_most_shared",
|
||||
"moviebrowser.yt_next_results",
|
||||
"moviebrowser.yt_on_the_web",
|
||||
"moviebrowser.yt_orderby",
|
||||
"moviebrowser.yt_orderby.published",
|
||||
"moviebrowser.yt_orderby.rating",
|
||||
"moviebrowser.yt_orderby.relevance",
|
||||
"moviebrowser.yt_orderby.viewcount",
|
||||
"moviebrowser.yt_pref_quality",
|
||||
"moviebrowser.yt_prev_results",
|
||||
"moviebrowser.yt_recently_featured",
|
||||
|
@@ -472,7 +472,7 @@ bool cYTFeedParser::ParseFeed(std::string &url)
|
||||
return parseFeedXml(answer);
|
||||
}
|
||||
|
||||
bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::string vid)
|
||||
bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::string vid, yt_feed_orderby_t orderby)
|
||||
{
|
||||
std::string url = "http://gdata.youtube.com/feeds/api/standardfeeds/";
|
||||
bool append_res = true;
|
||||
@@ -540,6 +540,8 @@ bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::stri
|
||||
url = "http://gdata.youtube.com/feeds/api/videos?q=";
|
||||
url += search;
|
||||
url += "&";
|
||||
const char *orderby_values[] = { "published", "relevance", "viewCount", "rating" };
|
||||
url += "orderby=" + std::string(orderby_values[orderby & 3]) + "&";
|
||||
}
|
||||
|
||||
feedmode = mode;
|
||||
|
@@ -129,10 +129,17 @@ class cYTFeedParser
|
||||
SEARCH,
|
||||
MODE_LAST
|
||||
};
|
||||
enum yt_feed_orderby_t
|
||||
{
|
||||
ORDERBY_PUBLISHED = 0,
|
||||
ORDERBY_RELEVANCE,
|
||||
ORDERBY_VIEWCOUNT,
|
||||
ORDERBY_RATING
|
||||
};
|
||||
cYTFeedParser();
|
||||
~cYTFeedParser();
|
||||
|
||||
bool ParseFeed(yt_feed_mode_t mode = MOST_POPULAR, std::string search = "", std::string vid = "");
|
||||
bool ParseFeed(yt_feed_mode_t mode = MOST_POPULAR, std::string search = "", std::string vid = "", yt_feed_orderby_t orderby = ORDERBY_PUBLISHED);
|
||||
bool ParseVideoInfo(cYTVideoInfo &vinfo, CURL *_curl_handle = NULL);
|
||||
bool DownloadThumbnail(cYTVideoInfo &vinfo, CURL *_curl_handle = NULL);
|
||||
bool GetVideoUrls();
|
||||
|
Reference in New Issue
Block a user