本文整理汇总了C++中CFileItem类的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem类的具体用法?C++ CFileItem怎么用?C++ CFileItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFileItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
//.........这里部分代码省略.........
}
break;
case TMSG_RESET:
{
g_application.Stop();
Sleep(200);
g_Windowing.DestroyWindow();
g_powerManager.Reboot();
exit(66);
}
break;
case TMSG_RESTARTAPP:
{
#ifdef _WIN32
g_application.Stop();
Sleep(200);
#endif
exit(65);
// TODO
//char szXBEFileName[1024];
//CIoSupport::GetXbePath(szXBEFileName);
//CUtil::RunXBE(szXBEFileName);
}
break;
case TMSG_MEDIA_PLAY:
{
// first check if we were called from the PlayFile() function
if (pMsg->lpVoid && pMsg->dwParam2 == 0)
{
CFileItem *item = (CFileItem *)pMsg->lpVoid;
g_application.PlayFile(*item, pMsg->dwParam1 != 0);
delete item;
return;
}
// restore to previous window if needed
if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW ||
g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
g_windowManager.PreviousWindow();
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS();
//g_application.StopPlaying();
// play file
CFileItem *item;
if (pMsg->lpVoid && pMsg->dwParam2 == 1)
{
item = (CFileItem *)pMsg->lpVoid;
}
else
{
item = new CFileItem(pMsg->strParam, false);
}
if (item->IsAudio())
item->SetMusicThumb();
else
item->SetVideoThumb();
item->FillInDefaultIcon();
g_application.PlayMedia(*item, item->IsAudio() ? PLAYLIST_MUSIC : PLAYLIST_VIDEO); //Note: this will play playlists always in the temp music playlist (default 2nd parameter), maybe needs some tweaking.
示例2: switch
void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
{
switch (pMsg->dwMessage)
{
case TMSG_SHUTDOWN:
{
switch (CSettings::Get().GetInt("powermanagement.shutdownstate"))
{
case POWERSTATE_SHUTDOWN:
Powerdown();
break;
case POWERSTATE_SUSPEND:
Suspend();
break;
case POWERSTATE_HIBERNATE:
Hibernate();
break;
case POWERSTATE_QUIT:
Quit();
break;
case POWERSTATE_MINIMIZE:
Minimize();
break;
case TMSG_RENDERER_FLUSH:
g_renderManager.Flush();
break;
}
}
break;
case TMSG_POWERDOWN:
{
g_application.Stop(EXITCODE_POWERDOWN);
g_powerManager.Powerdown();
}
break;
case TMSG_QUIT:
{
g_application.Stop(EXITCODE_QUIT);
}
break;
case TMSG_HIBERNATE:
{
g_PVRManager.SetWakeupCommand();
g_powerManager.Hibernate();
}
break;
case TMSG_SUSPEND:
{
g_PVRManager.SetWakeupCommand();
g_powerManager.Suspend();
}
break;
case TMSG_RESTART:
case TMSG_RESET:
{
g_application.Stop(EXITCODE_REBOOT);
g_powerManager.Reboot();
}
break;
case TMSG_RESTARTAPP:
{
#if defined(TARGET_WINDOWS) || defined(TARGET_LINUX)
g_application.Stop(EXITCODE_RESTARTAPP);
#endif
}
break;
case TMSG_INHIBITIDLESHUTDOWN:
{
g_application.InhibitIdleShutdown(pMsg->param1 != 0);
}
break;
case TMSG_ACTIVATESCREENSAVER:
{
g_application.ActivateScreenSaver();
}
break;
case TMSG_MEDIA_PLAY:
{
// first check if we were called from the PlayFile() function
if (pMsg->lpVoid && pMsg->param2 == 0)
{
CFileItem *item = (CFileItem *)pMsg->lpVoid;
g_application.PlayFile(*item, pMsg->param1 != 0);
delete item;
return;
}
//.........这里部分代码省略.........
示例3: bPlaying
bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings /* = false */)
{
bool bPlaying(false);
CFileItemList vecItems;
char szSlash = '\\';
if (strDrive.Find("iso9660") != -1) szSlash = '/';
if ( !pDir->GetDirectory( strDrive, vecItems ) )
{
return false;
}
bool bAllowVideo = true;
bool bAllowPictures = true;
bool bAllowMusic = true;
if (!g_passwordManager.IsMasterLockUnlocked(false))
{
bAllowVideo = !g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].videoLocked();
bAllowPictures = !g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].picturesLocked();
bAllowMusic = !g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].musicLocked();
}
if( bRoot )
{
// check root folders first, for normal structured dvd's
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItem* pItem = vecItems[i];
if (pItem->m_bIsFolder && pItem->m_strPath != "." && pItem->m_strPath != "..")
{
if (pItem->m_strPath.Find( "VIDEO_TS" ) != -1 && bAllowVideo
&& (bypassSettings || g_guiSettings.GetBool("autorun.dvd")))
{
CUtil::PlayDVD();
bPlaying = true;
return true;
}
else if (pItem->m_strPath.Find("MPEGAV") != -1 && bAllowVideo
&& (bypassSettings || g_guiSettings.GetBool("autorun.vcd")))
{
CFileItemList items;
CDirectory::GetDirectory(pItem->m_strPath, items, ".dat");
if (items.Size())
{
items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC);
g_playlistPlayer.ClearPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Add(PLAYLIST_VIDEO, items);
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Play(0);
bPlaying = true;
return true;
}
}
else if (pItem->m_strPath.Find("MPEG2") != -1 && bAllowVideo
&& (bypassSettings || g_guiSettings.GetBool("autorun.vcd")))
{
CFileItemList items;
CDirectory::GetDirectory(pItem->m_strPath, items, ".mpg");
if (items.Size())
{
items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC);
g_playlistPlayer.ClearPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Add(PLAYLIST_VIDEO, items);
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Play(0);
bPlaying = true;
return true;
}
}
else if (pItem->m_strPath.Find("PICTURES") != -1 && bAllowPictures
&& (bypassSettings || g_guiSettings.GetBool("autorun.pictures")))
{
bPlaying = true;
CStdString strExec;
strExec.Format("XBMC.RecursiveSlideShow(%s)", pItem->m_strPath.c_str());
CUtil::ExecBuiltIn(strExec);
return true;
}
}
}
}
// check video first
if (!nAddedToPlaylist && !bPlaying && (bypassSettings || g_guiSettings.GetBool("autorun.video")))
{
// stack video files
CFileItemList tempItems;
tempItems.Append(vecItems);
tempItems.Stack();
CFileItemList itemlist;
for (int i = 0; i < tempItems.Size(); i++)
{
CFileItem *pItem = tempItems[i];
if (!pItem->m_bIsFolder && pItem->IsVideo())
{
bPlaying = true;
if (pItem->IsStack())
//.........这里部分代码省略.........
示例4: item
int CUPnPPlayer::PlayFile(const CFileItem& file, const CPlayerOptions& options, CGUIDialogBusy*& dialog, XbmcThreads::EndTime& timeout)
{
CFileItem item(file);
NPT_Reference<CThumbLoader> thumb_loader;
NPT_Reference<PLT_MediaObject> obj;
NPT_String path(file.GetPath().c_str());
NPT_String tmp, resource;
EMediaControllerQuirks quirks = EMEDIACONTROLLERQUIRKS_NONE;
NPT_CHECK_POINTER_LABEL_SEVERE(m_delegate, failed);
if (file.IsVideoDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CVideoThumbLoader());
else if (item.IsMusicDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CMusicThumbLoader());
obj = BuildObject(item, path, false, thumb_loader, NULL, CUPnP::GetServer(), UPnPPlayer);
if(obj.IsNull()) goto failed;
NPT_CHECK_LABEL_SEVERE(PLT_Didl::ToDidl(*obj, "", tmp), failed_todidl);
tmp.Insert(didl_header, 0);
tmp.Append(didl_footer);
quirks = GetMediaControllerQuirks(m_delegate->m_device.AsPointer());
if (quirks & EMEDIACONTROLLERQUIRKS_X_MKV)
{
for (NPT_Cardinal i=0; i< obj->m_Resources.GetItemCount(); i++) {
if (obj->m_Resources[i].m_ProtocolInfo.GetContentType().Compare("video/x-matroska") == 0) {
CLog::Log(LOGDEBUG, "CUPnPPlayer::PlayFile(%s): applying video/x-mkv quirk", file.GetPath().c_str());
NPT_String protocolInfo = obj->m_Resources[i].m_ProtocolInfo.ToString();
protocolInfo.Replace(":video/x-matroska:", ":video/x-mkv:");
obj->m_Resources[i].m_ProtocolInfo = PLT_ProtocolInfo(protocolInfo);
}
}
}
/* The resource uri's are stored in the Didl. We must choose the best resource
* for the playback device */
NPT_Cardinal res_index;
NPT_CHECK_LABEL_SEVERE(m_control->FindBestResource(m_delegate->m_device, *obj, res_index), failed_findbestresource);
// get the transport info to evaluate the TransportState to be able to
// determine whether we first need to call Stop()
timeout.Set(timeout.GetInitialTimeoutValue());
NPT_CHECK_LABEL_SEVERE(m_control->GetTransportInfo(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed_gettransportinfo);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_traevnt, timeout, dialog), failed_gettransportinfo);
if (m_delegate->m_trainfo.cur_transport_state != "NO_MEDIA_PRESENT" &&
m_delegate->m_trainfo.cur_transport_state != "STOPPED")
{
timeout.Set(timeout.GetInitialTimeoutValue());
NPT_CHECK_LABEL_SEVERE(m_control->Stop(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed_stop);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed_stop);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed_stop);
}
timeout.Set(timeout.GetInitialTimeoutValue());
NPT_CHECK_LABEL_SEVERE(m_control->SetAVTransportURI(m_delegate->m_device
, m_delegate->m_instance
, obj->m_Resources[res_index].m_Uri
, (const char*)tmp
, m_delegate), failed_setavtransporturi);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed_setavtransporturi);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed_setavtransporturi);
timeout.Set(timeout.GetInitialTimeoutValue());
NPT_CHECK_LABEL_SEVERE(m_control->Play(m_delegate->m_device
, m_delegate->m_instance
, "1"
, m_delegate), failed_play);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed_play);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed_play);
/* wait for PLAYING state */
timeout.Set(timeout.GetInitialTimeoutValue());
do {
NPT_CHECK_LABEL_SEVERE(m_control->GetTransportInfo(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed_waitplaying);
{ CSingleLock lock(m_delegate->m_section);
if(m_delegate->m_trainfo.cur_transport_state == "PLAYING"
|| m_delegate->m_trainfo.cur_transport_state == "PAUSED_PLAYBACK")
break;
if(m_delegate->m_trainfo.cur_transport_state == "STOPPED"
&& m_delegate->m_trainfo.cur_transport_status != "OK")
{
CLog::Log(LOGERROR, "UPNP: CUPnPPlayer::OpenFile - remote player signalled error %s", file.GetPath().c_str());
return NPT_FAILURE;
}
}
//.........这里部分代码省略.........
示例5: RunAddon
/*! \brief Run a script, plugin or game add-on.
* \param params The parameters.
* \details params[0] = add-on id.
* params[1] is blank for no add-on parameters
* or
* params[1] = add-on parameters in url format
* or
* params[1,...] = additional parameters in format param=value.
*/
static int RunAddon(const std::vector<std::string>& params)
{
if (params.size())
{
const std::string& addonid = params[0];
AddonPtr addon;
if (CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_PLUGIN))
{
PluginPtr plugin = std::dynamic_pointer_cast<CPluginSource>(addon);
std::string urlParameters;
std::vector<std::string> parameters;
if (params.size() == 2 &&
(StringUtils::StartsWith(params[1], "/") || StringUtils::StartsWith(params[1], "?")))
urlParameters = params[1];
else if (params.size() > 1)
{
parameters.insert(parameters.begin(), params.begin() + 1, params.end());
urlParameters = "?" + StringUtils::Join(parameters, "&");
}
else
{
// Add '/' if addon is run without params (will be removed later so it's safe)
// Otherwise there are 2 entries for the same plugin in ViewModesX.db
urlParameters = "/";
}
std::string cmd;
if (plugin->Provides(CPluginSource::VIDEO))
cmd = StringUtils::Format("ActivateWindow(Videos,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else if (plugin->Provides(CPluginSource::AUDIO))
cmd = StringUtils::Format("ActivateWindow(Music,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else if (plugin->Provides(CPluginSource::EXECUTABLE))
cmd = StringUtils::Format("ActivateWindow(Programs,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else if (plugin->Provides(CPluginSource::IMAGE))
cmd = StringUtils::Format("ActivateWindow(Pictures,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else if (plugin->Provides(CPluginSource::GAME))
cmd = StringUtils::Format("ActivateWindow(Games,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else
// Pass the script name (addonid) and all the parameters
// (params[1] ... params[x]) separated by a comma to RunPlugin
cmd = StringUtils::Format("RunPlugin(%s)", StringUtils::Join(params, ",").c_str());
CBuiltins::GetInstance().Execute(cmd);
}
else if (CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_SCRIPT) ||
CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_SCRIPT_WEATHER) ||
CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_SCRIPT_LYRICS) ||
CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_SCRIPT_LIBRARY))
{
// Pass the script name (addonid) and all the parameters
// (params[1] ... params[x]) separated by a comma to RunScript
CBuiltins::GetInstance().Execute(StringUtils::Format("RunScript(%s)", StringUtils::Join(params, ",").c_str()));
}
else if (CAddonMgr::GetInstance().GetAddon(addonid, addon, ADDON_GAMEDLL))
{
CFileItem item;
if (params.size() >= 2)
{
item = CFileItem(params[1], false);
item.GetGameInfoTag()->SetGameClient(addonid);
}
else
item = CFileItem(addon);
if (!g_application.PlayMedia(item, "", PLAYLIST_NONE))
{
CLog::Log(LOGERROR, "RunAddon could not start %s", addonid.c_str());
return false;
}
}
else
CLog::Log(LOGERROR, "RunAddon: unknown add-on id '%s', or unexpected add-on type (not a script or plugin).", addonid.c_str());
}
else
{
CLog::Log(LOGERROR, "RunAddon called with no arguments.");
}
return 0;
}
示例6: UpdateItem
bool CPVRManager::UpdateItem(CFileItem& item)
{
/* Don't update if a recording is played */
if (item.IsPVRRecording())
return false;
if (!item.IsPVRChannel())
{
CLog::Log(LOGERROR, "CPVRManager - %s - no channel tag provided", __FUNCTION__);
return false;
}
CSingleLock lock(m_critSection);
if (!m_currentFile || *m_currentFile->GetPVRChannelInfoTag() == *item.GetPVRChannelInfoTag())
return false;
g_application.CurrentFileItem() = *m_currentFile;
g_infoManager.SetCurrentItem(*m_currentFile);
CPVRChannelPtr channelTag(item.GetPVRChannelInfoTag());
CEpgInfoTagPtr epgTagNow(channelTag->GetEPGNow());
if (channelTag->IsRadio())
{
CMusicInfoTag* musictag = item.GetMusicInfoTag();
if (musictag)
{
musictag->SetTitle(epgTagNow ?
epgTagNow->Title() :
CSettings::GetInstance().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) ?
"" :
g_localizeStrings.Get(19055)); // no information available
if (epgTagNow)
musictag->SetGenre(epgTagNow->Genre());
musictag->SetDuration(epgTagNow ? epgTagNow->GetDuration() : 3600);
musictag->SetURL(channelTag->Path());
musictag->SetArtist(channelTag->ChannelName());
musictag->SetAlbumArtist(channelTag->ChannelName());
musictag->SetLoaded(true);
musictag->SetComment("");
musictag->SetLyrics("");
}
}
else
{
CVideoInfoTag *videotag = item.GetVideoInfoTag();
if (videotag)
{
videotag->m_strTitle = epgTagNow ?
epgTagNow->Title() :
CSettings::GetInstance().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) ?
"" :
g_localizeStrings.Get(19055); // no information available
if (epgTagNow)
videotag->m_genre = epgTagNow->Genre();
videotag->m_strPath = channelTag->Path();
videotag->m_strFileNameAndPath = channelTag->Path();
videotag->m_strPlot = epgTagNow ? epgTagNow->Plot() : "";
videotag->m_strPlotOutline = epgTagNow ? epgTagNow->PlotOutline() : "";
videotag->m_iEpisode = epgTagNow ? epgTagNow->EpisodeNumber() : 0;
}
}
return false;
}
示例7: GetPlayers
void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores)
{
CURL url(item.GetPath());
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers(%s)", item.GetPath().c_str());
// Process rules
for(unsigned int i = 0; i < s_vecCoreSelectionRules.size(); i++)
s_vecCoreSelectionRules[i]->GetPlayers(item, vecCores);
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: matched %"PRIuS" rules with players", vecCores.size());
if( PAPlayer::HandlesType(url.GetFileType()) )
{
// We no longer force PAPlayer as our default audio player (used to be true):
bool bAdd = false;
if (url.GetProtocol().Equals("mms"))
{
bAdd = false;
}
else if (item.IsType(".wma"))
{
// bAdd = true;
// DVDPlayerCodec codec;
// if (!codec.Init(item.GetPath(),2048))
// bAdd = false;
// codec.DeInit();
}
if (bAdd)
{
if( g_guiSettings.GetInt("audiooutput.mode") == AUDIO_ANALOG )
{
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding PAPlayer (%d)", EPC_PAPLAYER);
vecCores.push_back(EPC_PAPLAYER);
}
else if (url.GetFileType().Equals("ac3")
|| url.GetFileType().Equals("dts"))
{
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding DVDPlayer (%d)", EPC_DVDPLAYER);
vecCores.push_back(EPC_DVDPLAYER);
}
else
{
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding PAPlayer (%d)", EPC_PAPLAYER);
vecCores.push_back(EPC_PAPLAYER);
}
}
}
// Process defaults
// Set video default player. Check whether it's video first (overrule audio check)
// Also push these players in case it is NOT audio either
if (item.IsVideo() || !item.IsAudio())
{
PLAYERCOREID eVideoDefault = GetPlayerCore("videodefaultplayer");
if (eVideoDefault != EPC_NONE)
{
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding videodefaultplayer (%d)", eVideoDefault);
vecCores.push_back(eVideoDefault);
}
GetPlayers(vecCores, false, true); // Video-only players
GetPlayers(vecCores, true, true); // Audio & video players
}
// Set audio default player
// Pushback all audio players in case we don't know the type
if (item.IsAudio())
{
PLAYERCOREID eAudioDefault = GetPlayerCore("audiodefaultplayer");
if (eAudioDefault != EPC_NONE)
{
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding audiodefaultplayer (%d)", eAudioDefault);
vecCores.push_back(eAudioDefault);
}
GetPlayers(vecCores, true, false); // Audio-only players
GetPlayers(vecCores, true, true); // Audio & video players
}
/* make our list unique, preserving first added players */
unique(vecCores);
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: added %"PRIuS" players", vecCores.size());
}
示例8: switch
wxString CQueueViewBase::OnGetItemText(CQueueItem* pItem, ColumnId column) const
{
switch (pItem->GetType())
{
case QueueItemType::Server:
{
CServerItem* pServerItem = reinterpret_cast<CServerItem*>(pItem);
if (!column)
return pServerItem->GetName();
}
break;
case QueueItemType::File:
{
CFileItem* pFileItem = reinterpret_cast<CFileItem*>(pItem);
switch (column)
{
case colLocalName:
return pFileItem->GetIndent() + pFileItem->GetLocalPath().GetPath() + pFileItem->GetLocalFile();
case colDirection:
if (pFileItem->Download())
if (pFileItem->queued())
return _T("<--");
else
return _T("<<--");
else
if (pFileItem->queued())
return _T("-->");
else
return _T("-->>");
break;
case colRemoteName:
return pFileItem->GetRemotePath().FormatFilename(pFileItem->GetRemoteFile());
case colSize:
{
const wxLongLong& size = pFileItem->GetSize();
if (size >= 0)
return CSizeFormat::Format(size);
else
return _T("?");
}
case colPriority:
switch (pFileItem->GetPriority())
{
case QueuePriority::lowest:
return _("Lowest");
case QueuePriority::low:
return _("Low");
default:
case QueuePriority::normal:
return _("Normal");
case QueuePriority::high:
return _("High");
case QueuePriority::highest:
return _("Highest");
}
break;
case colTransferStatus:
case colErrorReason:
return pFileItem->m_statusMessage;
case colTime:
return CTimeFormat::FormatDateTime(pItem->GetTime());
default:
break;
}
}
break;
case QueueItemType::FolderScan:
{
CFolderScanItem* pFolderItem = reinterpret_cast<CFolderScanItem*>(pItem);
switch (column)
{
case colLocalName:
return _T(" ") + pFolderItem->GetLocalPath().GetPath();
case colDirection:
if (pFolderItem->Download())
if (pFolderItem->queued())
return _T("<--");
else
return _T("<<--");
else
if (pFolderItem->queued())
return _T("-->");
else
return _T("-->>");
break;
case colRemoteName:
return pFolderItem->GetRemotePath().GetPath();
case colTransferStatus:
case colErrorReason:
return pFolderItem->m_statusMessage;
case colTime:
return CTimeFormat::FormatDateTime(pItem->GetTime());
default:
break;
}
}
break;
case QueueItemType::Folder:
{
CFileItem* pFolderItem = reinterpret_cast<CFolderItem*>(pItem);
//.........这里部分代码省略.........
示例9: switch
void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
{
switch (pMsg->dwMessage)
{
case TMSG_SHUTDOWN:
{
switch (g_guiSettings.GetInt("powermanagement.shutdownstate"))
{
case POWERSTATE_SHUTDOWN:
Powerdown();
break;
case POWERSTATE_SUSPEND:
Suspend();
break;
case POWERSTATE_HIBERNATE:
Hibernate();
break;
case POWERSTATE_QUIT:
Quit();
break;
case POWERSTATE_MINIMIZE:
Minimize();
break;
case TMSG_RENDERER_FLUSH:
g_renderManager.Flush();
break;
}
}
break;
case TMSG_POWERDOWN:
{
g_application.Stop(EXITCODE_POWERDOWN);
g_powerManager.Powerdown();
}
break;
case TMSG_QUIT:
{
g_application.Stop(EXITCODE_QUIT);
}
break;
case TMSG_HIBERNATE:
{
g_PVRManager.SetWakeupCommand();
g_powerManager.Hibernate();
}
break;
case TMSG_SUSPEND:
{
g_PVRManager.SetWakeupCommand();
g_powerManager.Suspend();
}
break;
case TMSG_RESTART:
case TMSG_RESET:
{
g_application.Stop(EXITCODE_REBOOT);
g_powerManager.Reboot();
}
break;
case TMSG_RESTARTAPP:
{
#if defined(TARGET_WINDOWS) || defined(TARGET_LINUX)
g_application.Stop(EXITCODE_RESTARTAPP);
#endif
}
break;
case TMSG_INHIBITIDLESHUTDOWN:
{
g_application.InhibitIdleShutdown((bool)pMsg->dwParam1);
}
break;
case TMSG_MEDIA_PLAY:
{
// first check if we were called from the PlayFile() function
if (pMsg->lpVoid && pMsg->dwParam2 == 0)
{
CFileItem *item = (CFileItem *)pMsg->lpVoid;
g_application.PlayFile(*item, pMsg->dwParam1 != 0);
delete item;
return;
}
// restore to previous window if needed
if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW ||
g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
g_windowManager.PreviousWindow();
//.........这里部分代码省略.........
示例10: DetectAndAddMissingItemData
void CVideoThumbLoader::DetectAndAddMissingItemData(CFileItem &item)
{
if (item.m_bIsFolder) return;
if (item.HasVideoInfoTag())
{
CStreamDetails& details = item.GetVideoInfoTag()->m_streamDetails;
// add audio language properties
for (int i = 1; i <= details.GetAudioStreamCount(); i++)
{
std::string index = StringUtils::Format("%i", i);
item.SetProperty("AudioChannels." + index, details.GetAudioChannels(i));
item.SetProperty("AudioCodec." + index, details.GetAudioCodec(i).c_str());
item.SetProperty("AudioLanguage." + index, details.GetAudioLanguage(i).c_str());
}
// add subtitle language properties
for (int i = 1; i <= details.GetSubtitleStreamCount(); i++)
{
std::string index = StringUtils::Format("%i", i);
item.SetProperty("SubtitleLanguage." + index, details.GetSubtitleLanguage(i).c_str());
}
}
std::string stereoMode;
// detect stereomode for videos
if (item.HasVideoInfoTag())
stereoMode = item.GetVideoInfoTag()->m_streamDetails.GetStereoMode();
if (stereoMode.empty())
{
std::string path = item.GetPath();
if (item.IsVideoDb() && item.HasVideoInfoTag())
path = item.GetVideoInfoTag()->GetPath();
// check for custom stereomode setting in video settings
CVideoSettings itemVideoSettings;
m_videoDatabase->Open();
if (m_videoDatabase->GetVideoSettings(item, itemVideoSettings) && itemVideoSettings.m_StereoMode != RENDER_STEREO_MODE_OFF)
stereoMode = CStereoscopicsManager::GetInstance().ConvertGuiStereoModeToString( (RENDER_STEREO_MODE) itemVideoSettings.m_StereoMode );
m_videoDatabase->Close();
// still empty, try grabbing from filename
// TODO: in case of too many false positives due to using the full path, extract the filename only using string utils
if (stereoMode.empty())
stereoMode = CStereoscopicsManager::GetInstance().DetectStereoModeByString( path );
}
if (!stereoMode.empty())
item.SetProperty("stereomode", CStereoscopicsManager::GetInstance().NormalizeStereoMode(stereoMode));
}
示例11: GetNextItem
void CQueueViewFailed::OnRemoveSelected(wxCommandEvent&)
{
#ifndef __WXMSW__
// GetNextItem is O(n) if nothing is selected, GetSelectedItemCount() is O(1)
if (!GetSelectedItemCount())
return;
#endif
std::list<CQueueItem*> selectedItems;
long item = -1;
for (;;)
{
item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1)
break;
selectedItems.push_front(GetQueueItem(item));
SetItemState(item, 0, wxLIST_STATE_SELECTED);
}
CEditHandler* pEditHandler = CEditHandler::Get();
while (!selectedItems.empty())
{
CQueueItem* pItem = selectedItems.front();
selectedItems.pop_front();
CQueueItem* pTopLevelItem = pItem->GetTopLevelItem();
if (pItem->GetType() == QueueItemType::Server)
{
CServerItem* pServerItem = (CServerItem*)pItem;
if (pEditHandler && pEditHandler->GetFileCount(CEditHandler::remote, CEditHandler::upload_and_remove_failed, &pServerItem->GetServer()))
pEditHandler->RemoveAll(CEditHandler::upload_and_remove_failed, &pServerItem->GetServer());
}
else if (pItem->GetType() == QueueItemType::File)
{
CFileItem* pFileItem = (CFileItem*)pItem;
if (pFileItem->m_edit == CEditHandler::remote && pEditHandler)
{
if (pFileItem->m_edit == CEditHandler::local)
{
wxString fullPath(pFileItem->GetLocalPath().GetPath() + pFileItem->GetLocalFile());
enum CEditHandler::fileState state = pEditHandler->GetFileState(fullPath);
if (state == CEditHandler::upload_and_remove_failed)
pEditHandler->Remove(fullPath);
}
else
{
CServerItem* pServerItem = (CServerItem*)pFileItem->GetTopLevelItem();
enum CEditHandler::fileState state = pEditHandler->GetFileState(pFileItem->GetRemoteFile(), pFileItem->GetRemotePath(), pServerItem->GetServer());
if (state == CEditHandler::upload_and_remove_failed)
pEditHandler->Remove(pFileItem->GetRemoteFile(), pFileItem->GetRemotePath(), pServerItem->GetServer());
}
}
}
if (!pTopLevelItem->GetChild(1))
{
// Parent will get deleted
// If next selected item is parent, remove it from list
if (!selectedItems.empty() && selectedItems.front() == pTopLevelItem)
selectedItems.pop_front();
}
RemoveItem(pItem, true, false, false);
}
DisplayNumberQueuedFiles();
SaveSetItemCount(m_itemCount);
RefreshListOnly();
if (!m_itemCount && m_pQueue->GetQueueView()->GetItemCount())
m_pQueue->SetSelection(0);
}
示例12: FillLibraryArt
bool CVideoThumbLoader::FillLibraryArt(CFileItem &item)
{
CVideoInfoTag &tag = *item.GetVideoInfoTag();
if (tag.m_iDbId > -1 && !tag.m_type.empty())
{
std::map<std::string, std::string> artwork;
m_videoDatabase->Open();
if (m_videoDatabase->GetArtForItem(tag.m_iDbId, tag.m_type, artwork))
SetArt(item, artwork);
else if (tag.m_type == "actor" && !tag.m_artist.empty())
{ // we retrieve music video art from the music database (no backward compat)
CMusicDatabase database;
database.Open();
int idArtist = database.GetArtistByName(item.GetLabel());
if (database.GetArtForItem(idArtist, MediaTypeArtist, artwork))
item.SetArt(artwork);
}
else if (tag.m_type == MediaTypeAlbum)
{ // we retrieve music video art from the music database (no backward compat)
CMusicDatabase database;
database.Open();
int idAlbum = database.GetAlbumByName(item.GetLabel(), tag.m_artist);
if (database.GetArtForItem(idAlbum, MediaTypeAlbum, artwork))
item.SetArt(artwork);
}
if (tag.m_type == MediaTypeEpisode || tag.m_type == MediaTypeSeason)
{
// For episodes and seasons, we want to set fanart for that of the show
if (!item.HasArt("fanart") && tag.m_iIdShow >= 0)
{
ArtCache::const_iterator i = m_showArt.find(tag.m_iIdShow);
if (i == m_showArt.end())
{
std::map<std::string, std::string> showArt;
m_videoDatabase->GetArtForItem(tag.m_iIdShow, MediaTypeTvShow, showArt);
i = m_showArt.insert(std::make_pair(tag.m_iIdShow, showArt)).first;
}
if (i != m_showArt.end())
{
item.AppendArt(i->second, "tvshow");
item.SetArtFallback("fanart", "tvshow.fanart");
item.SetArtFallback("tvshow.thumb", "tvshow.poster");
}
}
if (!item.HasArt("season.poster") && tag.m_iSeason > -1)
{
ArtCache::const_iterator i = m_seasonArt.find(tag.m_iIdSeason);
if (i == m_seasonArt.end())
{
std::map<std::string, std::string> seasonArt;
m_videoDatabase->GetArtForItem(tag.m_iIdSeason, MediaTypeSeason, seasonArt);
i = m_seasonArt.insert(std::make_pair(tag.m_iIdSeason, seasonArt)).first;
}
if (i != m_seasonArt.end())
item.AppendArt(i->second, MediaTypeSeason);
}
}
m_videoDatabase->Close();
}
return !item.GetArt().empty();
}
示例13: if
CAlbum::CAlbum(const CFileItem& item)
{
Reset();
const CMusicInfoTag& tag = *item.GetMusicInfoTag();
SYSTEMTIME stTime;
tag.GetReleaseDate(stTime);
strAlbum = tag.GetAlbum();
strMusicBrainzAlbumID = tag.GetMusicBrainzAlbumID();
genre = tag.GetGenre();
std::vector<std::string> musicBrainAlbumArtistHints = tag.GetMusicBrainzAlbumArtistHints();
strArtistDesc = tag.GetAlbumArtistString();
if (!tag.GetMusicBrainzAlbumArtistID().empty())
{ // have musicbrainz artist info, so use it
for (size_t i = 0; i < tag.GetMusicBrainzAlbumArtistID().size(); i++)
{
std::string artistId = tag.GetMusicBrainzAlbumArtistID()[i];
std::string artistName;
/*
We try and get the mbrainzid <-> name matching from the hints and match on the same index.
If not found, we try and use the mbrainz <-> name matching from the artists fields
If still not found, try and use the same index of the albumartist field.
If still not found, use the mbrainzid and hope we later on can update that entry
*/
if (i < musicBrainAlbumArtistHints.size())
artistName = musicBrainAlbumArtistHints[i];
else if (!tag.GetMusicBrainzArtistID().empty() && !tag.GetArtist().empty())
{
for (size_t j = 0; j < tag.GetMusicBrainzArtistID().size(); j++)
{
if (artistId == tag.GetMusicBrainzArtistID()[j])
{
if (j < tag.GetMusicBrainzArtistHints().size())
artistName = tag.GetMusicBrainzArtistHints()[j];
else
artistName = (j < tag.GetArtist().size()) ? tag.GetArtist()[j] : tag.GetArtist()[0];
}
}
}
if (artistName.empty() && tag.GetMusicBrainzAlbumArtistID().size() == tag.GetAlbumArtist().size())
artistName = tag.GetAlbumArtist()[i];
if (artistName.empty())
artistName = artistId;
CArtistCredit artistCredit(artistName, tag.GetMusicBrainzAlbumArtistID()[i]);
artistCredits.push_back(artistCredit);
}
}
else
{ // no musicbrainz info, so fill in directly
for (std::vector<std::string>::const_iterator it = tag.GetAlbumArtist().begin(); it != tag.GetAlbumArtist().end(); ++it)
{
artistCredits.emplace_back(*it);
}
}
iYear = stTime.wYear;
bCompilation = tag.GetCompilation();
iTimesPlayed = 0;
dateAdded.Reset();
lastPlayed.Reset();
releaseType = tag.GetAlbumReleaseType();
}
示例14: UpdateItem
bool CPVRManager::UpdateItem(CFileItem& item)
{
/* Don't update if a recording is played */
if (item.IsPVRRecording())
return false;
if (!item.IsPVRChannel())
{
CLog::Log(LOGERROR, "CPVRManager - %s - no channel tag provided", __FUNCTION__);
return false;
}
CSingleLock lock(m_critSection);
if (!m_currentFile || *m_currentFile->GetPVRChannelInfoTag() == *item.GetPVRChannelInfoTag())
return false;
g_application.CurrentFileItem() = *m_currentFile;
g_infoManager.SetCurrentItem(*m_currentFile);
CPVRChannel* channelTag = item.GetPVRChannelInfoTag();
CEpgInfoTag epgTagNow;
bool bHasTagNow = channelTag->GetEPGNow(epgTagNow);
if (channelTag->IsRadio())
{
CMusicInfoTag* musictag = item.GetMusicInfoTag();
if (musictag)
{
musictag->SetTitle(bHasTagNow ? epgTagNow.Title() : g_localizeStrings.Get(19055));
musictag->SetGenre(bHasTagNow ? epgTagNow.Genre() : StringUtils::EmptyString);
musictag->SetDuration(bHasTagNow ? epgTagNow.GetDuration() : 3600);
musictag->SetURL(channelTag->Path());
musictag->SetArtist(channelTag->ChannelName());
musictag->SetAlbumArtist(channelTag->ChannelName());
musictag->SetLoaded(true);
musictag->SetComment(StringUtils::EmptyString);
musictag->SetLyrics(StringUtils::EmptyString);
}
}
else
{
CVideoInfoTag *videotag = item.GetVideoInfoTag();
if (videotag)
{
videotag->m_strTitle = bHasTagNow ? epgTagNow.Title() : g_localizeStrings.Get(19055);
videotag->m_strGenre = bHasTagNow ? epgTagNow.Genre() : StringUtils::EmptyString;
videotag->m_strPath = channelTag->Path();
videotag->m_strFileNameAndPath = channelTag->Path();
videotag->m_strPlot = bHasTagNow ? epgTagNow.Plot() : StringUtils::EmptyString;
videotag->m_strPlotOutline = bHasTagNow ? epgTagNow.PlotOutline() : StringUtils::EmptyString;
videotag->m_iEpisode = bHasTagNow ? epgTagNow.EpisodeNum() : 0;
}
}
CPVRChannel* tagPrev = item.GetPVRChannelInfoTag();
if (tagPrev && tagPrev->ChannelNumber() != m_LastChannel)
{
m_LastChannel = tagPrev->ChannelNumber();
m_LastChannelChanged = XbmcThreads::SystemClockMillis();
}
if (XbmcThreads::SystemClockMillis() - m_LastChannelChanged >= (unsigned int) g_guiSettings.GetInt("pvrplayback.channelentrytimeout") && m_LastChannel != m_PreviousChannel[m_PreviousChannelIndex])
m_PreviousChannel[m_PreviousChannelIndex ^= 1] = m_LastChannel;
else
m_LastChannelChanged = XbmcThreads::SystemClockMillis();
return false;
}
示例15: DeleteActiveDSPSettings
bool CActiveAEDSPDatabase::DeleteActiveDSPSettings(const CFileItem &item)
{
std::string strPath, strFileName;
URIUtils::Split(item.GetPath(), strPath, strFileName);
return ExecuteQuery(PrepareSQL("DELETE FROM settings WHERE settings.strPath='%s' and settings.strFileName='%s'", strPath.c_str() , strFileName.c_str()));
}