mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
ytparser/moviebrowser: add option for selecting prefered quality
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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,
|
||||
|
@@ -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",
|
||||
|
@@ -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 "";
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user