本文整理汇总了C++中CStdStringArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdStringArray::end方法的具体用法?C++ CStdStringArray::end怎么用?C++ CStdStringArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdStringArray
的用法示例。
在下文中一共展示了CStdStringArray::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dcguard
std::vector<String> Dialog::browseMultiple(int type, const String& heading, const String& s_shares,
const String& mask, bool useThumbs,
bool useFileDirectories, const String& defaultt ) throw (WindowException)
{
DelayedCallGuard dcguard(languageHook);
VECSOURCES *shares = CMediaSourceSettings::Get().GetSources(s_shares);
CStdStringArray tmpret;
String lmask = mask;
if (!shares)
throw WindowException("Error: GetSourcesFromType given %s is NULL.",s_shares.c_str());
if (useFileDirectories && (!lmask.empty() && !(lmask.size() == 0)))
lmask += "|.rar|.zip";
if (type == 1)
CGUIDialogFileBrowser::ShowAndGetFileList(*shares, lmask, heading, tmpret, useThumbs, useFileDirectories);
else if (type == 2)
CGUIDialogFileBrowser::ShowAndGetImageList(*shares, heading, tmpret);
else
throw WindowException("Error: Cannot retreive multuple directories using browse %s is NULL.",s_shares.c_str());
std::vector<String> valuelist;
int index = 0;
for (CStdStringArray::iterator iter = tmpret.begin(); iter != tmpret.end(); iter++)
valuelist[index++] = (*iter);
return valuelist;
}
示例2: FormatParameter
CStdString CDatabaseQueryRule::FormatParameter(const CStdString &operatorString, const CStdString ¶m, const CDatabase &db, const CStdString &strType) const
{
CStdString parameter;
if (GetFieldType(m_field) == TEXTIN_FIELD)
{
CStdStringArray split;
StringUtils::SplitString(param, ",", split);
for (CStdStringArray::iterator itIn = split.begin(); itIn != split.end(); ++itIn)
{
if (!parameter.empty())
parameter += ",";
parameter += db.PrepareSQL("'%s'", StringUtils::Trim(*itIn).c_str());
}
parameter = " IN (" + parameter + ")";
}
else
parameter = db.PrepareSQL(operatorString.c_str(), ValidateParameter(param).c_str());
if (GetFieldType(m_field) == DATE_FIELD)
{
if (m_operator == OPERATOR_IN_THE_LAST || m_operator == OPERATOR_NOT_IN_THE_LAST)
{ // translate time period
CDateTime date=CDateTime::GetCurrentDateTime();
CDateTimeSpan span;
span.SetFromPeriod(param);
date-=span;
parameter = db.PrepareSQL(operatorString.c_str(), date.GetAsDBDate().c_str());
}
}
return parameter;
}
示例3: ContainsKeyword
bool StringUtils::ContainsKeyword(const CStdString &str, const CStdStringArray &keywords)
{
for (CStdStringArray::const_iterator it = keywords.begin(); it != keywords.end(); it++)
{
if (str.find(*it) != str.npos)
return true;
}
return false;
}
示例4: JoinString
void StringUtils::JoinString(const CStdStringArray &strings, const CStdString& delimiter, CStdString& result)
{
result = "";
for(CStdStringArray::const_iterator it = strings.begin(); it != strings.end(); it++ )
result += (*it) + delimiter;
if(result != "")
result.Delete(result.size()-delimiter.size(), delimiter.size());
}
示例5: SettingOptionsRegionsFiller
void CLangInfo::SettingOptionsRegionsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
{
CStdStringArray regions;
g_langInfo.GetRegionNames(regions);
sort(regions.begin(), regions.end(), sortstringbyname());
for (unsigned int i = 0; i < regions.size(); ++i)
list.push_back(make_pair(regions[i], regions[i]));
}
示例6: FindBestMatch
int StringUtils::FindBestMatch(const CStdString &str, const CStdStringArray &strings, double &matchscore)
{
int best = -1;
matchscore = 0;
int i = 0;
for (CStdStringArray::const_iterator it = strings.begin(); it != strings.end(); it++, i++)
{
int maxlength = max(str.length(), it->length());
double score = StringUtils::CompareFuzzy(str, *it) / maxlength;
if (score > matchscore)
{
matchscore = score;
best = i;
}
}
return best;
}
示例7: SettingOptionsRegionsFiller
void CLangInfo::SettingOptionsRegionsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
{
CStdStringArray regions;
g_langInfo.GetRegionNames(regions);
sort(regions.begin(), regions.end(), sortstringbyname());
bool match = false;
for (unsigned int i = 0; i < regions.size(); ++i)
{
CStdString region = regions[i];
list.push_back(make_pair(region, region));
if (!match && region.Equals(((CSettingString*)setting)->GetValue().c_str()))
{
match = true;
current = region;
}
}
if (!match && regions.size() > 0)
current = regions[0];
}
示例8: SplitPath
CStdStringArray URIUtils::SplitPath(const CStdString& strPath)
{
CURL url(strPath);
// silly CStdString can't take a char in the constructor
CStdString sep(1, url.GetDirectorySeparator());
// split the filename portion of the URL up into separate dirs
CStdStringArray dirs;
StringUtils::SplitString(url.GetFileName(), sep, dirs);
// we start with the root path
CStdString dir = url.GetWithoutFilename();
if (!dir.IsEmpty())
dirs.insert(dirs.begin(), dir);
// we don't need empty token on the end
if (dirs.size() > 1 && dirs.back().IsEmpty())
dirs.erase(dirs.end() - 1);
return dirs;
}
示例9: SelectAddonID
int CGUIWindowAddonBrowser::SelectAddonID(const vector<ADDON::TYPE> &types, CStdStringArray &addonIDs, bool showNone /*= false*/, bool multipleSelection /*= true*/)
{
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (!dialog)
return 0;
CFileItemList items;
CStdString heading;
int iTypes = 0;
for (vector<ADDON::TYPE>::const_iterator it = types.begin(); it != types.end(); ++it)
{
if (*it == ADDON_UNKNOWN)
continue;
ADDON::VECADDONS addons;
iTypes++;
if (*it == ADDON_AUDIO)
CAddonsDirectory::GetScriptsAndPlugins("audio",addons);
else if (*it == ADDON_EXECUTABLE)
CAddonsDirectory::GetScriptsAndPlugins("executable",addons);
else if (*it == ADDON_IMAGE)
CAddonsDirectory::GetScriptsAndPlugins("image",addons);
else if (*it == ADDON_VIDEO)
CAddonsDirectory::GetScriptsAndPlugins("video",addons);
else
CAddonMgr::Get().GetAddons(*it, addons);
for (ADDON::IVECADDONS it2 = addons.begin() ; it2 != addons.end() ; ++it2)
{
CFileItemPtr item(CAddonsDirectory::FileItemFromAddon(*it2, ""));
if (!items.Contains(item->GetPath()))
items.Add(item);
}
if (!heading.IsEmpty())
heading += ", ";
heading += TranslateType(*it, true);
}
if (iTypes == 0)
return 0;
dialog->SetHeading(heading);
dialog->Reset();
dialog->SetUseDetails(true);
if (multipleSelection)
showNone = false;
if (multipleSelection || iTypes > 1)
dialog->EnableButton(true, 186);
else
dialog->EnableButton(true, 21452);
if (showNone)
{
CFileItemPtr item(new CFileItem("", false));
item->SetLabel(g_localizeStrings.Get(231));
item->SetLabel2(g_localizeStrings.Get(24040));
item->SetIconImage("DefaultAddonNone.png");
item->SetSpecialSort(SortSpecialOnTop);
items.Add(item);
}
items.Sort(SORT_METHOD_LABEL, SortOrderAscending);
if (addonIDs.size() > 0)
{
for (CStdStringArray::const_iterator it = addonIDs.begin(); it != addonIDs.end() ; it++)
{
CFileItemPtr item = items.Get(*it);
if (item)
item->Select(true);
}
}
dialog->SetItems(&items);
dialog->SetMultiSelection(multipleSelection);
dialog->DoModal();
if (!multipleSelection && iTypes == 1 && dialog->IsButtonPressed())
{ // switch to the addons browser.
vector<CStdString> params;
params.push_back("addons://all/"+TranslateType(types[0],false)+"/");
params.push_back("return");
g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params);
return 2;
}
if (!dialog->IsConfirmed())
return 0;
addonIDs.clear();
const CFileItemList& list = dialog->GetSelectedItems();
for (int i = 0 ; i < list.Size() ; i++)
addonIDs.push_back(list.Get(i)->GetPath());
return 1;
}
示例10: SelectAddonID
int CGUIWindowAddonBrowser::SelectAddonID(ADDON::TYPE type, CStdStringArray &addonIDs, bool showNone /*= false*/, bool multipleSelection /*= true*/)
{
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (type == ADDON_UNKNOWN || !dialog)
return 0;
ADDON::VECADDONS addons;
if (type == ADDON_AUDIO)
CAddonsDirectory::GetScriptsAndPlugins("audio",addons);
else if (type == ADDON_EXECUTABLE)
CAddonsDirectory::GetScriptsAndPlugins("executable",addons);
else if (type == ADDON_IMAGE)
CAddonsDirectory::GetScriptsAndPlugins("image",addons);
else if (type == ADDON_VIDEO)
CAddonsDirectory::GetScriptsAndPlugins("video",addons);
else
CAddonMgr::Get().GetAddons(type, addons);
CFileItemList items;
for (ADDON::IVECADDONS i = addons.begin(); i != addons.end(); ++i)
items.Add(CAddonsDirectory::FileItemFromAddon(*i, ""));
dialog->SetHeading(TranslateType(type, true));
dialog->Reset();
dialog->SetUseDetails(true);
if (multipleSelection)
{
showNone = false;
dialog->EnableButton(true, 186);
}
else
dialog->EnableButton(true, 21452);
if (showNone)
{
CFileItemPtr item(new CFileItem("", false));
item->SetLabel(g_localizeStrings.Get(231));
item->SetLabel2(g_localizeStrings.Get(24040));
item->SetIconImage("DefaultAddonNone.png");
item->SetSpecialSort(SORT_ON_TOP);
items.Add(item);
}
items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC);
if (addonIDs.size() > 0)
{
for (CStdStringArray::const_iterator it = addonIDs.begin(); it != addonIDs.end() ; it++)
{
CFileItemPtr item = items.Get(*it);
if (item)
item->Select(true);
}
}
dialog->SetItems(&items);
dialog->SetMultiSelection(multipleSelection);
dialog->DoModal();
if (!multipleSelection && dialog->IsButtonPressed())
{ // switch to the addons browser.
vector<CStdString> params;
params.push_back("addons://all/"+TranslateType(type,false)+"/");
params.push_back("return");
g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params);
return 2;
}
if (!multipleSelection && dialog->GetSelectedLabel() == -1)
return 0;
addonIDs.clear();
const CFileItemList& list = dialog->GetSelectedItems();
for (int i = 0 ; i < list.Size() ; i++)
addonIDs.push_back(list.Get(i)->GetPath());
return 1;
}
示例11: Update
void CGUIWindowVideoInfo::Update()
{
CStdString strTmp;
strTmp = m_movieItem->GetVideoInfoTag()->m_strTitle; strTmp.Trim();
SetLabel(CONTROL_TITLE, strTmp);
strTmp = m_movieItem->GetVideoInfoTag()->m_strDirector; strTmp.Trim();
SetLabel(CONTROL_DIRECTOR, strTmp);
strTmp = m_movieItem->GetVideoInfoTag()->m_strStudio; strTmp.Trim();
SetLabel(CONTROL_STUDIO, strTmp);
strTmp = m_movieItem->GetVideoInfoTag()->m_strWritingCredits; strTmp.Trim();
SetLabel(CONTROL_CREDITS, strTmp);
strTmp = m_movieItem->GetVideoInfoTag()->m_strGenre; strTmp.Trim();
SetLabel(CONTROL_GENRE, strTmp);
strTmp = m_movieItem->GetVideoInfoTag()->m_strTagLine; strTmp.Trim();
SetLabel(CONTROL_TAGLINE, strTmp);
strTmp = m_movieItem->GetVideoInfoTag()->m_strPlotOutline; strTmp.Trim();
SetLabel(CONTROL_PLOTOUTLINE, strTmp);
strTmp = m_movieItem->GetVideoInfoTag()->m_strTrailer; strTmp.Trim();
SetLabel(CONTROL_TRAILER, strTmp);
strTmp = m_movieItem->GetVideoInfoTag()->m_strMPAARating; strTmp.Trim();
SetLabel(CONTROL_MPAARATING, strTmp);
CStdString strTop250;
if (m_movieItem->GetVideoInfoTag()->m_iTop250)
strTop250.Format("%i", m_movieItem->GetVideoInfoTag()->m_iTop250);
SetLabel(CONTROL_TOP250, strTop250);
CStdString strYear;
if (m_movieItem->GetVideoInfoTag()->m_iYear)
strYear.Format("%i", m_movieItem->GetVideoInfoTag()->m_iYear);
else
strYear = g_infoManager.GetItemLabel(m_movieItem,LISTITEM_PREMIERED);
SetLabel(CONTROL_YEAR, strYear);
CStdString strRating_And_Votes;
if (m_movieItem->GetVideoInfoTag()->m_fRating != 0.0f) // only non-zero ratings are of interest
strRating_And_Votes.Format("%03.1f (%s %s)", m_movieItem->GetVideoInfoTag()->m_fRating, m_movieItem->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
SetLabel(CONTROL_RATING_AND_VOTES, strRating_And_Votes);
strTmp = m_movieItem->GetVideoInfoTag()->m_strRuntime; strTmp.Trim();
SetLabel(CONTROL_RUNTIME, strTmp);
// setup plot text area
strTmp = m_movieItem->GetVideoInfoTag()->m_strPlot;
if (!(!m_movieItem->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && m_movieItem->GetVideoInfoTag()->m_iSeason == 0)) // dont apply to tvshows
if (m_movieItem->GetVideoInfoTag()->m_playCount == 0 && g_guiSettings.GetBool("videolibrary.hideplots"))
strTmp = g_localizeStrings.Get(20370);
strTmp.Trim();
SetLabel(CONTROL_TEXTAREA, strTmp);
// setup cast list + determine type
ClearCastList();
if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty())
{ // music video
CStdStringArray artists;
StringUtils::SplitString(m_movieItem->GetVideoInfoTag()->m_strArtist, g_advancedSettings.m_videoItemSeparator, artists);
for (std::vector<CStdString>::const_iterator it = artists.begin(); it != artists.end(); ++it)
{
CFileItem *item = new CFileItem(*it);
if (CFile::Exists(item->GetCachedArtistThumb()))
item->SetThumbnailImage(item->GetCachedArtistThumb());
item->SetIconImage("DefaultArtist.png");
m_castList->Add(item);
}
m_castList->SetContent("musicvideos");
}
else
{ // movie/show/episode
for (CVideoInfoTag::iCast it = m_movieItem->GetVideoInfoTag()->m_cast.begin(); it != m_movieItem->GetVideoInfoTag()->m_cast.end(); ++it)
{
CStdString character;
if (it->strRole.IsEmpty())
character = it->strName;
else
character.Format("%s %s %s", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
CFileItem *item = new CFileItem(it->strName);
if (CFile::Exists(item->GetCachedActorThumb()))
item->SetThumbnailImage(item->GetCachedActorThumb());
item->SetIconImage("DefaultActor.png");
item->SetLabel(character);
m_castList->Add(item);
}
// determine type:
if (m_movieItem->m_bIsFolder)
m_castList->SetContent("tvshows");
else if (m_movieItem->GetVideoInfoTag()->m_iSeason > -1)
m_castList->SetContent("episodes");
else
m_castList->SetContent("movies");
}
CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_castList);
//.........这里部分代码省略.........
示例12: GetWhereClause
CStdString CSmartPlaylistRule::GetWhereClause(CDatabase &db, const CStdString& strType) const
{
SEARCH_OPERATOR op = m_operator;
if ((strType == "tvshows" || strType == "episodes") && m_field == FieldYear)
{ // special case for premiered which is a date rather than a year
// TODO: SMARTPLAYLISTS do we really need this, or should we just make this field the premiered date and request a date?
if (op == OPERATOR_EQUALS)
op = OPERATOR_CONTAINS;
else if (op == OPERATOR_DOES_NOT_EQUAL)
op = OPERATOR_DOES_NOT_CONTAIN;
}
CStdString operatorString, negate;
if (GetFieldType(m_field) == TEXTIN_FIELD)
{
if (op == OPERATOR_DOES_NOT_EQUAL)
negate = " NOT";
}
else
{
// the comparison piece
switch (op)
{
case OPERATOR_CONTAINS:
operatorString = " LIKE '%%%s%%'"; break;
case OPERATOR_DOES_NOT_CONTAIN:
negate = " NOT"; operatorString = " LIKE '%%%s%%'"; break;
case OPERATOR_EQUALS:
operatorString = " LIKE '%s'"; break;
case OPERATOR_DOES_NOT_EQUAL:
negate = " NOT"; operatorString = " LIKE '%s'"; break;
case OPERATOR_STARTS_WITH:
operatorString = " LIKE '%s%%'"; break;
case OPERATOR_ENDS_WITH:
operatorString = " LIKE '%%%s'"; break;
case OPERATOR_AFTER:
case OPERATOR_GREATER_THAN:
case OPERATOR_IN_THE_LAST:
operatorString = " > '%s'"; break;
case OPERATOR_BEFORE:
case OPERATOR_LESS_THAN:
case OPERATOR_NOT_IN_THE_LAST:
operatorString = " < '%s'"; break;
case OPERATOR_TRUE:
operatorString = " = 1"; break;
case OPERATOR_FALSE:
negate = " NOT "; operatorString = " = 0"; break;
default:
break;
}
}
// FieldInProgress does not have any values in m_parameter, it works on the operator
if (m_field == FieldInProgress && (strType == "movies" || strType == "episodes"))
return "idFile " + negate + " in (select idFile from bookmark where type = 1)";
// now the query parameter
CStdString wholeQuery;
for (vector<CStdString>::const_iterator it = m_parameter.begin(); it != m_parameter.end(); /* it++ is done further down */)
{
CStdString parameter;
if (GetFieldType(m_field) == TEXTIN_FIELD)
{
CStdStringArray split;
StringUtils::SplitString(*it, ",", split);
for (CStdStringArray::iterator itIn = split.begin(); itIn != split.end(); ++itIn)
{
if (!parameter.IsEmpty())
parameter += ",";
parameter += db.PrepareSQL("'%s'", (*itIn).Trim().c_str());
}
parameter = " IN (" + parameter + ")";
}
else
parameter = db.PrepareSQL(operatorString.c_str(), it->c_str());
if (GetFieldType(m_field) == DATE_FIELD)
{
if (m_operator == OPERATOR_IN_THE_LAST || m_operator == OPERATOR_NOT_IN_THE_LAST)
{ // translate time period
CDateTime date=CDateTime::GetCurrentDateTime();
CDateTimeSpan span;
span.SetFromPeriod(*it);
date-=span;
parameter = db.PrepareSQL(operatorString.c_str(), date.GetAsDBDate().c_str());
}
}
else if (m_field == FieldTime)
{ // translate time to seconds
CStdString seconds; seconds.Format("%i", StringUtils::TimeStringToSeconds(*it));
parameter = db.PrepareSQL(operatorString.c_str(), seconds.c_str());
}
CStdString query;
CStdString table;
if (strType == "songs")
{
table = "songview";
if (m_field == FieldGenre)
//.........这里部分代码省略.........
示例13: ParseAndCorrectUrl
void CCurlFile::ParseAndCorrectUrl(CURL &url2)
{
CStdString strProtocol = url2.GetTranslatedProtocol();
url2.SetProtocol(strProtocol);
if( strProtocol.Equals("ftp")
|| strProtocol.Equals("ftps") )
{
// we was using url optons for urls, keep the old code work and warning
if (!url2.GetOptions().IsEmpty())
{
CLog::Log(LOGWARNING, "%s: ftp url option is deprecated, please switch to use protocol option (change '?' to '|'), url: [%s]", __FUNCTION__, url2.Get().c_str());
url2.SetProtocolOptions(url2.GetOptions().Mid(1));
/* ftp has no options */
url2.SetOptions("");
}
/* this is uggly, depending on from where */
/* we get the link it may or may not be */
/* url encoded. if handed from ftpdirectory */
/* it won't be so let's handle that case */
CStdString partial, filename(url2.GetFileName());
CStdStringArray array;
// if server sent us the filename in non-utf8, we need send back with same encoding.
if (url2.GetProtocolOption("utf8") == "0")
g_charsetConverter.utf8ToStringCharset(filename);
/* TODO: create a tokenizer that doesn't skip empty's */
CUtil::Tokenize(filename, array, "/");
filename.Empty();
for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
{
if(it != array.begin())
filename += "/";
partial = *it;
CURL::Encode(partial);
filename += partial;
}
/* make sure we keep slashes */
if(url2.GetFileName().Right(1) == "/")
filename += "/";
url2.SetFileName(filename);
m_ftpauth = "";
if (url2.HasProtocolOption("auth"))
{
m_ftpauth = url2.GetProtocolOption("auth");
if(m_ftpauth.IsEmpty())
m_ftpauth = "any";
}
m_ftpport = "";
if (url2.HasProtocolOption("active"))
{
m_ftpport = url2.GetProtocolOption("active");
if(m_ftpport.IsEmpty())
m_ftpport = "-";
}
m_ftppasvip = url2.HasProtocolOption("pasvip") && url2.GetProtocolOption("pasvip") != "0";
}
else if( strProtocol.Equals("http")
|| strProtocol.Equals("https"))
{
if (CSettings::Get().GetBool("network.usehttpproxy")
&& !CSettings::Get().GetString("network.httpproxyserver").empty()
&& !CSettings::Get().GetString("network.httpproxyport").empty()
&& m_proxy.IsEmpty())
{
m_proxy = CSettings::Get().GetString("network.httpproxyserver");
m_proxy += ":" + CSettings::Get().GetString("network.httpproxyport");
if (CSettings::Get().GetString("network.httpproxyusername").length() > 0 && m_proxyuserpass.IsEmpty())
{
m_proxyuserpass = CSettings::Get().GetString("network.httpproxyusername");
m_proxyuserpass += ":" + CSettings::Get().GetString("network.httpproxypassword");
}
m_proxytype = (ProxyType)CSettings::Get().GetInt("network.httpproxytype");
CLog::Log(LOGDEBUG, "Using proxy %s, type %d", m_proxy.c_str(), proxyType2CUrlProxyType[m_proxytype]);
}
// get username and password
m_username = url2.GetUserName();
m_password = url2.GetPassWord();
// handle any protocol options
std::map<CStdString, CStdString> options;
url2.GetProtocolOptions(options);
if (options.size() > 0)
{
// clear protocol options
url2.SetProtocolOptions("");
// set xbmc headers
for(std::map<CStdString, CStdString>::const_iterator it = options.begin(); it != options.end(); ++it)
{
const CStdString &name = it->first;
CStdString value = it->second;
//.........这里部分代码省略.........
示例14: ParseAndCorrectUrl
void CCurlFile::ParseAndCorrectUrl(CURL &url2)
{
CStdString strProtocol = url2.GetTranslatedProtocol();
url2.SetProtocol(strProtocol);
if( strProtocol.Equals("ftp")
|| strProtocol.Equals("ftps") )
{
/* this is uggly, depending on from where */
/* we get the link it may or may not be */
/* url encoded. if handed from ftpdirectory */
/* it won't be so let's handle that case */
CStdString partial, filename(url2.GetFileName());
CStdStringArray array;
/* our current client doesn't support utf8 */
g_charsetConverter.utf8ToStringCharset(filename);
/* TODO: create a tokenizer that doesn't skip empty's */
CUtil::Tokenize(filename, array, "/");
filename.Empty();
for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
{
if(it != array.begin())
filename += "/";
partial = *it;
CURL::Encode(partial);
filename += partial;
}
/* make sure we keep slashes */
if(url2.GetFileName().Right(1) == "/")
filename += "/";
url2.SetFileName(filename);
CStdString options = url2.GetOptions().Mid(1);
options.TrimRight('/'); // hack for trailing slashes being added from source
m_ftpauth = "";
m_ftpport = "";
m_ftppasvip = false;
/* parse options given */
CUtil::Tokenize(options, array, "&");
for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++)
{
CStdString name, value;
int pos = it->Find('=');
if(pos >= 0)
{
name = it->Left(pos);
value = it->Mid(pos+1, it->size());
}
else
{
name = (*it);
value = "";
}
if(name.Equals("auth"))
{
m_ftpauth = value;
if(m_ftpauth.IsEmpty())
m_ftpauth = "any";
}
else if(name.Equals("active"))
{
m_ftpport = value;
if(value.IsEmpty())
m_ftpport = "-";
}
else if(name.Equals("pasvip"))
{
if(value == "0")
m_ftppasvip = false;
else
m_ftppasvip = true;
}
}
/* ftp has no options */
url2.SetOptions("");
}
else if( strProtocol.Equals("http")
|| strProtocol.Equals("https"))
{
if (g_guiSettings.GetBool("network.usehttpproxy")
&& !g_guiSettings.GetString("network.httpproxyserver").empty()
&& !g_guiSettings.GetString("network.httpproxyport").empty()
&& m_proxy.IsEmpty())
{
m_proxy = g_guiSettings.GetString("network.httpproxyserver");
m_proxy += ":" + g_guiSettings.GetString("network.httpproxyport");
if (g_guiSettings.GetString("network.httpproxyusername").length() > 0 && m_proxyuserpass.IsEmpty())
{
m_proxyuserpass = g_guiSettings.GetString("network.httpproxyusername");
m_proxyuserpass += ":" + g_guiSettings.GetString("network.httpproxypassword");
//.........这里部分代码省略.........
示例15: SetMovie
void CGUIDialogVideoInfo::SetMovie(const CFileItem *item)
{
*m_movieItem = *item;
// setup cast list + determine type. We need to do this here as it makes
// sure that content type (among other things) is set correctly for the
// old fixed id labels that we have floating around (they may be using
// content type to determine visibility, so we'll set the wrong label)
ClearCastList();
VIDEODB_CONTENT_TYPE type = (VIDEODB_CONTENT_TYPE)m_movieItem->GetVideoContentType();
if (type == VIDEODB_CONTENT_MUSICVIDEOS)
{ // music video
CStdStringArray artists;
StringUtils::SplitString(m_movieItem->GetVideoInfoTag()->m_strArtist, g_advancedSettings.m_videoItemSeparator, artists);
for (std::vector<CStdString>::const_iterator it = artists.begin(); it != artists.end(); ++it)
{
CFileItemPtr item(new CFileItem(*it));
if (CFile::Exists(item->GetCachedArtistThumb()))
item->SetThumbnailImage(item->GetCachedArtistThumb());
item->SetIconImage("DefaultArtist.png");
m_castList->Add(item);
}
m_castList->SetContent("musicvideos");
}
else
{ // movie/show/episode
for (CVideoInfoTag::iCast it = m_movieItem->GetVideoInfoTag()->m_cast.begin(); it != m_movieItem->GetVideoInfoTag()->m_cast.end(); ++it)
{
CStdString character;
if (it->strRole.IsEmpty())
character = it->strName;
else
character.Format("%s %s %s", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
CFileItemPtr item(new CFileItem(it->strName));
if (CFile::Exists(item->GetCachedActorThumb()))
item->SetThumbnailImage(item->GetCachedActorThumb());
item->SetIconImage("DefaultActor.png");
item->SetLabel(character);
m_castList->Add(item);
}
// set fanart property for tvshows and movies
if (type == VIDEODB_CONTENT_TVSHOWS || type == VIDEODB_CONTENT_MOVIES)
{
if (m_movieItem->CacheLocalFanart())
m_movieItem->SetProperty("fanart_image",m_movieItem->GetCachedFanart());
}
// determine type:
if (type == VIDEODB_CONTENT_TVSHOWS)
{
m_castList->SetContent("tvshows");
// special case stuff for shows (not currently retrieved from the library in filemode (ref: GetTvShowInfo vs GetTVShowsByWhere)
m_movieItem->m_dateTime = m_movieItem->GetVideoInfoTag()->m_premiered;
if(m_movieItem->GetVideoInfoTag()->m_iYear == 0 && m_movieItem->m_dateTime.IsValid())
m_movieItem->GetVideoInfoTag()->m_iYear = m_movieItem->m_dateTime.GetYear();
m_movieItem->SetProperty("totalepisodes", m_movieItem->GetVideoInfoTag()->m_iEpisode);
m_movieItem->SetProperty("numepisodes", m_movieItem->GetVideoInfoTag()->m_iEpisode); // info view has no concept of current watched/unwatched filter as we could come here from files view, but set for consistency
m_movieItem->SetProperty("watchedepisodes", m_movieItem->GetVideoInfoTag()->m_playCount);
m_movieItem->SetProperty("unwatchedepisodes", m_movieItem->GetVideoInfoTag()->m_iEpisode - m_movieItem->GetVideoInfoTag()->m_playCount);
m_movieItem->GetVideoInfoTag()->m_playCount = (m_movieItem->GetVideoInfoTag()->m_iEpisode == m_movieItem->GetVideoInfoTag()->m_playCount) ? 1 : 0;
}
else if (type == VIDEODB_CONTENT_EPISODES)
{
m_castList->SetContent("episodes");
// special case stuff for episodes (not currently retrieved from the library in filemode (ref: GetEpisodeInfo vs GetEpisodesByWhere)
m_movieItem->m_dateTime = m_movieItem->GetVideoInfoTag()->m_firstAired;
if(m_movieItem->GetVideoInfoTag()->m_iYear == 0 && m_movieItem->m_dateTime.IsValid())
m_movieItem->GetVideoInfoTag()->m_iYear = m_movieItem->m_dateTime.GetYear();
if (CFile::Exists(m_movieItem->GetCachedEpisodeThumb()))
m_movieItem->SetThumbnailImage(m_movieItem->GetCachedEpisodeThumb());
// retrieve the season thumb.
// NOTE: This is overly complicated. Perhaps we should cache season thumbs by showtitle and season number,
// rather than bothering with show path and the localized strings involved?
if (m_movieItem->GetVideoInfoTag()->m_iSeason > -1)
{
CStdString label;
if (m_movieItem->GetVideoInfoTag()->m_iSeason == 0)
label = g_localizeStrings.Get(20381);
else
label.Format(g_localizeStrings.Get(20358), m_movieItem->GetVideoInfoTag()->m_iSeason);
CFileItem season(label);
season.m_bIsFolder = true;
season.GetVideoInfoTag()->m_strPath = item->GetVideoInfoTag()->m_strShowPath;
if (CFile::Exists(season.GetCachedSeasonThumb()))
m_movieItem->SetProperty("seasonthumb", season.GetCachedSeasonThumb());
}
}
else if (type == VIDEODB_CONTENT_MOVIES)
{
m_castList->SetContent("movies");
// local trailers should always override non-local, so check
// for a local one if the registered trailer is online
if (m_movieItem->GetVideoInfoTag()->m_strTrailer.IsEmpty() ||
URIUtils::IsInternetStream(m_movieItem->GetVideoInfoTag()->m_strTrailer))
{
CStdString localTrailer = m_movieItem->FindTrailer();
if (!localTrailer.IsEmpty())
{
m_movieItem->GetVideoInfoTag()->m_strTrailer = localTrailer;
CVideoDatabase database;
if(database.Open())
//.........这里部分代码省略.........