diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index c84be7554..f16dfeaea 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1368,6 +1368,7 @@ 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_pref_quality Bevorzugte Qualität moviebrowser.yt_prev_results Vorherige Ergebnisse moviebrowser.yt_recently_featured Vor kurzem empfohlen moviebrowser.yt_region Region diff --git a/data/locale/english.locale b/data/locale/english.locale index bf3dac459..495d8bea3 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1368,6 +1368,7 @@ 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_pref_quality Prefered quality moviebrowser.yt_prev_results Previous results moviebrowser.yt_recently_featured Recently featured moviebrowser.yt_region Region diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 507221213..d0bff4bcd 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -772,6 +772,7 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings) } settings->ytmode = configfile.getInt32("mb_ytmode", cYTFeedParser::MOST_POPULAR); settings->ytresults = configfile.getInt32("mb_ytresults", 10); + settings->ytquality = configfile.getInt32("mb_ytquality", 22); // itag value (MP4, 720p) settings->ytregion = configfile.getString("mb_ytregion", "default"); settings->ytsearch = configfile.getString("mb_ytsearch", ""); settings->ytvid = configfile.getString("mb_ytvid", ""); @@ -826,6 +827,7 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings) } configfile.setInt32("mb_ytmode", settings->ytmode); configfile.setInt32("mb_ytresults", settings->ytresults); + configfile.setInt32("mb_ytquality", settings->ytquality); configfile.setString("mb_ytregion", settings->ytregion); configfile.setString("mb_ytsearch", settings->ytsearch); configfile.setString("mb_ytvid", settings->ytvid); @@ -3587,7 +3589,7 @@ void CMovieBrowser::loadYTitles(int mode, std::string search, std::string id) movieInfo.ytid = ylist[i].id; movieInfo.file.Name = ylist[i].title; - movieInfo.file.Url = ylist[i].GetUrl(); + movieInfo.file.Url = ylist[i].GetUrl(m_settings.ytquality, false); m_vMovieInfo.push_back(movieInfo); } m_currentBrowserSelection = 0; @@ -3681,6 +3683,19 @@ bool CMovieBrowser::showYTMenu() region->addOption("US"); mainMenu.addItem(region); + #define YT_QUALITY_OPTION_COUNT 3 + CMenuOptionChooser::keyval_ext YT_QUALITY_OPTIONS[YT_QUALITY_OPTION_COUNT] = + { + { 18, NONEXISTANT_LOCALE, "MP4 270p/360p"}, + { 22, NONEXISTANT_LOCALE, "MP4 720p" }, +#if 0 + { 34, NONEXISTANT_LOCALE, "FLV 360p" }, + { 35, NONEXISTANT_LOCALE, "FLV 480p" }, +#endif + { 37, NONEXISTANT_LOCALE, "MP4 1080p" } + }; + mainMenu.addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_YT_PREF_QUALITY, &m_settings.ytquality, YT_QUALITY_OPTIONS, YT_QUALITY_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true)); + mainMenu.exec(NULL, ""); delete selector; diff --git a/src/gui/moviebrowser.h b/src/gui/moviebrowser.h index 1126404a8..015068236 100644 --- a/src/gui/moviebrowser.h +++ b/src/gui/moviebrowser.h @@ -229,6 +229,7 @@ typedef struct int lastRecordRowWidth[MB_MAX_ROWS]; int ytmode; int ytresults; + int ytquality; std::string ytregion; std::string ytvid; std::string ytsearch; diff --git a/src/system/locals.h b/src/system/locals.h index 2295e6655..36127b8f2 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1395,6 +1395,7 @@ typedef enum LOCALE_MOVIEBROWSER_YT_MOST_SHARED, LOCALE_MOVIEBROWSER_YT_NEXT_RESULTS, LOCALE_MOVIEBROWSER_YT_ON_THE_WEB, + LOCALE_MOVIEBROWSER_YT_PREF_QUALITY, LOCALE_MOVIEBROWSER_YT_PREV_RESULTS, LOCALE_MOVIEBROWSER_YT_RECENTLY_FEATURED, LOCALE_MOVIEBROWSER_YT_REGION, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 32c918e88..fc0323ae9 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1395,6 +1395,7 @@ const char * locale_real_names[] = "moviebrowser.yt_most_shared", "moviebrowser.yt_next_results", "moviebrowser.yt_on_the_web", + "moviebrowser.yt_pref_quality", "moviebrowser.yt_prev_results", "moviebrowser.yt_recently_featured", "moviebrowser.yt_region", diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index db7e17d42..4bd2b9322 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -59,19 +59,26 @@ void cYTVideoInfo::Dump() printf("===================================================================\n"); } -std::string cYTVideoInfo::GetUrl(int fmt) +std::string cYTVideoInfo::GetUrl(int fmt, bool mandatory) { yt_urlmap_iterator_t it; if (fmt) { if ((it = formats.find(fmt)) != formats.end()) return it->second.GetUrl(); - return ""; + if (mandatory) + return ""; } - if ((it = formats.find(22)) != formats.end()) // 720p + if ((it = formats.find(22)) != formats.end()) // 720p MP4 return it->second.GetUrl(); - if ((it = formats.find(37)) != formats.end()) // 1080p +#if 0 + if ((it = formats.find(35)) != formats.end()) // 480p FLV return it->second.GetUrl(); - if ((it = formats.find(18)) != formats.end()) // 270p/360p + if ((it = formats.find(34)) != formats.end()) // 360p FLV + return it->second.GetUrl(); +#endif + if ((it = formats.find(18)) != formats.end()) // 270p/360p MP4 + return it->second.GetUrl(); + if ((it = formats.find(37)) != formats.end()) // 1080p MP4 return it->second.GetUrl(); return ""; } diff --git a/src/system/ytparser.h b/src/system/ytparser.h index efb1fa491..2dfaf9980 100644 --- a/src/system/ytparser.h +++ b/src/system/ytparser.h @@ -58,7 +58,7 @@ class cYTVideoInfo yt_urlmap_t formats; void Dump(); - std::string GetUrl(int fmt = 0); + std::string GetUrl(int fmt = 0, bool mandatory = true); };