コード例 #1
0
CStdString CSysInfo::GetUnameVersion()
{
  CStdString result = "";

  FILE* pipe = popen("uname -rm", "r");
  if (pipe)
  {
    char buffer[256] = {'\0'};
    if (fread(buffer, sizeof(char), sizeof(buffer), pipe) > 0 && !ferror(pipe))
    {
      result = buffer;
#if defined(TARGET_DARWIN)
      result.Trim();
      result += ", "; 
      result += GetDarwinVersionString();
#endif
    }
    else
      CLog::Log(LOGWARNING, "Unable to determine Uname version");
    pclose(pipe);
  }

  return result.Trim();
}
コード例 #2
0
ファイル: PPTUtil.cpp プロジェクト: killbug2004/WSProf
void CPPTUtil::CheckBuiltInProperties(IDispatch* pX) throw (Workshare::Exception)
{
   if (0 == pX) 
      throw Workshare::Exception(_T("Invalid dispatch pointer passed in"));

   PowerPoint::_PresentationPtr  pPresentation(pX);
   IDispatchPtr spBuiltInProps = pPresentation->BuiltInDocumentProperties;

   _bstr_t bstrName = _T("");
   _bstr_t bstrValue = _T("");
   CStdString sMsg;

   PowerPoint::PpBuiltInProperty ppPropertyIndex[] = {PowerPoint::ppPropertyTitle, 
      PowerPoint::ppPropertySubject, 
      PowerPoint::ppPropertyAuthor, 
      PowerPoint::ppPropertyKeywords, 
      PowerPoint::ppPropertyComments, 
      PowerPoint::ppPropertyCategory, 
      PowerPoint::ppPropertyManager, 
      PowerPoint::ppPropertyCompany, 
      PowerPoint::ppPropertyHyperlinkBase};

   long lCount = sizeof(ppPropertyIndex)/sizeof(PowerPoint::PpBuiltInProperty);
   CStdString sErr;

   for (long lIndex = 0; lIndex < lCount; lIndex++)
   {
      HRESULT hr = CCOMDispatchHelper::GetPropertyItemValues(spBuiltInProps, ppPropertyIndex[lIndex], 
         bstrName, bstrValue);

      if (FAILED(hr))
      {
         sErr.Format(_T("CCOMDispatchHelper::GetPropertyItemValues() failed for property index, %ld - Error Code, %ld"), 
            lIndex, hr);

         throw Workshare::Com::ComException(sErr.c_str(), hr);
      }

      CStdString sTmp = bstrValue;
      sTmp.Trim();

      if(0 != sTmp.length())
      {
         sErr.Format(_T("%s not properly reset: current value is %s"), (LPCTSTR)bstrName, sTmp.c_str());
         throw Workshare::Exception(sErr.c_str());
      }
   }
}
コード例 #3
0
ファイル: PathReadWriter.cpp プロジェクト: killbug2004/WSProf
bool PathReadWriter::AppendToPathInRegistry(const CStdString& sSubPath)
{
	CStdString sPath = sSubPath;
	::PathRemoveBackslash(sPath.GetBuffer(MAX_PATH));
	sPath.ReleaseBuffer();
	sPath.Trim();
	if (sPath.IsEmpty())
	{
		return true;
	}

	std::vector<CStdString> pathList;
	GetPathListFromRegistry(pathList);
	pathList.push_back(sPath);
	return SetPathListInRegistry(pathList);
}
コード例 #4
0
CStdString CSysInfo::GetUnameVersion()
{
  CStdString result = "";

  FILE* pipe = popen("uname -rm", "r");
  if (pipe)
  {
    char buffer[256] = {'\0'};
    if (fread(buffer, sizeof(char), sizeof(buffer), pipe) > 0 && !ferror(pipe))
      result = buffer;
    else
      CLog::Log(LOGWARNING, "Unable to determine Uname version");
    pclose(pipe);
  }

  return result.Trim();
}
コード例 #5
0
ファイル: MediaMonitor.cpp プロジェクト: Avoidnf8/xbmc-fork
void CMediaMonitor::parse_Clean(CStdString& strFilename)
{
  char* szBuffer = (char*) strFilename.c_str();
  int start = parse_GetStart ( szBuffer );
  int length = parse_GetLength( szBuffer, start);

  char szCopy[1024];

  if (length < 0)
  {
    length = strlen(&szBuffer[start]);
  }

  char lc = 0;
  for (int i = start, i2 = 0; ((i < start + length) && (szBuffer[i] != 0)); i++)
  {
    char c = szBuffer[i];

    switch (c)
    {
    case '\r':
    case '\n':
    case ',':
    case '.':
    case '_':
    case '-':
    case ' ':
      c = ' ';
      if (c == lc)
      {
        continue;
      }
      break;
    }

    szCopy[i2++] = c;
    lc = c;
  }

  szCopy[i2] = 0;
  CStdString name = szCopy;
  strFilename = name.Trim();
}
コード例 #6
0
ファイル: PathReadWriter.cpp プロジェクト: killbug2004/WSProf
bool PathReadWriter::RemovePathFromRegistry(const CStdString& sSubPath)
{
	CStdString sPath = sSubPath;
	::PathRemoveBackslash(sPath.GetBuffer(MAX_PATH));
	sPath.ReleaseBuffer();
	sPath.Trim();
	if (sPath.IsEmpty())
	{
		return true;
	}

	std::vector<CStdString> pathList;
	GetPathListFromRegistry(pathList);

	std::vector<CStdString>::iterator leftover;
	leftover = std::remove_if(pathList.begin(), pathList.end(), MatchesPath(sPath));
	pathList.erase(leftover, pathList.end());

	return SetPathListInRegistry(pathList);
}
コード例 #7
0
ファイル: TestXBMCTinyXML.cpp プロジェクト: Micromax-56/xbmc
TEST(TestXBMCTinyXML, ParseFromFileHandle)
{
  bool retval = false;
  // scraper results with unescaped &
  CXBMCTinyXML doc;
  FILE *f = fopen(XBMC_REF_FILE_PATH("/xbmc/utils/test/CXBMCTinyXML-test.xml"), "r");
  ASSERT_TRUE(f);
  doc.LoadFile(f);
  fclose(f);
  TiXmlNode *root = doc.RootElement();
  if (root && root->ValueStr() == "details")
  {
    TiXmlElement *url = root->FirstChildElement("url");
    if (url && url->FirstChild())
    {
      CStdString str = url->FirstChild()->ValueStr();
      retval = (str.Trim() == "http://api.themoviedb.org/3/movie/12244?api_key=57983e31fb435df4df77afb854740ea9&language=en???");
    }
  }
  EXPECT_TRUE(retval);
}
コード例 #8
0
ファイル: XLCDproc.cpp プロジェクト: RobertMe/xbmc
void XLCDproc::SetLine(int iLine, const CStdString& strLine)
{
  if (m_bStop || m_sockfd == -1)
    return;

  if (iLine < 0 || iLine >= (int)m_iRows)
    return;

  CStdString strLineLong = strLine;
  strLineLong.Trim();
  StringToLCDCharSet(strLineLong);

  //make string fit the display if it's smaller than the width
  if (strLineLong.size() < m_iColumns)
    strLineLong.append(m_iColumns - strLineLong.size(), ' ');
  //else if the string doesn't fit the display, lcdproc will scroll it, so we need a space
  else if (strLineLong.size() > m_iColumns)
    strLineLong += " ";

  if (strLineLong != m_strLine[iLine])
  {
    CStdString cmd;
    int ln = iLine + 1;

    if (g_advancedSettings.m_lcdScrolldelay != 0)
      cmd.Format("widget_set xbmc line%i 1 %i %i %i m %i \"%s\"\n", ln, ln, m_iColumns, ln, g_advancedSettings.m_lcdScrolldelay, strLineLong.c_str());
    else
      cmd.Format("widget_set xbmc line%i 1 %i \"%s\"\n", ln, ln, strLineLong.c_str());

    if (write(m_sockfd, cmd.c_str(), cmd.size()) == -1)
    {
      CLog::Log(LOGERROR, "XLCDproc::%s - Unable to write to socket", __FUNCTION__);
      CloseSocket();
      return;
    }
    m_bUpdate[iLine] = true;
    m_strLine[iLine] = strLineLong;
    m_event.Set();
  }
}
コード例 #9
0
void COptionsDlgSelector::OnOK() 
{
	DvLicenceHelper licHelper;
	if (!licHelper.IsComparisonAllowed())
	{
		licHelper.ShowNoLicenceMessage();
		CWSDialog::OnOK();
		return;
	}

	if ( Workshare::OptionApi::GetBool(L"ShowDocDesciptionWhenSelecting") )	
	{
		int nCurSel = m_cboDocumentOne.GetCurSel();
		CStdString sDocOne(L"");
		m_cboDocumentOne.GetLBText(nCurSel, sDocOne.GetBuffer(MAX_PATH*2));
		sDocOne.ReleaseBuffer();
		CStdString sDocOneId = m_documentIDLookup[ sDocOne ];
		sDocOneId = sDocOneId.Trim();
		if ( !sDocOneId.IsEmpty() )
		{
			m_cboDocumentOne.SetWindowText( sDocOneId );
		}		

		for( int nModifiedDocumentIndex = 0; nModifiedDocumentIndex < 5; nModifiedDocumentIndex++ )
		{				
			CStdString sDocTwo( m_multiModifiedDlg.GetModifiedText( nModifiedDocumentIndex ) );
			CStdString sDocTwoId = m_documentIDLookup[ sDocTwo ];
			sDocTwoId = sDocTwoId.Trim();
			if ( !sDocTwoId.IsEmpty() )
			{
				m_multiModifiedDlg.SetModifiedText( nModifiedDocumentIndex , sDocTwoId );
			}
		}
	}

	if( IsWindowVisible() )
		UpdateData();

	if( !ValidateFilesSelected() )
		return;

	ValidateRenderingSetOptions();

	// Remove these buttons.
	m_btnOk.EnableWindow(false);
	m_StaticHyperLinkHelp.EnableWindow(false);
	m_btnCancel.EnableWindow(false);

	// Hide this window offscreen - do not actually hide it with SW_HIDE as that throws the main window into the background
	WINDOWPLACEMENT placement;
	RECT rect;
	GetWindowPlacement(&placement);
	GetWindowRect(&rect);
	SetWindowPos(NULL, -20000,-20000,1,1,SWP_NOACTIVATE|SWP_NOZORDER);

	// Clear the failure list of all message resource IDs.
	GetApp()->ClearFailMessageList();

	if( StartComparisons() )
	{
		// Success so kill this dialog.
		EndDialog(IDOK);
	}
	else
	{
		// Comparison was unsuccessful.
		CStdString sHeaderLine = CStdString::LoadResource(IDS_TXTEX_failedToCompareDocuments5033, L"Failed to compare documents");
		CStdString sDescription = GetApp()->GetFailMessage();
		if (sDescription.GetLength() != 0)
		{
			// Display the failure messages.
			GetApp()->ShowMessageEx(AfxGetMainWnd()->m_hWnd,
				sDescription, WsOK, WsCompare, WsInfoIcon,
				sHeaderLine, -1, LOG_LOCATION);
		}

		// Bring this window back to normal position.
		SetWindowPos(NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom - rect.top, SWP_NOZORDER);
		SetWindowPlacement(&placement);
	}

	// Put the buttons back.
	m_btnOk.EnableWindow(true);
	m_StaticHyperLinkHelp.EnableWindow(true);
	m_btnCancel.EnableWindow(true);

	SetModified(FALSE);
}
コード例 #10
0
// Determine whether or not Fast (Binary) comparison can be used.
// NB Both original and modified docs must be in DOC format to enable binary compare.
// (See CDVCompareController::SetBinaryComparisonOptionForCurrentComparison)
bool COptionsDlgSelector::DocFormatSupportsFastComparison(bool bListItemSelected)
{		
	CStdString sOriginalFilename = GetOriginalFilename(bListItemSelected);

	if( sOriginalFilename.IsEmpty() )
	{
		return false;
	}

	if ( Workshare::OptionApi::GetBool(L"ShowDocDesciptionWhenSelecting") )	
	{
		CStdString sOriginalId = m_documentIDLookup[ sOriginalFilename ];
		sOriginalId = sOriginalId.Trim();
		if ( !sOriginalId.IsEmpty() )
		{
			sOriginalFilename = sOriginalId;
		}
	}

	HRESULT hr = FileTypeHelper::IsDOC(sOriginalFilename);
	if (FAILED(hr))	// checks connection to DMS is ok first
		return false;

	bool bOriginalIsDOC = hr == S_OK;
	bool bModifiedIsDOC = false;
	bool bOriginalIsDOCX = S_OK == FileTypeHelper::IsDOCX(sOriginalFilename);
	bool bModifiedIsDOCX = false;
	bool bOriginalIsRTF = S_OK == FileTypeHelper::IsRTF(sOriginalFilename);
	bool bModifiedIsRTF = false;

	for( int nModifiedDocumentIndex = 0; nModifiedDocumentIndex < 5; nModifiedDocumentIndex++ )
	{				
		CStdString sDocTwo( m_multiModifiedDlg.GetModifiedText( nModifiedDocumentIndex ) );

		if ( Workshare::OptionApi::GetBool(L"ShowDocDesciptionWhenSelecting") )	
		{
			CStdString sDocTwoId = m_documentIDLookup[ sDocTwo ];
			sDocTwoId = sDocTwoId.Trim();
			if ( !sDocTwoId.IsEmpty() )
			{
				sDocTwo = sDocTwoId;
			}
		}

		if( !sDocTwo.IsEmpty() )
		{
			if (S_OK == FileTypeHelper::IsDOC(sDocTwo) )
			{
				bModifiedIsDOC = true;
				break;
			}
			else if (S_OK == FileTypeHelper::IsDOCX(sDocTwo) )
			{
				bModifiedIsDOCX = true;
				break;
			}
			else if (S_OK == FileTypeHelper::IsRTF(sDocTwo) )
			{
				bModifiedIsRTF = true;
				break;
			}
		}
	}

	m_bFilesAreFastFiles = (bOriginalIsDOC || bOriginalIsDOCX || bOriginalIsRTF) || (bModifiedIsDOC || bModifiedIsDOCX || bModifiedIsRTF);

	return m_bFilesAreFastFiles;
}
コード例 #11
0
ファイル: epgstore.cpp プロジェクト: Kr0nZ/boxee
CStdString EpgStore::CleanDescription(const CStdString& strDescription)
{
  CStdString description = strDescription;

  description.Replace("&nbsp;", " ");

  while (description.Find("<") != -1)
  {
    int start = description.Find("<");
    int end = description.Find(">");
    if (end > start)
      description.Delete(start, end-start+1);
    else
      description.Delete(start, description.GetLength() - start);
  }
  description.Trim();

  description.Replace("\\&", "&");
  description.Replace("&quot;", "\"");
  description.Replace("&amp;", "&");
  description.Replace("&nbsp;", " ");
  description.Replace("&gt;", ">");
  description.Replace("&lt;", "<");

  int i;
  while ((i = description.Find("&#")) >= 0)
  {
    CStdString src = "&#";
    int radix = 10;

    i += 2;
    if (description[i] == 'x' || description[i] == 'X')
    {
      src += description[i];
      i++;
      radix = 16;
    }

    CStdString numStr;
    unsigned long num;
    while (description[i] != ';' && numStr.length() <= 6)
    {
      numStr += description[i];
      src += description[i];
      i++;
    }

    // doesn't make sense....abort
    if (numStr.length() > 6)
    {
      break;
    }

    src += ';';
    char* end;

    if (numStr.IsEmpty())
      break;

    num = strtoul(numStr.c_str(), &end, radix);

    // doesn't make sense....abort
    if (num == 0)
    {
      break;
    }

    CStdStringW utf16;
    utf16 += (wchar_t) num;
    CStdStringA utf8;
    g_charsetConverter.wToUTF8(utf16, utf8);
    description.Replace(src, utf8);
  }

  return description;
}
コード例 #12
0
ファイル: UrlSerializer.cpp プロジェクト: HiPiH/Oreka
void UrlSerializer::DeSerialize(CStdString& input)
{
	// read string and extract values into map
	UrlState state = UrlStartState;
	CStdString key;
	CStdString value;
	CStdString errorDescription;

	input.Trim();

	for(unsigned int i=0; i<input.length() && state!= UrlErrorState; i++)
	{
		TCHAR character = input[i];

		switch(state)
		{
		case UrlStartState:
			if(character == '&')
			{
				;	// ignore ampersands
			}
			else if ( ACE_OS::ace_isalnum(character) )
			{
				state = UrlKeyState;
				key = character;
			}
			else
			{
				state = UrlErrorState;
				errorDescription = "Cannot find key start, keys must be alphanum";
			}
			break;
		case UrlKeyState:
			if( ACE_OS::ace_isalnum(character) )
			{
				key += character;
			}
			else if (character == '=')
			{
				state = UrlValueState;
				value.Empty();
			}
			else
			{
				state = UrlErrorState;
				errorDescription = "Invalid key character, keys must be alphanum";
			}
			break;
		case UrlValueState:
			if( character == '=')
			{
				state = UrlErrorState;
				errorDescription = "Value followed by = sign, value should always be followed by space sign";				
			}
			else if (character == '&')
			{
				state = UrlStartState;
			}
			else
			{
				value += character;
			}
			break;
		default:
			state = UrlErrorState;
			errorDescription = "Non-existing state";
		}	// switch(state)

		if ( (state == UrlStartState) || (i == (input.length()-1)) )
		{
			if (!key.IsEmpty())
			{
				// Url unescape
				CStdString unescapedValue;
				UnEscapeUrl(value, unescapedValue);

				// Add pair to key-value map
				m_map.insert(std::make_pair(key, unescapedValue));
				key.Empty();
				value.Empty();
			}
		}
	}	// for(int i=0; i<input.length() && state!= UrlErrorState; i++)

	Serializer::DeSerialize();
}
コード例 #13
0
ファイル: WIN32Util.cpp プロジェクト: Saddamisalami/xbmc
bool CWIN32Util::XBMCShellExecute(const CStdString &strPath, bool bWaitForScriptExit)
{
  CStdString strCommand = strPath;
  CStdString strExe = strPath;
  CStdString strParams;
  CStdString strWorkingDir;

  strCommand.Trim();
  if (strCommand.IsEmpty())
  {
    return false;
  }
  int iIndex = -1;
  char split = ' ';
  if (strCommand[0] == '\"')
  {
    split = '\"';
  }
  iIndex = strCommand.Find(split, 1);
  if (iIndex != -1)
  {
    strExe = strCommand.substr(0, iIndex + 1);
    strParams = strCommand.substr(iIndex + 1);
  }

  strExe.Replace("\"","");

  strWorkingDir = strExe; 
  iIndex = strWorkingDir.ReverseFind('\\'); 
  if(iIndex != -1) 
  { 
    strWorkingDir[iIndex+1] = '\0'; 
  } 

  CStdStringW WstrExe, WstrParams, WstrWorkingDir;
  g_charsetConverter.utf8ToW(strExe, WstrExe);
  g_charsetConverter.utf8ToW(strParams, WstrParams);
  g_charsetConverter.utf8ToW(strWorkingDir, WstrWorkingDir);

  bool ret;
  SHELLEXECUTEINFOW ShExecInfo = {0};
  ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
  ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
  ShExecInfo.hwnd = NULL;
  ShExecInfo.lpVerb = NULL;
  ShExecInfo.lpFile = WstrExe.c_str();
  ShExecInfo.lpParameters = WstrParams.c_str();
  ShExecInfo.lpDirectory = WstrWorkingDir.c_str();
  ShExecInfo.nShow = SW_SHOW;
  ShExecInfo.hInstApp = NULL;

  g_windowHelper.StopThread();

  LockSetForegroundWindow(LSFW_UNLOCK);
  ShowWindow(g_hWnd,SW_MINIMIZE);
  ret = ShellExecuteExW(&ShExecInfo) == TRUE;
  g_windowHelper.SetHANDLE(ShExecInfo.hProcess);

  // ShellExecute doesn't return the window of the started process
  // we need to gather it from somewhere to allow switch back to XBMC
  // when a program is minimized instead of stopped.
  //g_windowHelper.SetHWND(ShExecInfo.hwnd);
  g_windowHelper.Create();

  if(bWaitForScriptExit)
  {
    // Todo: Pause music and video playback
    WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
  }

  return ret;
}
コード例 #14
0
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.get(),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);

  CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_castList);
  OnMessage(msg);

  if (m_bViewReview)
  {
    if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty())
    {
      SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 133);
    }
    else
    {
      SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 206);
    }

    SET_CONTROL_HIDDEN(CONTROL_LIST);
    SET_CONTROL_VISIBLE(CONTROL_TEXTAREA);
  }
  else
  {
    SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 207);

    SET_CONTROL_HIDDEN(CONTROL_TEXTAREA);
    SET_CONTROL_VISIBLE(CONTROL_LIST);
  }

  // Check for resumability
  CGUIWindowVideoFiles *window = (CGUIWindowVideoFiles *)m_gWindowManager.GetWindow(WINDOW_VIDEO_FILES);
  if (window && window->GetResumeItemOffset(m_movieItem.get()) > 0)
    CONTROL_ENABLE(CONTROL_BTN_RESUME);
  else
    CONTROL_DISABLE(CONTROL_BTN_RESUME);

  CONTROL_ENABLE(CONTROL_BTN_PLAY);

  // update the thumbnail
  const CGUIControl* pControl = GetControl(CONTROL_IMAGE);
  if (pControl)
  {
    CGUIImage* pImageControl = (CGUIImage*)pControl;
    pImageControl->FreeResources();
    pImageControl->SetFileName(m_movieItem->GetThumbnailImage());
  }
  // tell our GUI to completely reload all controls (as some of them
  // are likely to have had this image in use so will need refreshing)
  if (m_hasUpdatedThumb)
  {
    CGUIMessage reload(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_REFRESH_THUMBS);
    g_graphicsContext.SendMessage(reload);
  }
}
コード例 #15
0
CStdString IntelligentDocInfo::PrepareDocId(CStdString sDocId)
{
	sDocId.Trim();
	sDocId.MakeLower();
	return sDocId;
}
コード例 #16
0
ファイル: GUIDialogVideoInfo.cpp プロジェクト: Ayu222/android
void CGUIDialogVideoInfo::Update()
{
  // setup plot text area
  CStdString 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.showunwatchedplots"))
      strTmp = g_localizeStrings.Get(20370);

  strTmp.Trim();
  SetLabel(CONTROL_TEXTAREA, strTmp);

  CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_castList);
  OnMessage(msg);

  if (GetControl(CONTROL_BTN_TRACKS)) // if no CONTROL_BTN_TRACKS found - allow skinner full visibility control over CONTROL_TEXTAREA and CONTROL_LIST
  {
    if (m_bViewReview)
    {
      if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty())
      {
        SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 133);
      }
      else
      {
        SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 206);
      }

      SET_CONTROL_HIDDEN(CONTROL_LIST);
      SET_CONTROL_VISIBLE(CONTROL_TEXTAREA);
    }
    else
    {
      SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 207);

      SET_CONTROL_HIDDEN(CONTROL_TEXTAREA);
      SET_CONTROL_VISIBLE(CONTROL_LIST);
    }
  }

  // Check for resumability
  if (CGUIWindowVideoBase::GetResumeItemOffset(m_movieItem.get()) > 0)
    CONTROL_ENABLE(CONTROL_BTN_RESUME);
  else
    CONTROL_DISABLE(CONTROL_BTN_RESUME);

  CONTROL_ENABLE(CONTROL_BTN_PLAY);

  // update the thumbnail
  const CGUIControl* pControl = GetControl(CONTROL_IMAGE);
  if (pControl)
  {
    CGUIImage* pImageControl = (CGUIImage*)pControl;
    pImageControl->FreeResources();
    pImageControl->SetFileName(m_movieItem->GetThumbnailImage());
  }
  // tell our GUI to completely reload all controls (as some of them
  // are likely to have had this image in use so will need refreshing)
  if (m_hasUpdatedThumb)
  {
    CGUIMessage reload(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_REFRESH_THUMBS);
    g_windowManager.SendMessage(reload);
  }
}
コード例 #17
0
void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configuration &config)
{
    // set the primary device type
    m_configuration.deviceTypes.Clear();
    m_configuration.deviceTypes.Add(config.deviceTypes[0]);
    SetSetting("device_type", (int)config.deviceTypes[0]);

    // set the connected device
    m_configuration.baseDevice = config.baseDevice;
    SetSetting("connected_device", (int)config.baseDevice);

    // set the HDMI port number
    m_configuration.iHDMIPort = config.iHDMIPort;
    SetSetting("cec_hdmi_port", config.iHDMIPort);

    // set the physical address, when baseDevice or iHDMIPort are not set
    if (m_configuration.baseDevice == CECDEVICE_UNKNOWN ||
            m_configuration.iHDMIPort == 0 || m_configuration.iHDMIPort > 4)
    {
        m_configuration.iPhysicalAddress = config.iPhysicalAddress;
        CStdString strPhysicalAddress;
        strPhysicalAddress.Format("%x", config.iPhysicalAddress);
        SetSetting("physical_address", strPhysicalAddress);
    }

    // set the tv vendor override
    m_configuration.tvVendor = config.tvVendor;
    SetSetting("tv_vendor", (int)config.tvVendor);

    // set the devices to wake when starting
    m_configuration.wakeDevices = config.wakeDevices;
    CStdString strWakeDevices;
    for (unsigned int iPtr = 0; iPtr <= 16; iPtr++)
        if (config.wakeDevices[iPtr])
            strWakeDevices.AppendFormat(" %X", iPtr);
    SetSetting("wake_devices", strWakeDevices.Trim());

    // set the devices to power off when stopping
    m_configuration.powerOffDevices = config.powerOffDevices;
    CStdString strPowerOffDevices;
    for (unsigned int iPtr = 0; iPtr <= 16; iPtr++)
        if (config.powerOffDevices[iPtr])
            strPowerOffDevices.AppendFormat(" %X", iPtr);
    SetSetting("wake_devices", strPowerOffDevices.Trim());

    // set the boolean settings
    m_configuration.bUseTVMenuLanguage = config.bUseTVMenuLanguage;
    SetSetting("use_tv_menu_language", m_configuration.bUseTVMenuLanguage == 1);

    m_configuration.bActivateSource = config.bActivateSource;
    SetSetting("activate_source", m_configuration.bActivateSource == 1);

    m_configuration.bPowerOffScreensaver = config.bPowerOffScreensaver;
    SetSetting("cec_standby_screensaver", m_configuration.bPowerOffScreensaver == 1);

    m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby;
    SetSetting("standby_pc_on_tv_standby", m_configuration.bPowerOffOnStandby == 1);

    if (config.serverVersion >= CEC_SERVER_VERSION_1_5_1)
        m_configuration.bSendInactiveSource = config.bSendInactiveSource;
    SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1);
}
コード例 #18
0
void CGUIWindowFullScreen::MuteProfanity()
{
	if ((g_application.GetCurrentPlayer() == EPC_MPLAYER || g_application.GetCurrentPlayer() == EPC_DVDPLAYER) &&
		g_application.m_pPlayer->GetMuteProfanity())
    {
	  bool isMuted = g_application.IsMuted();
	  if (isMuted && !m_bPMute) return;
	  
	  CStdString subtitleText = "How now brown cow";
	  double duration;
	  double current;
	  if (g_application.m_pPlayer->GetCurrentSubtitleInfo(subtitleText, duration, current))
      {

		if ((duration <= 0 || current <= 0 || subtitleText.IsEmpty()) && m_bPMute)
		{
			CLog::Log(LOGWARNING,"UnMuting because there was an error getting subtitles");
			g_application.getApplicationMessenger().SendAction(CAction(ACTION_MUTE));
			m_bPMute = false;
			return;
		}
		/* Ignored characters for timing */
		subtitleText.Replace("\\r", "");
        subtitleText.Replace("\r", "");
        subtitleText.Replace("\\n", "");
        subtitleText.Replace("\n", "");
        subtitleText.Replace("<br>", "");
        subtitleText.Replace("\\N", "");
        subtitleText.Replace("<i>", "");
        subtitleText.Replace("</i>", "");
        subtitleText.Replace("<b>", "");
        subtitleText.Replace("</b>", "");
        subtitleText.Replace("<u>", "");
        subtitleText.Replace("&nbsp;", "");
        subtitleText.Replace("</u>", "");
        subtitleText.Replace("</i", "");
        subtitleText.Replace("</b", "");
        subtitleText.Replace("</u", "");

		/* Add extra timing for certain characters */
		subtitleText.Replace(" ", "  ");
		subtitleText.Replace(".", ". ");
		subtitleText.Replace(",", ", ");
		subtitleText.Replace(";", "; ");
		subtitleText.Replace(":", ": ");
		subtitleText.Replace("<p>", "  ");
        subtitleText.Replace("<P>", "  ");
		subtitleText.Trim();

		double durationPerChar = duration / subtitleText.length();
		double muteStart = -1;
		double muteEnd = -1;

		multimap<CStdString, int> m;

		int indexOfSware = subtitleText.ToLower().Find("skeeter");
		if (indexOfSware == -1)
		{
			if (m_bPMute) 
			{
				CLog::Log(LOGWARNING,"UnMuting because no curse words found");
				g_application.getApplicationMessenger().SendAction(CAction(ACTION_MUTE));
				m_bPMute = false;
			}
			return;
		}

	    double muteDuration = 8 * durationPerChar;
	    muteStart = (indexOfSware -1) * durationPerChar;
		double muteEnd = muteStart + muteDuration;

		if (current >= muteStart && current <= muteEnd)
		{
			if (!g_application.IsMuted())
			{
				CLog::Log(LOGWARNING, "Muting. Line: %s", subtitleText.c_str());
				CLog::Log(LOGWARNING, "current: %d, subtitle duration: %d, muteDuration: %d, muteStart: %d, muteEnd: %d", 
					current, duration, muteDuration, muteStart, muteEnd);
				g_application.getApplicationMessenger().SendAction(CAction(ACTION_MUTE));
				m_bPMute = true;
			}
		}
		else if (g_application.IsMuted())
		{
			CLog::Log(LOGWARNING, "UnMuting. Line: '%s'\n - current: %d, subtitle duration: %d, muteDuration: %d, muteStart: %d, muteEnd: %d", 
			subtitleText.c_str(), current, duration, muteDuration, muteStart, muteEnd);
			g_application.getApplicationMessenger().SendAction(CAction(ACTION_MUTE));
			m_bPMute = false;
		}
	  }
	}
}
コード例 #19
0
bool CEGLNativeTypeAmlogic::ModeToResolution(const char *mode, RESOLUTION_INFO *res) const
{
  if (!res)
    return false;

  res->iWidth = 0;
  res->iHeight= 0;

  if(!mode)
    return false;

  CStdString fromMode = mode;
  fromMode.Trim();
  // strips, for example, 720p* to 720p
  if (fromMode.Right(1) == "*")
    fromMode = fromMode.Left(std::max(0, (int)fromMode.size() - 1));

  if (fromMode.Equals("720p"))
  {
    res->iWidth = 1280;
    res->iHeight= 720;
    res->iScreenWidth  = res->iWidth;
    res->iScreenHeight = res->iHeight;
    res->fRefreshRate = 60;
    res->dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
  }
  else if (fromMode.Equals("720p50hz"))
  {
    res->iWidth = 1280;
    res->iHeight= 720;
    res->iScreenWidth  = res->iWidth;
    res->iScreenHeight = res->iHeight;
    res->fRefreshRate = 50;
    res->dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
  }
  else if (fromMode.Equals("1080p"))
  {
    res->iWidth = 1280;
    res->iHeight= 720;
    res->iScreenWidth  = 1920;
    res->iScreenHeight = 1080;
    res->fRefreshRate = 60;
    res->dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
  }
  else if (fromMode.Equals("1080p50hz"))
  {
    res->iScreenWidth = 1920;
    res->iScreenHeight= 1080;
    res->iWidth = 1280;
    res->iHeight= 720;
    res->fRefreshRate = 50;
    res->dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
  }
  else if (fromMode.Equals("1080i"))
  {
    res->iScreenWidth = 1920;
    res->iScreenHeight= 1080;
    res->iWidth = 1280;
    res->iHeight= 720;
    res->fRefreshRate = 60;
    res->dwFlags= D3DPRESENTFLAG_INTERLACED;
  }
  else if (fromMode.Equals("1080i50hz"))
  {
    res->iWidth = 1920;
    res->iHeight= 1080;
    res->iScreenWidth = 1280;
    res->iScreenHeight= 720;
    res->fRefreshRate = 50;
    res->dwFlags= D3DPRESENTFLAG_INTERLACED;
  }

  res->iScreen       = 0;
  res->bFullScreen   = true;
  res->iSubtitles    = (int)(0.965 * res->iHeight);
  res->fPixelRatio   = 1.0f;
  res->strMode.Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
    res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");

  return res->iWidth > 0 && res->iHeight> 0;
}
コード例 #20
0
ファイル: Id3Tag.cpp プロジェクト: JohnsonAugustine/xbmc-rbp
CStdString CID3Tag::ParseMP3Genre(const CStdString& str) const
{
  m_dll.Load();

  CStdString strTemp = str;
  set<CStdString> setGenres;

  while (!strTemp.IsEmpty())
  {
    // remove any leading spaces
    strTemp.TrimLeft();

    if (strTemp.IsEmpty())
      break;

    // start off looking for (something)
    if (strTemp[0] == '(')
    {
      strTemp.erase(0, 1);
      if (strTemp.empty())
        break;

      // now look for ((something))
      if (strTemp[0] == '(')
      {
        // remove ((something))
        int i = strTemp.find_first_of(')');
        strTemp.erase(0, i + 2);
      }
    }

    // no parens, so we have a start of a string
    // push chars into temp string until valid terminator found
    // valid terminators are ) or , or ;
    else
    {
      CStdString t;
      size_t i = strTemp.find_first_of("),;");
      if (i != std::string::npos)
      {
        t = strTemp.Left(i);
        strTemp.erase(0, i + 1);
      } else {
        t = strTemp;
        strTemp.clear();
      }
      
      // remove any leading or trailing white space
      // from temp string
      t.Trim();
      if (!t.length()) continue;

      // if the temp string is natural number try to convert it to a genre string
      if (StringUtils::IsNaturalNumber(t))
      {
        id3_ucs4_t* ucs4=m_dll.id3_latin1_ucs4duplicate((id3_latin1_t*)t.c_str());
        const id3_ucs4_t* genre=m_dll.id3_genre_name(ucs4);
        m_dll.id3_ucs4_free(ucs4);
        t=ToStringCharset(genre, ID3_FIELD_TEXTENCODING_ISO_8859_1);
      }

      // convert RX to Remix as per ID3 V2.3 spec
      else if ((t == "RX") || (t == "Rx") || (t == "rX") || (t == "rx"))
      {
        t = "Remix";
      }

      // convert CR to Cover as per ID3 V2.3 spec
      else if ((t == "CR") || (t == "Cr") || (t == "cR") || (t == "cr"))
      {
        t = "Cover";
      }

      // insert genre name in set
      setGenres.insert(t);
    }

  }

  // return a " / " seperated string
  CStdString strGenre;
  set<CStdString>::iterator it;
  for (it = setGenres.begin(); it != setGenres.end(); it++)
  {
    CStdString strTemp = *it;
    if (!strGenre.IsEmpty())
      strGenre += g_advancedSettings.m_musicItemSeparator;
    strGenre += strTemp;
  }
  return strGenre;
}
コード例 #21
0
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);
  OnMessage(msg);

  if (m_bViewReview)
  {
    if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty())
    {
      SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 133);
    }
    else
    {
      SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 206);
    }

    SET_CONTROL_HIDDEN(CONTROL_LIST);
    SET_CONTROL_VISIBLE(CONTROL_TEXTAREA);
  }
  else
  {
    SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 207);

    SET_CONTROL_HIDDEN(CONTROL_TEXTAREA);
    SET_CONTROL_VISIBLE(CONTROL_LIST);
  }

  // Check for resumability
  CGUIWindowVideoFiles *window = (CGUIWindowVideoFiles *)m_gWindowManager.GetWindow(WINDOW_VIDEO_FILES);
  if (window && window->GetResumeItemOffset(m_movieItem) > 0)
  {
    CONTROL_ENABLE(CONTROL_BTN_RESUME);
  }
  else
  {
    CONTROL_DISABLE(CONTROL_BTN_RESUME);
  }

  if (m_movieItem->GetVideoInfoTag()->m_strEpisodeGuide.IsEmpty()) // disable the play button for tv show info
  {
    CONTROL_ENABLE(CONTROL_BTN_PLAY)
  }
  else
  {
    CONTROL_DISABLE(CONTROL_BTN_PLAY)
  }

  // update the thumbnail
  const CGUIControl* pControl = GetControl(CONTROL_IMAGE);
  if (pControl)
  {
    CGUIImage* pImageControl = (CGUIImage*)pControl;
    pImageControl->FreeResources();
    pImageControl->SetFileName(m_movieItem->GetThumbnailImage());
  }
}
コード例 #22
0
ファイル: Id3Tag.cpp プロジェクト: Avoidnf8/xbmc-fork
CStdString CID3Tag::ParseMP3Genre(const CStdString& str) const
{
  if (!m_dll.IsLoaded())
    m_dll.Load();

  CStdString strTemp = str;
  set<CStdString> setGenres;

  while (!strTemp.IsEmpty())
  {
    // remove any leading spaces
    int i = strTemp.find_first_not_of(" ");
    if (i > 0) strTemp.erase(0, i);

    // pull off the first character
    char p = strTemp[0];

    // start off looking for (something)
    if (p == '(')
    {
      strTemp.erase(0, 1);

      // now look for ((something))
      p = strTemp[0];
      if (p == '(')
      {
        // remove ((something))
        i = strTemp.find_first_of("))");
        strTemp.erase(0, i + 2);
      }
    }

    // no parens, so we have a start of a string
    // push chars into temp string until valid terminator found
    // valid terminators are ) or , or ;
    else
    {
      CStdString t;
      while ((!strTemp.IsEmpty()) && (p != ')') && (p != ',') && (p != ';'))
      {
        strTemp.erase(0, 1);
        t.push_back(p);
        p = strTemp[0];
      }
      // loop exits when terminator is found
      // be sure to remove the terminator
      strTemp.erase(0, 1);

      // remove any leading or trailing white space
      // from temp string
      t.Trim();
      if (!t.size()) continue;

      // if the temp string is natural number try to convert it to a genre string
      if (StringUtils::IsNaturalNumber(t))
      {
        id3_ucs4_t* ucs4=m_dll.id3_latin1_ucs4duplicate((id3_latin1_t*)t.c_str());
        const id3_ucs4_t* genre=m_dll.id3_genre_name(ucs4);
        m_dll.id3_ucs4_free(ucs4);
        t=ToStringCharset(genre, ID3_FIELD_TEXTENCODING_ISO_8859_1);
      }

      // convert RX to Remix as per ID3 V2.3 spec
      else if ((t == "RX") || (t == "Rx") || (t == "rX") || (t == "rx"))
      {
        t = "Remix";
      }

      // convert CR to Cover as per ID3 V2.3 spec
      else if ((t == "CR") || (t == "Cr") || (t == "cR") || (t == "cr"))
      {
        t = "Cover";
      }

      // insert genre name in set
      setGenres.insert(t);
    }

  }

  // return a " / " seperated string
  CStdString strGenre;
  set<CStdString>::iterator it;
  for (it = setGenres.begin(); it != setGenres.end(); it++)
  {
    CStdString strTemp = *it;
    if (!strGenre.IsEmpty())
      strGenre += g_advancedSettings.m_musicItemSeparator;
    strGenre += strTemp;
  }
  return strGenre;
}