本文整理汇总了C++中CFileItemPtr::HasPVRRecordingInfoTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::HasPVRRecordingInfoTag方法的具体用法?C++ CFileItemPtr::HasPVRRecordingInfoTag怎么用?C++ CFileItemPtr::HasPVRRecordingInfoTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::HasPVRRecordingInfoTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetContextButtons
void CGUIWindowPVRRecordings::GetContextButtons(int itemNumber, CContextButtons &buttons) const
{
if (itemNumber < 0 || itemNumber >= m_parent->m_vecItems->Size())
return;
CFileItemPtr pItem = m_parent->m_vecItems->Get(itemNumber);
if (pItem->HasPVRRecordingInfoTag())
{
buttons.Add(CONTEXT_BUTTON_INFO, 19053); /* Get Information of this recording */
buttons.Add(CONTEXT_BUTTON_FIND, 19003); /* Find similar program */
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021); /* Play this recording */
CStdString resumeString = GetResumeString(*pItem);
if (!resumeString.IsEmpty())
{
buttons.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString);
}
}
if (pItem->m_bIsFolder)
{
// Have both options for folders since we don't know whether all childs are watched/unwatched
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as UnWatched */
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as Watched */
}
if (pItem->HasPVRRecordingInfoTag())
{
if (pItem->GetPVRRecordingInfoTag()->m_playCount > 0)
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as UnWatched */
else
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as Watched */
buttons.Add(CONTEXT_BUTTON_RENAME, 118); /* Rename this recording */
buttons.Add(CONTEXT_BUTTON_DELETE, 117); /* Delete this recording */
}
buttons.Add(CONTEXT_BUTTON_SORTBY_NAME, 103); /* sort by name */
buttons.Add(CONTEXT_BUTTON_SORTBY_DATE, 104); /* sort by date */
if (pItem->HasPVRRecordingInfoTag() &&
g_PVRClients->HasMenuHooks(pItem->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING))
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
// Update sort by button
//if (m_guiState->GetSortMethod()!=SORT_METHOD_NONE)
//{
// CStdString sortLabel;
// sortLabel.Format(g_localizeStrings.Get(550).c_str(), g_localizeStrings.Get(m_guiState->GetSortMethodLabel()).c_str());
// buttons.Add(CONTEXT_BUTTON_SORTBY, sortLabel); /* Sort method */
//
// if (m_guiState->GetDisplaySortOrder()==SORT_ORDER_ASC)
// buttons.Add(CONTEXT_BUTTON_SORTASC, 584); /* Sort up or down */
// else
// buttons.Add(CONTEXT_BUTTON_SORTASC, 585); /* Sort up or down */
//}
}
示例2: OnPlaybackStarted
void CPVRManager::OnPlaybackStarted(const CFileItemPtr item)
{
m_playingChannel.reset();
m_playingRecording.reset();
m_playingEpgTag.reset();
if (item->HasPVRChannelInfoTag())
{
const CPVRChannelPtr channel(item->GetPVRChannelInfoTag());
m_playingChannel = channel;
SetPlayingGroup(channel);
UpdateLastWatched(channel);
}
else if (item->HasPVRRecordingInfoTag())
{
m_playingRecording = item->GetPVRRecordingInfoTag();
}
else if (item->HasEPGInfoTag())
{
m_playingEpgTag = item->GetEPGInfoTag();
}
m_guiActions->OnPlaybackStarted(item);
}
示例3: Open
bool CPVRFile::Open(const CURL& url)
{
Close();
if (!g_PVRManager.IsStarted())
return false;
std::string strURL = url.Get();
if (StringUtils::StartsWith(strURL, "pvr://channels/tv/") ||
StringUtils::StartsWith(strURL, "pvr://channels/radio/"))
{
CFileItemPtr tag = g_PVRChannelGroups->GetByPath(strURL);
if (tag && tag->HasPVRChannelInfoTag())
{
if (!g_PVRManager.OpenLiveStream(*tag))
return false;
m_isPlayRecording = false;
CLog::Log(LOGDEBUG, "PVRFile - %s - playback has started on filename %s", __FUNCTION__, strURL.c_str());
}
else
{
CLog::Log(LOGERROR, "PVRFile - %s - channel not found with filename %s", __FUNCTION__, strURL.c_str());
return false;
}
}
else if (StringUtils::StartsWith(strURL, "pvr://recordings/active"))
{
CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
{
if (!g_PVRManager.OpenRecordedStream(tag->GetPVRRecordingInfoTag()))
return false;
m_isPlayRecording = true;
CLog::Log(LOGDEBUG, "%s - playback has started on recording %s (%s)", __FUNCTION__, strURL.c_str(), tag->GetPVRRecordingInfoTag()->m_strIconPath.c_str());
}
else
{
CLog::Log(LOGERROR, "PVRFile - Recording not found with filename %s", strURL.c_str());
return false;
}
}
else if (StringUtils::StartsWith(strURL, "pvr://recordings/deleted/"))
{
CLog::Log(LOGNOTICE, "PVRFile - Playback of deleted recordings is not possible (%s)", strURL.c_str());
return false;
}
else
{
CLog::Log(LOGERROR, "%s - invalid path specified %s", __FUNCTION__, strURL.c_str());
return false;
}
return true;
}
示例4: OnPlaybackStarted
void CPVRManager::OnPlaybackStarted(const CFileItemPtr item)
{
m_playingChannel.reset();
m_playingRecording.reset();
m_playingEpgTag.reset();
m_playingClientId = -1;
m_strPlayingClientName.clear();
if (item->HasPVRChannelInfoTag())
{
const CPVRChannelPtr channel(item->GetPVRChannelInfoTag());
m_playingChannel = channel;
m_playingClientId = m_playingChannel->ClientID();
SetPlayingGroup(channel);
int iLastWatchedDelay = m_settings.GetIntValue(CSettings::SETTING_PVRPLAYBACK_DELAYMARKLASTWATCHED) * 1000;
if (iLastWatchedDelay > 0)
{
// Insert new / replace existing last watched update timer
if (m_lastWatchedUpdateTimer)
m_lastWatchedUpdateTimer->Stop(true);
m_lastWatchedUpdateTimer.reset(new CLastWatchedUpdateTimer(*this, channel, CDateTime::GetUTCDateTime()));
m_lastWatchedUpdateTimer->Start(iLastWatchedDelay);
}
else
{
// Store last watched timestamp immediately
UpdateLastWatched(channel, CDateTime::GetUTCDateTime());
}
}
else if (item->HasPVRRecordingInfoTag())
{
m_playingRecording = item->GetPVRRecordingInfoTag();
m_playingClientId = m_playingRecording->m_iClientId;
}
else if (item->HasEPGInfoTag())
{
m_playingEpgTag = item->GetEPGInfoTag();
m_playingClientId = m_playingEpgTag->ClientID();
}
if (m_playingClientId != -1)
{
const CPVRClientPtr client = GetClient(m_playingClientId);
if (client)
m_strPlayingClientName = client->GetFriendlyName();
}
m_guiActions->OnPlaybackStarted(item);
m_epgContainer.OnPlaybackStarted(item);
}
示例5: GetContextButtons
void CGUIWindowPVRRecordings::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
if (itemNumber < 0 || itemNumber >= m_vecItems->Size())
return;
CFileItemPtr pItem = m_vecItems->Get(itemNumber);
if (pItem->HasPVRRecordingInfoTag())
{
buttons.Add(CONTEXT_BUTTON_INFO, 19053); /* Get Information of this recording */
buttons.Add(CONTEXT_BUTTON_FIND, 19003); /* Find similar program */
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021); /* Play this recording */
CStdString resumeString = GetResumeString(*pItem);
if (!resumeString.empty())
{
buttons.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString);
}
}
if (pItem->m_bIsFolder)
{
// Have both options for folders since we don't know whether all childs are watched/unwatched
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as UnWatched */
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as Watched */
}
if (pItem->HasPVRRecordingInfoTag())
{
if (pItem->GetPVRRecordingInfoTag()->m_playCount > 0)
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as UnWatched */
else
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as Watched */
buttons.Add(CONTEXT_BUTTON_RENAME, 118); /* Rename this recording */
}
// Add delete button for all items except the All recordings directory
if (!g_PVRRecordings->IsAllRecordingsDirectory(*pItem.get()))
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
if (pItem->HasPVRRecordingInfoTag() &&
g_PVRClients->HasMenuHooks(pItem->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING))
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
}
示例6: Delete
bool CPVRFile::Delete(const CURL& url)
{
if (!g_PVRManager.IsStarted())
return false;
std::string path(url.GetFileName());
if (StringUtils::StartsWith(path, "recordings/") && path[path.size()-1] != '/')
{
std::string strURL = url.Get();
CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
return tag->GetPVRRecordingInfoTag()->Delete();
}
return false;
}
示例7: OnPlaybackStopped
void CPVRManager::OnPlaybackStopped(const CFileItemPtr item)
{
// Playback ended due to user interaction
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag() == m_playingChannel)
{
bool bUpdateLastWatched = true;
if (m_lastWatchedUpdateTimer)
{
if (m_lastWatchedUpdateTimer->IsRunning())
{
// If last watched timer is still running, cancel it. Channel was not watched long enough to store the value.
m_lastWatchedUpdateTimer->Stop(true);
bUpdateLastWatched = false;
}
m_lastWatchedUpdateTimer.reset();
}
if (bUpdateLastWatched)
{
// If last watched timer is not running (any more), channel was watched long enough to store the value.
UpdateLastWatched(m_playingChannel, CDateTime::GetUTCDateTime());
}
SetChanged();
NotifyObservers(ObservableMessageChannelPlaybackStopped);
m_playingChannel.reset();
m_playingClientId = -1;
m_strPlayingClientName.clear();
}
else if (item->HasPVRRecordingInfoTag() && item->GetPVRRecordingInfoTag() == m_playingRecording)
{
m_playingRecording.reset();
m_playingClientId = -1;
m_strPlayingClientName.clear();
}
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag() == m_playingEpgTag)
{
m_playingEpgTag.reset();
m_playingClientId = -1;
m_strPlayingClientName.clear();
}
m_guiActions->OnPlaybackStopped(item);
m_epgContainer.OnPlaybackStopped(item);
}
示例8: OnPlaybackStopped
void CPVRManager::OnPlaybackStopped(const CFileItemPtr item)
{
// Playback ended due to user interaction
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag() == m_playingChannel)
{
UpdateLastWatched(item->GetPVRChannelInfoTag());
m_playingChannel.reset();
}
else if (item->HasPVRRecordingInfoTag() && item->GetPVRRecordingInfoTag() == m_playingRecording)
{
m_playingRecording.reset();
}
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag() == m_playingEpgTag)
{
m_playingEpgTag.reset();
}
m_guiActions->OnPlaybackStopped(item);
}
示例9: Rename
bool CPVRFile::Rename(const CURL& url, const CURL& urlnew)
{
if (!g_PVRManager.IsStarted())
return false;
std::string path(url.GetFileName());
std::string newname(urlnew.GetFileName());
size_t found = newname.find_last_of("/");
if (found != std::string::npos)
newname = newname.substr(found+1);
if (StringUtils::StartsWith(path, "recordings/") && path[path.size()-1] != '/')
{
std::string strURL = url.Get();
CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
return tag->GetPVRRecordingInfoTag()->Rename(newname);
}
return false;
}
示例10: PlayMedia
bool CPVRGUIActions::PlayMedia(const CFileItemPtr &item) const
{
CFileItemPtr pvrItem(item);
if (URIUtils::IsPVRChannel(item->GetPath()) && !item->HasPVRChannelInfoTag())
pvrItem = g_PVRChannelGroups->GetByPath(item->GetPath());
else if (URIUtils::IsPVRRecording(item->GetPath()) && !item->HasPVRRecordingInfoTag())
pvrItem = g_PVRRecordings->GetByPath(item->GetPath());
if (pvrItem->HasPVRChannelInfoTag())
{
return SwitchToChannel(pvrItem,
CServiceBroker::GetSettings().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED),
true);
}
else if (pvrItem->HasPVRRecordingInfoTag())
{
return PlayRecording(pvrItem,
CServiceBroker::GetSettings().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED),
true);
}
return false;
}
示例11: DoAnnounce
void CAnnouncementManager::DoAnnounce(AnnouncementFlag flag, const char *sender, const char *message, CFileItemPtr item, const CVariant &data)
{
if (item == nullptr)
{
DoAnnounce(flag, sender, message, data);
return;
}
// Extract db id of item
CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject;
std::string type;
int id = 0;
if(item->HasPVRChannelInfoTag())
{
const PVR::CPVRChannelPtr channel(item->GetPVRChannelInfoTag());
id = channel->ChannelID();
type = "channel";
object["item"]["title"] = channel->ChannelName();
object["item"]["channeltype"] = channel->IsRadio() ? "radio" : "tv";
if (data.isMember("player") && data["player"].isMember("playerid"))
object["player"]["playerid"] = channel->IsRadio() ? PLAYLIST_MUSIC : PLAYLIST_VIDEO;
}
else if (item->HasVideoInfoTag() && !item->HasPVRRecordingInfoTag())
{
id = item->GetVideoInfoTag()->m_iDbId;
//! @todo Can be removed once this is properly handled when starting playback of a file
if (id <= 0 && !item->GetPath().empty() &&
(!item->HasProperty(LOOKUP_PROPERTY) || item->GetProperty(LOOKUP_PROPERTY).asBoolean()))
{
CVideoDatabase videodatabase;
if (videodatabase.Open())
{
std::string path = item->GetPath();
std::string videoInfoTagPath(item->GetVideoInfoTag()->m_strFileNameAndPath);
if (StringUtils::StartsWith(videoInfoTagPath, "removable://"))
path = videoInfoTagPath;
if (videodatabase.LoadVideoInfo(path, *item->GetVideoInfoTag(), VideoDbDetailsNone))
id = item->GetVideoInfoTag()->m_iDbId;
videodatabase.Close();
}
}
if (!item->GetVideoInfoTag()->m_type.empty())
type = item->GetVideoInfoTag()->m_type;
else
CVideoDatabase::VideoContentTypeToString((VIDEODB_CONTENT_TYPE)item->GetVideoContentType(), type);
if (id <= 0)
{
//! @todo Can be removed once this is properly handled when starting playback of a file
item->SetProperty(LOOKUP_PROPERTY, false);
std::string title = item->GetVideoInfoTag()->m_strTitle;
if (title.empty())
title = item->GetLabel();
object["item"]["title"] = title;
switch (item->GetVideoContentType())
{
case VIDEODB_CONTENT_MOVIES:
if (item->GetVideoInfoTag()->HasYear())
object["item"]["year"] = item->GetVideoInfoTag()->GetYear();
break;
case VIDEODB_CONTENT_EPISODES:
if (item->GetVideoInfoTag()->m_iEpisode >= 0)
object["item"]["episode"] = item->GetVideoInfoTag()->m_iEpisode;
if (item->GetVideoInfoTag()->m_iSeason >= 0)
object["item"]["season"] = item->GetVideoInfoTag()->m_iSeason;
if (!item->GetVideoInfoTag()->m_strShowTitle.empty())
object["item"]["showtitle"] = item->GetVideoInfoTag()->m_strShowTitle;
break;
case VIDEODB_CONTENT_MUSICVIDEOS:
if (!item->GetVideoInfoTag()->m_strAlbum.empty())
object["item"]["album"] = item->GetVideoInfoTag()->m_strAlbum;
if (!item->GetVideoInfoTag()->m_artist.empty())
object["item"]["artist"] = StringUtils::Join(item->GetVideoInfoTag()->m_artist, " / ");
break;
}
}
}
else if (item->HasMusicInfoTag())
{
id = item->GetMusicInfoTag()->GetDatabaseId();
type = MediaTypeSong;
//! @todo Can be removed once this is properly handled when starting playback of a file
if (id <= 0 && !item->GetPath().empty() &&
(!item->HasProperty(LOOKUP_PROPERTY) || item->GetProperty(LOOKUP_PROPERTY).asBoolean()))
{
CMusicDatabase musicdatabase;
if (musicdatabase.Open())
{
CSong song;
if (musicdatabase.GetSongByFileName(item->GetPath(), song, item->m_lStartOffset))
{
//.........这里部分代码省略.........
示例12: ReadPvr
bool CEdl::ReadPvr(const std::string &strMovie)
{
if (!PVR::g_PVRManager.IsStarted())
{
CLog::Log(LOGERROR, "%s - PVR Manager not started, cannot read Edl for %s", __FUNCTION__, strMovie.c_str());
return false;
}
CFileItemPtr tag = PVR::g_PVRRecordings->GetByPath(strMovie);
if (tag && tag->HasPVRRecordingInfoTag())
{
CLog::Log(LOGDEBUG, "%s - Reading Edl for recording: %s", __FUNCTION__, tag->GetPVRRecordingInfoTag()->m_strTitle.c_str());
}
else
{
CLog::Log(LOGERROR, "%s - Unable to find PVR recording: %s", __FUNCTION__, strMovie.c_str());
return false;
}
std::vector<PVR_EDL_ENTRY> edl = tag->GetPVRRecordingInfoTag()->GetEdl();
std::vector<PVR_EDL_ENTRY>::const_iterator it;
for (it = edl.begin(); it != edl.end(); ++it)
{
Cut cut;
cut.start = it->start;
cut.end = it->end;
switch (it->type)
{
case PVR_EDL_TYPE_CUT:
cut.action = CUT;
break;
case PVR_EDL_TYPE_MUTE:
cut.action = MUTE;
break;
case PVR_EDL_TYPE_SCENE:
if (!AddSceneMarker(cut.end))
{
CLog::Log(LOGWARNING, "%s - Error adding scene marker for pvr recording", __FUNCTION__);
}
continue;
case PVR_EDL_TYPE_COMBREAK:
cut.action = COMM_BREAK;
break;
default:
CLog::Log(LOGINFO, "%s - Ignoring entry of unknown type: %d", __FUNCTION__, it->type);
continue;
}
if (AddCut(cut))
{
CLog::Log(LOGDEBUG, "%s - Added break [%s - %s] found in PVRRecording for: %s.",
__FUNCTION__, MillisecondsToTimeString(cut.start).c_str(),
MillisecondsToTimeString(cut.end).c_str(), strMovie.c_str());
}
else
{
CLog::Log(LOGERROR, "%s - Invalid break [%s - %s] found in PVRRecording for: %s. Continuing anyway.",
__FUNCTION__, MillisecondsToTimeString(cut.start).c_str(),
MillisecondsToTimeString(cut.end).c_str(), strMovie.c_str());
}
}
return !edl.empty();
}
示例13: HandleFileItem
void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char *resultname, CFileItemPtr item, const CVariant ¶meterObject, const std::set<std::string> &validFields, CVariant &result, bool append /* = true */, CThumbLoader *thumbLoader /* = NULL */)
{
CVariant object;
std::set<std::string> fields(validFields.begin(), validFields.end());
if (item.get())
{
std::set<std::string>::const_iterator fileField = fields.find("file");
if (fileField != fields.end())
{
if (allowFile)
{
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->GetPath().empty())
object["file"] = item->GetVideoInfoTag()->GetPath().c_str();
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().empty())
object["file"] = item->GetMusicInfoTag()->GetURL().c_str();
if (item->HasPVRRecordingInfoTag() && !item->GetPVRRecordingInfoTag()->GetPath().empty())
object["file"] = item->GetPVRRecordingInfoTag()->GetPath().c_str();
if (item->HasPVRTimerInfoTag() && !item->GetPVRTimerInfoTag()->m_strFileNameAndPath.empty())
object["file"] = item->GetPVRTimerInfoTag()->m_strFileNameAndPath.c_str();
if (!object.isMember("file"))
object["file"] = item->GetPath().c_str();
}
fields.erase(fileField);
}
if (ID)
{
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag()->ChannelID() > 0)
object[ID] = item->GetPVRChannelInfoTag()->ChannelID();
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->UniqueBroadcastID() > 0)
object[ID] = item->GetEPGInfoTag()->UniqueBroadcastID();
else if (item->HasPVRRecordingInfoTag() && item->GetPVRRecordingInfoTag()->m_iRecordingId > 0)
object[ID] = item->GetPVRRecordingInfoTag()->m_iRecordingId;
else if (item->HasPVRTimerInfoTag() && item->GetPVRTimerInfoTag()->m_iTimerId > 0)
object[ID] = item->GetPVRTimerInfoTag()->m_iTimerId;
else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDatabaseId() > 0)
object[ID] = (int)item->GetMusicInfoTag()->GetDatabaseId();
else if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iDbId > 0)
object[ID] = item->GetVideoInfoTag()->m_iDbId;
if (stricmp(ID, "id") == 0)
{
if (item->HasPVRChannelInfoTag())
object["type"] = "channel";
else if (item->HasMusicInfoTag())
{
std::string type = item->GetMusicInfoTag()->GetType();
if (type == MediaTypeAlbum || type == MediaTypeSong || type == MediaTypeArtist)
object["type"] = type;
else if (!item->m_bIsFolder)
object["type"] = MediaTypeSong;
}
else if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_type.empty())
{
std::string type = item->GetVideoInfoTag()->m_type;
if (type == MediaTypeMovie || type == MediaTypeTvShow || type == MediaTypeEpisode || type == MediaTypeMusicVideo)
object["type"] = type;
}
else if (item->HasPictureInfoTag())
object["type"] = "picture";
if (!object.isMember("type"))
object["type"] = "unknown";
if (fields.find("filetype") != fields.end())
{
if (item->m_bIsFolder)
object["filetype"] = "directory";
else
object["filetype"] = "file";
}
}
}
bool deleteThumbloader = false;
if (thumbLoader == NULL)
{
if (item->HasVideoInfoTag())
thumbLoader = new CVideoThumbLoader();
else if (item->HasMusicInfoTag())
thumbLoader = new CMusicThumbLoader();
if (thumbLoader != NULL)
{
deleteThumbloader = true;
thumbLoader->OnLoaderStart();
}
}
if (item->HasPVRChannelInfoTag())
FillDetails(item->GetPVRChannelInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasEPGInfoTag())
FillDetails(item->GetEPGInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasPVRRecordingInfoTag())
FillDetails(item->GetPVRRecordingInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasPVRTimerInfoTag())
FillDetails(item->GetPVRTimerInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasVideoInfoTag())
//.........这里部分代码省略.........
示例14: LoadVideoInfo
void CGUIWindowVideoNav::LoadVideoInfo(CFileItemList &items, CVideoDatabase &database, bool allowReplaceLabels)
{
// TODO: this could possibly be threaded as per the music info loading,
// we could also cache the info
if (!items.GetContent().empty() && !items.IsPlugin())
return; // don't load for listings that have content set and weren't created from plugins
std::string content = items.GetContent();
// determine content only if it isn't set
if (content.empty())
{
content = database.GetContentForPath(items.GetPath());
items.SetContent(content.empty() ? "files" : content);
}
/*
If we have a matching item in the library, so we can assign the metadata to it. In addition, we can choose
* whether the item is stacked down (eg in the case of folders representing a single item)
* whether or not we assign the library's labels to the item, or leave the item as is.
As certain users (read: certain developers) don't want either of these to occur, we compromise by stacking
items down only if stacking is available and enabled.
Similarly, we assign the "clean" library labels to the item only if the "Replace filenames with library titles"
setting is enabled.
*/
const bool stackItems = items.GetProperty("isstacked").asBoolean() || (StackingAvailable(items) && CSettings::GetInstance().GetBool(CSettings::SETTING_MYVIDEOS_STACKVIDEOS));
const bool replaceLabels = allowReplaceLabels && CSettings::GetInstance().GetBool(CSettings::SETTING_MYVIDEOS_REPLACELABELS);
CFileItemList dbItems;
/* NOTE: In the future when GetItemsForPath returns all items regardless of whether they're "in the library"
we won't need the fetchedPlayCounts code, and can "simply" do this directly on absense of content. */
bool fetchedPlayCounts = false;
if (!content.empty())
{
database.GetItemsForPath(content, items.GetPath(), dbItems);
dbItems.SetFastLookup(true);
}
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr pItem = items[i];
CFileItemPtr match;
if (!content.empty()) /* optical media will be stacked down, so it's path won't match the base path */
{
std::string pathToMatch = pItem->IsOpticalMediaFile() ? pItem->GetLocalMetadataPath() : pItem->GetPath();
if (URIUtils::IsMultiPath(pathToMatch))
pathToMatch = CMultiPathDirectory::GetFirstPath(pathToMatch);
match = dbItems.Get(pathToMatch);
}
if (match)
{
pItem->UpdateInfo(*match, replaceLabels);
if (stackItems)
{
if (match->m_bIsFolder)
pItem->SetPath(match->GetVideoInfoTag()->m_strPath);
else
pItem->SetPath(match->GetVideoInfoTag()->m_strFileNameAndPath);
// if we switch from a file to a folder item it means we really shouldn't be sorting files and
// folders separately
if (pItem->m_bIsFolder != match->m_bIsFolder)
{
items.SetSortIgnoreFolders(true);
pItem->m_bIsFolder = match->m_bIsFolder;
}
}
}
else
{
/* NOTE: Currently we GetPlayCounts on our items regardless of whether content is set
as if content is set, GetItemsForPaths doesn't return anything not in the content tables.
This code can be removed once the content tables are always filled */
if (!pItem->m_bIsFolder && !fetchedPlayCounts)
{
database.GetPlayCounts(items.GetPath(), items);
fetchedPlayCounts = true;
}
// preferably use some information from PVR info tag if available
if (pItem->HasPVRRecordingInfoTag())
pItem->GetPVRRecordingInfoTag()->CopyClientInfo(pItem->GetVideoInfoTag());
// set the watched overlay
if (pItem->IsVideo())
pItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_UNWATCHED, pItem->HasVideoInfoTag() && pItem->GetVideoInfoTag()->m_playCount > 0);
}
}
}
示例15: Open
bool CDVDInputStreamPVRManager::Open()
{
if (!CDVDInputStream::Open())
return false;
CURL url(m_item.GetDynPath());
std::string strURL = url.Get();
if (StringUtils::StartsWith(strURL, "pvr://channels/tv/") ||
StringUtils::StartsWith(strURL, "pvr://channels/radio/"))
{
CFileItemPtr tag = CServiceBroker::GetPVRManager().ChannelGroups()->GetByPath(strURL);
if (tag && tag->HasPVRChannelInfoTag())
{
if (!CServiceBroker::GetPVRManager().OpenLiveStream(*tag))
return false;
m_isRecording = false;
CLog::Log(LOGDEBUG, "CDVDInputStreamPVRManager - %s - playback has started on filename %s", __FUNCTION__, strURL.c_str());
}
else
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager - %s - channel not found with filename %s", __FUNCTION__, strURL.c_str());
return false;
}
}
else if (CPVRRecordingsPath(strURL).IsActive())
{
CFileItemPtr tag = CServiceBroker::GetPVRManager().Recordings()->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
{
if (!CServiceBroker::GetPVRManager().OpenRecordedStream(tag->GetPVRRecordingInfoTag()))
return false;
m_isRecording = true;
CLog::Log(LOGDEBUG, "%s - playback has started on recording %s (%s)", __FUNCTION__, strURL.c_str(), tag->GetPVRRecordingInfoTag()->m_strIconPath.c_str());
}
else
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager - Recording not found with filename %s", strURL.c_str());
return false;
}
}
else if (CPVRRecordingsPath(strURL).IsDeleted())
{
CLog::Log(LOGNOTICE, "CDVDInputStreamPVRManager - Playback of deleted recordings is not possible (%s)", strURL.c_str());
return false;
}
else
{
CLog::Log(LOGERROR, "%s - invalid path specified %s", __FUNCTION__, strURL.c_str());
return false;
}
m_eof = false;
if (URIUtils::IsPVRChannel(url.Get()))
{
std::shared_ptr<CPVRClient> client;
if (CServiceBroker::GetPVRManager().Clients()->GetPlayingClient(client) &&
client->GetClientCapabilities().HandlesDemuxing())
m_demuxActive = true;
}
CLog::Log(LOGDEBUG, "CDVDInputStreamPVRManager::Open - stream opened: %s", CURL::GetRedacted(m_item.GetDynPath()).c_str());
m_StreamProps->iStreamCount = 0;
return true;
}