vector<string> StringUtils::Split(const std::string& input, const std::string& delimiter, unsigned int iMaxStrings /* = 0 */) { vector<string> strArray; if (input.empty()) return strArray; CStdStringArray result; SplitString(input, delimiter, result, iMaxStrings); for (unsigned int index = 0; index < result.size(); index++) strArray.push_back(result.at(index)); return strArray; }
CStdString CGUIIncludes::ResolveConstant(const CStdString &constant) const { CStdStringArray values; StringUtils::SplitString(constant, ",", values); for (unsigned int i = 0; i < values.size(); ++i) { map<CStdString, CStdString>::const_iterator it = m_constants.find(values[i]); if (it != m_constants.end()) values[i] = it->second; } CStdString value; StringUtils::JoinString(values, ",", value); return value; }
bool DvbChannel::FromConfRecord(const CStdString &record) { // parse a record from channels.conf and extract relevant info from it. // note that channels.conf is different between DVBT and ATSC but this should work on both Clear(); CStdStringArray params; StringUtils::SplitString(record, ":", params); if (params.size() < 5) return false; if (params[0].Find(';') == -1) { m_serviceName = params[0]; m_serviceProvider = ""; } else { CStdStringArray params2; StringUtils::SplitString(params[0], ";", params2); m_serviceName = params2[0]; m_serviceProvider = params2[1]; } m_serverChannelName = m_serviceName; m_serverChannelNameShort = m_serviceName; m_freq = params[1]; m_tuningParams = params[2]; m_videoPid = atoi(params[3]); ParseAudioPids(params[4], false); ParseAudioPids(params[5], true); m_serviceId = atoi(params[6]); m_originalNetworkId = atoi(params[7]); m_transportStreamId = atoi(params[8]); m_virtualChannel = params[9]; if (m_virtualChannel == "0.0") m_virtualChannel = ""; //optional, only for development without server if (params.size() > 10) m_serverId = params[10]; m_isEnabled = true; return true; }
CSkinInfo::CSkinInfo(const cp_extension_t *ext) : CAddon(ext) { ELEMENTS elements; if (CAddonMgr::Get().GetExtElements(ext->configuration, "res", elements)) { for (ELEMENTS::iterator i = elements.begin(); i != elements.end(); ++i) { int width = atoi(CAddonMgr::Get().GetExtValue(*i, "@width")); int height = atoi(CAddonMgr::Get().GetExtValue(*i, "@height")); bool defRes = CAddonMgr::Get().GetExtValue(*i, "@default").Equals("true"); CStdString folder = CAddonMgr::Get().GetExtValue(*i, "@folder"); float aspect = 0; CStdStringArray fracs; CStdString strAspect = CAddonMgr::Get().GetExtValue(*i, "@aspect"); StringUtils::SplitString(strAspect, ":", fracs); if (fracs.size() == 2) aspect = (float)(atof(fracs[0].c_str())/atof(fracs[1].c_str())); if (width > 0 && height > 0) { RESOLUTION_INFO res(width, height, aspect, folder); res.strId = strAspect; // for skin usage, store aspect string in strId if (defRes) m_defaultRes = res; m_resolutions.push_back(res); } } } else { // no resolutions specified -> backward compatibility CStdString defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultwideresolution"); if (defaultWide.IsEmpty()) defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultresolution"); TranslateResolution(defaultWide, m_defaultRes); } CStdString str = CAddonMgr::Get().GetExtValue(ext->configuration, "@effectslowdown"); if (!str.IsEmpty()) m_effectsSlowDown = (float)atof(str.c_str()); else m_effectsSlowDown = 1.f; str = CAddonMgr::Get().GetExtValue(ext->configuration, "@debugging"); m_debugging = !strcmp(str.c_str(), "true"); LoadStartupWindows(ext); m_Version = 2.11; }
uint32_t CButtonTranslator::TranslateKeyboardButton(TiXmlElement *pButton) { uint32_t button_id = 0; const char *szButton = pButton->Value(); if (!szButton) return 0; CStdString strKey = szButton; if (strKey.Equals("key")) { int id = 0; if (pButton->QueryIntAttribute("id", &id) == TIXML_SUCCESS) button_id = (uint32_t)id; else CLog::Log(LOGERROR, "Keyboard Translator: `key' button has no id"); } else { button_id = TranslateKeyboardString(szButton); } // Process the ctrl/shift/alt modifiers CStdString strMod; if (pButton->QueryValueAttribute("mod", &strMod) == TIXML_SUCCESS) { strMod.ToLower(); CStdStringArray modArray; StringUtils::SplitString(strMod, ",", modArray); for (unsigned int i = 0; i < modArray.size(); i++) { CStdString& substr = modArray[i]; substr.Trim(); if (substr == "ctrl" || substr == "control") button_id |= CKey::MODIFIER_CTRL; else if (substr == "shift") button_id |= CKey::MODIFIER_SHIFT; else if (substr == "alt") button_id |= CKey::MODIFIER_ALT; else if (substr == "super" || substr == "win") button_id |= CKey::MODIFIER_SUPER; else CLog::Log(LOGERROR, "Keyboard Translator: Unknown key modifier %s in %s", substr.c_str(), strMod.c_str()); } } return button_id; }
bool CGUIDialogFileBrowser::ShowAndGetFileList(const VECSOURCES &shares, const CStdString &mask, const CStdString &heading, CStdStringArray &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */) { CGUIDialogFileBrowser *browser = new CGUIDialogFileBrowser(); if (!browser) return false; g_windowManager.AddUniqueInstance(browser); browser->m_useFileDirectories = useFileDirectories; browser->m_multipleSelection = true; browser->m_browsingForImages = useThumbs; browser->SetHeading(heading); browser->SetSources(shares); browser->m_browsingForFolders = 0; browser->m_rootDir.SetMask(mask); browser->m_addNetworkShareEnabled = false; browser->DoModal(); bool confirmed(browser->IsConfirmed()); if (confirmed) { if (browser->m_markedPath.size()) path = browser->m_markedPath; else path.push_back(browser->m_selectedPath); } g_windowManager.Remove(browser->GetID()); delete browser; return confirmed; }
bool CStackDirectory::GetDirectory(const CStdString& strPath, CFileItemList& items) { items.Clear(); CStdStringArray files; if (!GetPaths(strPath, files)) return false; // error in path for (unsigned int i = 0; i < files.size(); i++) { CStdString file = files[i]; CFileItemPtr item(new CFileItem(file)); item->SetPath(file); item->m_bIsFolder = false; items.Add(item); } return true; }
TEST(TestStringUtils, FindBestMatch) { double refdouble, vardouble; int refint, varint; CStdStringArray strarray; refint = 3; refdouble = 0.5625f; strarray.push_back(""); strarray.push_back("a"); strarray.push_back("e"); strarray.push_back("es"); strarray.push_back("t"); varint = StringUtils::FindBestMatch("test", strarray, vardouble); EXPECT_EQ(refint, varint); EXPECT_EQ(refdouble, vardouble); }
bool CMetadataResolverMusic::FindLocalThumbnail(CResolvedAlbum& album, const CResolvingFolder& folder) { // Go over all files in the folder that could be an album thumb (basically, picture files) for (int i = 0; i < (int)folder.vecThumbs.size(); i++) { CStdString strThumbFileName = CUtil::GetFileName(folder.vecThumbs[i]); // Get all possible thumbnail file names from the settings CStdStringArray thumbs; StringUtils::SplitString(g_advancedSettings.m_musicThumbs, "|", thumbs); for (unsigned int j = 0; j < thumbs.size(); ++j) { if (strThumbFileName.CompareNoCase(thumbs[j]) == 0) { album.strCover = folder.vecThumbs[i]; return true; } } CUtil::RemoveExtension(strThumbFileName); // Handle the case that folder name is the same as the jpeg name if (strThumbFileName == folder.strEffectiveFolderName) { album.strCover = folder.vecThumbs[i]; return true; } if (strThumbFileName == album.strName) { album.strCover = folder.vecThumbs[i]; return true; } if (strThumbFileName.ToLower() == "folder") { album.strCover = folder.vecThumbs[i]; return true; } // TODO: Add more cases } return false; }
void CGUIRSSControl::Render() { // only render the control if they are enabled if (g_guiSettings.GetBool("lookandfeel.enablerssfeeds") && g_rssManager.IsActive()) { CSingleLock lock(m_criticalSection); // Create RSS background/worker thread if needed if (m_pReader == NULL) { if (g_rssManager.GetReader(GetID(), GetParentID(), this, m_pReader)) m_scrollInfo.characterPos = m_pReader->m_SavedScrollPos; else { if (m_strRSSTags != "") { CStdStringArray vecSplitTags; StringUtils::SplitString(m_strRSSTags, ",", vecSplitTags); for (unsigned int i = 0;i < vecSplitTags.size();i++) m_pReader->AddTag(vecSplitTags[i]); } // use half the width of the control as spacing between feeds, and double this between feed sets float spaceWidth = (m_label.font) ? m_label.font->GetCharWidth(L' ') : 15; m_pReader->Create(this, m_vecUrls, m_vecIntervals, (int)(0.5f*GetWidth() / spaceWidth) + 1, m_rtl); } } if (m_label.font) { vecColors colors; colors.push_back(m_label.textColor); colors.push_back(m_headlineColor); colors.push_back(m_channelColor); m_label.font->DrawScrollingText(m_posX, m_posY, colors, m_label.shadowColor, m_feed, 0, m_width, m_scrollInfo); } if (m_pReader) { m_pReader->CheckForUpdates(); m_pReader->m_SavedScrollPos = m_scrollInfo.characterPos; } } CGUIControl::Render(); }
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; }
void CWIN32Util::ExtendDllPath() { CStdString strEnv; CStdStringArray vecEnv; strEnv = CEnvironment::getenv("PATH"); if (strEnv.IsEmpty()) CLog::Log(LOGWARNING, "Can get system env PATH or PATH is empty"); StringUtils::SplitString(DLL_ENV_PATH, ";", vecEnv); for (int i=0; i<(int)vecEnv.size(); ++i) strEnv.append(";" + CSpecialProtocol::TranslatePath(vecEnv[i])); if (CEnvironment::setenv("PATH", strEnv) == 0) CLog::Log(LOGDEBUG,"Setting system env PATH to %S",strEnv.c_str()); else CLog::Log(LOGDEBUG,"Can't set system env PATH to %S",strEnv.c_str()); }
// Fills the array with the region names available for this language void CLangInfo::GetRegionNames(CStdStringArray& array) { for (ITMAPREGIONS it=m_regions.begin(); it!=m_regions.end(); ++it) { CStdString strName=it->first; if (strName=="N/A") strName=g_localizeStrings.Get(416); array.push_back(strName); } }
//------------------------------------------------------------------------------------------------------------------- void Xcddb::addTitle(const char *buffer) { char value[2048]; int trk_nr = 0; //TTITLEN if (buffer[7] == '=') { //Einstellig trk_nr = buffer[6] - 47; strcpy(value, buffer + 8); } else if (buffer[8] == '=') { //Zweistellig trk_nr = ((buffer[6] - 48) * 10) + buffer[7] - 47; strcpy(value, buffer + 9); } else if (buffer[9] == '=') { //Dreistellig trk_nr = ((buffer[6] - 48) * 100) + ((buffer[7] - 48) * 10) + buffer[8] - 47; strcpy(value, buffer + 10); } else { return ; } // track artist" / "track title CStdString strValue = value; CStdStringArray values; StringUtils::SplitString(value, " / ", values); if (values.size() > 1) { g_charsetConverter.unknownToUTF8(values[0]); m_mapArtists[trk_nr] += values[0]; g_charsetConverter.unknownToUTF8(values[1]); m_mapTitles[trk_nr] += values[1]; } else { g_charsetConverter.unknownToUTF8(values[0]); m_mapTitles[trk_nr] += values[0]; } }
CStdString CVideoDatabaseFile::TranslateUrl(const CURL& url) { CStdString strFileName=URIUtils::GetFileName(url.Get()); if (strFileName.empty()) return ""; CStdString strPath = URIUtils::GetDirectory(url.Get()); if (strPath.empty()) return ""; CStdString strExtension = URIUtils::GetExtension(strFileName); URIUtils::RemoveExtension(strFileName); if (!StringUtils::IsNaturalNumber(strFileName)) return ""; long idDb=atol(strFileName.c_str()); CStdStringArray pathElem; StringUtils::SplitString(strPath, "/", pathElem); if (pathElem.size() == 0) return ""; CStdString itemType = pathElem.at(2); VIDEODB_CONTENT_TYPE type; if (itemType.Equals("movies") || itemType.Equals("recentlyaddedmovies")) type = VIDEODB_CONTENT_MOVIES; else if (itemType.Equals("episodes") || itemType.Equals("recentlyaddedepisodes")) type = VIDEODB_CONTENT_EPISODES; else if (itemType.Equals("musicvideos") || itemType.Equals("recentlyaddedmusicvideos")) type = VIDEODB_CONTENT_MUSICVIDEOS; else return ""; CVideoDatabase videoDatabase; if (!videoDatabase.Open()) return ""; CStdString realFilename; videoDatabase.GetFilePathById(idDb, realFilename, type); return realFilename; }
void CGUIControlFactory::GetRectFromString(const CStdString &string, CRect &rect) { // format is rect="left[,top,right,bottom]" CStdStringArray strRect; StringUtils::SplitString(string, ",", strRect); if (strRect.size() == 1) { rect.x1 = (float)atof(strRect[0].c_str()); rect.y1 = rect.x1; rect.x2 = rect.x1; rect.y2 = rect.x1; } else if (strRect.size() == 4) { rect.x1 = (float)atof(strRect[0].c_str()); rect.y1 = (float)atof(strRect[1].c_str()); rect.x2 = (float)atof(strRect[2].c_str()); rect.y2 = (float)atof(strRect[3].c_str()); } }
void CAdvancedSettings::GetCustomExtensions(TiXmlElement *pRootElement, CStdString& extensions) { CStdString extraExtensions; CSettings::GetString(pRootElement,"add",extraExtensions,""); if (extraExtensions != "") extensions += "|" + extraExtensions; CSettings::GetString(pRootElement,"remove",extraExtensions,""); if (extraExtensions != "") { CStdStringArray exts; StringUtils::SplitString(extraExtensions,"|",exts); for (unsigned int i=0;i<exts.size();++i) { int iPos = extensions.Find(exts[i]); if (iPos == -1) continue; extensions.erase(iPos,exts[i].size()+1); } } }
long StringUtils::TimeStringToSeconds(const CStdString &timeString) { if(timeString.Right(4).Equals(" min")) { // this is imdb format of "XXX min" return 60 * atoi(timeString.c_str()); } else { CStdStringArray secs; StringUtils::SplitString(timeString, ":", secs); int timeInSecs = 0; for (unsigned int i = 0; i < secs.size(); i++) { timeInSecs *= 60; timeInSecs += atoi(secs[i]); } return timeInSecs; } }
void CDetectDVDMedia::SetNewDVDShareUrl( const CStdString& strNewUrl, bool bCDDA, const CStdString& strDiscLabel ) { CStdString strDescription = "DVD"; if (bCDDA) strDescription = "CD"; if (strDiscLabel != "") strDescription = strDiscLabel; // store it in case others want it m_diskLabel = strDescription; m_diskPath = strNewUrl; // delete any previously cached disc thumbnail CStdString strCache = _P("Z:\\dvdicon.tbn"); if (CFile::Exists(strCache)) CFile::Delete(strCache); // find and cache disc thumbnail, and update label to xbe label if applicable if ((g_advancedSettings.m_usePCDVDROM || IsDiscInDrive()) && !bCDDA) { // update disk label to xbe label if we have that info if (CFile::Exists("D:\\default.xbe")) CUtil::GetXBEDescription("D:\\default.xbe", m_diskLabel); // and get the thumb CStdString strThumb; CStdStringArray thumbs; StringUtils::SplitString(g_advancedSettings.m_dvdThumbs, "|", thumbs); for (unsigned int i = 0; i < thumbs.size(); ++i) { CUtil::AddFileToFolder(m_diskPath, thumbs[i], strThumb); CLog::Log(LOGDEBUG,"%s: looking for disc thumb:[%s]", __FUNCTION__, strThumb.c_str()); if (CFile::Exists(strThumb)) { CLog::Log(LOGDEBUG,"%s: found disc thumb:[%s], caching as:[%s]", __FUNCTION__, strThumb.c_str(), strCache.c_str()); CPicture pic; pic.DoCreateThumbnail(strThumb, strCache); break; } } } }
void CAdvancedSettings::GetCustomRegexps(TiXmlElement *pRootElement, CStdStringArray& settings) { TiXmlElement *pElement = pRootElement; while (pElement) { int iAction = 0; // overwrite // for backward compatibility const char* szAppend = pElement->Attribute("append"); if ((szAppend && stricmp(szAppend, "yes") == 0)) iAction = 1; // action takes precedence if both attributes exist const char* szAction = pElement->Attribute("action"); if (szAction) { iAction = 0; // overwrite if (stricmp(szAction, "append") == 0) iAction = 1; // append else if (stricmp(szAction, "prepend") == 0) iAction = 2; // prepend } if (iAction == 0) settings.clear(); TiXmlNode* pRegExp = pElement->FirstChild("regexp"); int i = 0; while (pRegExp) { if (pRegExp->FirstChild()) { CStdString regExp = pRegExp->FirstChild()->Value(); regExp.MakeLower(); if (iAction == 2) settings.insert(settings.begin() + i++, 1, regExp); else settings.push_back(regExp); } pRegExp = pRegExp->NextSibling("regexp"); } pElement = pElement->NextSiblingElement(pRootElement->Value()); } }
bool CDirectoryNodeTvShowsOverview::GetContent(CFileItemList& items) { CStdStringArray vecRoot; vecRoot.push_back(g_localizeStrings.Get(135)); // Genres vecRoot.push_back(g_localizeStrings.Get(369)); // Title vecRoot.push_back(g_localizeStrings.Get(562)); // Year vecRoot.push_back(g_localizeStrings.Get(344)); // Actors for (int i = 0; i < (int)vecRoot.size(); ++i) { CFileItemPtr pItem(new CFileItem(vecRoot[i])); CStdString strDir; strDir.Format("%i/", i+1); pItem->m_strPath = BuildPath() + strDir; pItem->m_bIsFolder = true; pItem->SetCanQueue(false); items.Add(pItem); } return true; }
void CGUITextLayout::utf8ToW(const CStdString &utf8, CStdStringW &utf16) { #ifdef WORK_AROUND_NEEDED_FOR_LINE_BREAKS // NOTE: This appears to strip \n characters from text. This may be a consequence of incorrect // expression of the \n in utf8 (we just use character code 10) or it might be something // more sinister. For now, we use the workaround below. CStdStringArray multiLines; StringUtils::SplitString(utf8, "\n", multiLines); for (unsigned int i = 0; i < multiLines.size(); i++) { CStdStringW line; g_charsetConverter.utf8ToW(multiLines[i], line); line.Replace(L"\r", L""); // filter out '\r' utf16 += line; if (i < multiLines.size() - 1) utf16.push_back(L'\n'); } #else g_charsetConverter.utf8ToW(utf8, utf16); #endif }
void CWIN32Util::ExtendDllPath() { CStdStringW strEnvW; CStdStringArray vecEnv; WCHAR wctemp[32768]; if(GetEnvironmentVariableW(L"PATH",wctemp,32767) != 0) strEnvW = wctemp; StringUtils::SplitString(DLL_ENV_PATH, ";", vecEnv); for (int i=0; i<(int)vecEnv.size(); ++i) { CStdStringW strFileW; g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(vecEnv[i]), strFileW, false); strEnvW.append(L";" + strFileW); } if(SetEnvironmentVariableW(L"PATH",strEnvW.c_str())!=0) CLog::Log(LOGDEBUG,"Setting system env PATH to %S",strEnvW.c_str()); else CLog::Log(LOGDEBUG,"Can't set system env PATH to %S",strEnvW.c_str()); }
// Creates a musicdb url CStdString CDirectoryNode::BuildPath() const { CStdStringArray array; if (!m_strName.empty()) array.insert(array.begin(), m_strName); CDirectoryNode* pParent=m_pParent; while (pParent!=NULL) { const CStdString& strNodeName=pParent->GetName(); if (!strNodeName.empty()) array.insert(array.begin(), strNodeName); pParent=pParent->GetParent(); } CStdString strPath="musicdb://"; for (int i=0; i<(int)array.size(); ++i) strPath+=array[i]+"/"; string options = m_options.GetOptionsString(); if (!options.empty()) strPath += "?" + options; return strPath; }
bool CRetroPlayerDialogs::GameLauchDialog(const CFileItem &file, GameClientPtr &result) { CFileItem fileCopy = file; // If an explicit game client was specified, try to download that if (fileCopy.HasProperty("gameclient")) { if (InstallGameClient(fileCopy.GetProperty("gameclient").asString(), fileCopy, result)) return true; fileCopy.ClearProperty("gameclient"); // don't want this to interfere later on } // First, ask the user if they would like to install a game client or go to // the add-on manager CContextButtons choices; choices.Add(0, 24026); // Install emulator choices.Add(1, 24058); // Add-on manager int btnid = CGUIDialogContextMenu::ShowAndGetChoice(choices); if (btnid == 0) // Install emulator { return InstallGameClientDialog(fileCopy, result); } else if (btnid == 1) // Add-on manager { // Queue the file so that if a compatible game client is installed, the // user will be asked to launch the file. CGameManager::Get().SetAutoLaunch(fileCopy); CLog::Log(LOGDEBUG, "RetroPlayer: User chose to go to the add-on manager"); CStdStringArray params; params.push_back("addons://all/xbmc.gameclient"); g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params); } else { CLog::Log(LOGDEBUG, "RetroPlayer: User canceled game client selection"); } return false; }
long StringUtils::TimeStringToSeconds(const CStdString &timeString) { CStdString strCopy(timeString); StringUtils::Trim(strCopy); if(StringUtils::EndsWithNoCase(strCopy, " min")) { // this is imdb format of "XXX min" return 60 * atoi(strCopy.c_str()); } else { CStdStringArray secs; StringUtils::SplitString(strCopy, ":", secs); int timeInSecs = 0; for (unsigned int i = 0; i < 3 && i < secs.size(); i++) { timeInSecs *= 60; timeInSecs += atoi(secs[i]); } return timeInSecs; } }
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]; }
bool CDirectoryNodeMusicVideosOverview::GetContent(CFileItemList& items) { CStdStringArray vecRoot; vecRoot.push_back(g_localizeStrings.Get(135)); // Genres vecRoot.push_back(g_localizeStrings.Get(369)); // Title vecRoot.push_back(g_localizeStrings.Get(345)); // Year vecRoot.push_back(g_localizeStrings.Get(133)); // Artists vecRoot.push_back(g_localizeStrings.Get(20348)); // Directors vecRoot.push_back(g_localizeStrings.Get(20388)); // Studios for (int i = 0; i < (int)vecRoot.size(); ++i) { CFileItem* pItem = new CFileItem(vecRoot[i]); CStdString strDir; strDir.Format("%i/", i+1); pItem->m_strPath = BuildPath() + strDir; pItem->m_bIsFolder = true; pItem->SetCanQueue(false); items.Add(pItem); } return true; }
long StringUtils::TimeStringToSeconds(const CStdString &timeString) { CStdString strCopy(timeString); strCopy.TrimLeft(" \n\r\t"); strCopy.TrimRight(" \n\r\t"); if(strCopy.Right(4).Equals(" min")) { // this is imdb format of "XXX min" return 60 * atoi(strCopy.c_str()); } else { CStdStringArray secs; StringUtils::SplitString(strCopy, ":", secs); int timeInSecs = 0; for (unsigned int i = 0; i < 3 && i < secs.size(); i++) { timeInSecs *= 60; timeInSecs += atoi(secs[i]); } return timeInSecs; } }
void DvbChannel::ParseAudioPids(const CStdString& confRecord, bool isAC3) { if (confRecord.size() == 0) return; CStdStringArray params; StringUtils::SplitString(confRecord, ",", params); for (size_t i = 0; i < params.size(); i++) { CStdStringArray p; StringUtils::SplitString(params[i], "=", p); DvbAudioInfo info; info.isAC3 = isAC3; info.pid = atoi(p[0]); if (p.size() > 1) { bool valid = true; for (size_t i = 0; i < p[1].length(); i++) { if (p[1][i] < 32) { valid = false; break; } } if (valid) info.lang = p[1]; } m_audioPids.push_back(info); } }