本文整理汇总了C++中CFileItemPtr::GetPictureInfoTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::GetPictureInfoTag方法的具体用法?C++ CFileItemPtr::GetPictureInfoTag怎么用?C++ CFileItemPtr::GetPictureInfoTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::GetPictureInfoTag方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadItem
bool CPictureInfoLoader::LoadItem(CFileItem* pItem, bool bCanBlock)
{
if (m_pProgressCallback && !pItem->m_bIsFolder)
m_pProgressCallback->SetProgressAdvance();
if (pItem->m_bIsFolder || pItem->IsZIP() || pItem->IsRAR() || pItem->IsCBR() || pItem->IsCBZ() || pItem->IsInternetStream() || pItem->IsVideo())
return false;
if (pItem->HasPictureInfoTag())
return true;
// first check the cached item
CFileItemPtr mapItem = (*m_mapFileItems)[pItem->m_strPath];
if (mapItem && mapItem->m_dateTime==pItem->m_dateTime && mapItem->HasPictureInfoTag())
{ // Query map if we previously cached the file on HD
*pItem->GetPictureInfoTag() = *mapItem->GetPictureInfoTag();
pItem->SetThumbnailImage(mapItem->GetThumbnailImage());
return true;
}
if (m_loadTags)
{ // Nothing found, load tag from file
pItem->GetPictureInfoTag()->Load(pItem->m_strPath);
m_tagReads++;
}
return true;
}
示例2: LoadItemCached
bool CPictureInfoLoader::LoadItemCached(CFileItem* pItem)
{
if (!pItem->IsPicture() || pItem->IsZIP() || pItem->IsRAR() || pItem->IsCBR() || pItem->IsCBZ() || pItem->IsInternetStream() || pItem->IsVideo())
return false;
if (pItem->HasPictureInfoTag())
return true;
// Check the cached item
CFileItemPtr mapItem = (*m_mapFileItems)[pItem->GetPath()];
if (mapItem && mapItem->m_dateTime==pItem->m_dateTime && mapItem->HasPictureInfoTag())
{ // Query map if we previously cached the file on HD
*pItem->GetPictureInfoTag() = *mapItem->GetPictureInfoTag();
pItem->SetArt("thumb", mapItem->GetArt("thumb"));
return true;
}
return true;
}
示例3: FillFileItemList
bool CFileItemHandler::FillFileItemList(const CVariant ¶meterObject, CFileItemList &list)
{
CAudioLibrary::FillFileItemList(parameterObject, list);
CVideoLibrary::FillFileItemList(parameterObject, list);
CFileOperations::FillFileItemList(parameterObject, list);
CStdString file = parameterObject["file"].asString();
if (!file.empty() && (URIUtils::IsURL(file) || (CFile::Exists(file) && !CDirectory::Exists(file))))
{
bool added = false;
for (int index = 0; index < list.Size(); index++)
{
if (list[index]->GetPath() == file)
{
added = true;
break;
}
}
if (!added)
{
CFileItemPtr item = CFileItemPtr(new CFileItem(file, false));
if (item->IsPicture())
{
CPictureInfoTag picture;
picture.Load(item->GetPath());
*item->GetPictureInfoTag() = picture;
}
if (item->GetLabel().empty())
{
item->SetLabel(CUtil::GetTitleFromPath(file, false));
if (item->GetLabel().empty())
item->SetLabel(URIUtils::GetFileName(file));
}
list.Add(item);
}
}
return (list.Size() > 0);
}
示例4: 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().IsEmpty())
object["file"] = item->GetVideoInfoTag()->GetPath().c_str();
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().IsEmpty())
object["file"] = item->GetMusicInfoTag()->GetURL().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->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 == "album" || type == "song" || type == "artist")
object["type"] = type;
else
object["type"] = "song";
}
else if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_type.empty())
{
std::string type = item->GetVideoInfoTag()->m_type;
if (type == "movie" || type == "tvshow" || type == "episode" || type == "musicvideo")
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(), item, fields, object, thumbLoader);
if (item->HasVideoInfoTag())
FillDetails(item->GetVideoInfoTag(), item, fields, object, thumbLoader);
if (item->HasMusicInfoTag())
FillDetails(item->GetMusicInfoTag(), item, fields, object, thumbLoader);
if (item->HasPictureInfoTag())
FillDetails(item->GetPictureInfoTag(), item, fields, object, thumbLoader);
FillDetails(item.get(), item, fields, object, thumbLoader);
if (deleteThumbloader)
delete thumbLoader;
object["label"] = item->GetLabel().c_str();
}
else
object = CVariant(CVariant::VariantTypeNull);
//.........这里部分代码省略.........
示例5: HandleFileItem
//.........这里部分代码省略.........
object["file"] = item->GetPath().c_str();
}
if (ID)
{
if(stricmp(ID, "spotify_albumid") == 0)
{
CStdString spotify_albumid = item->GetPath();
object[ID] = spotify_albumid.c_str();
}
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->HasMusicInfoTag())
{
if (item->m_bIsFolder && item->IsAlbum())
object["type"] = "album";
else
object["type"] = "song";
}
else if (item->HasVideoInfoTag())
{
switch (item->GetVideoContentType())
{
case VIDEODB_CONTENT_EPISODES:
object["type"] = "episode";
break;
case VIDEODB_CONTENT_MUSICVIDEOS:
object["type"] = "musicvideo";
break;
case VIDEODB_CONTENT_MOVIES:
object["type"] = "movie";
break;
case VIDEODB_CONTENT_TVSHOWS:
object["type"] = "tvshow";
break;
default:
break;
}
}
else if (item->HasPictureInfoTag())
object["type"] = "picture";
if (!object.isMember("type"))
object["type"] = "unknown";
}
}
if (hasThumbnailField)
{
if (item->HasThumbnail())
object["thumbnail"] = item->GetThumbnailImage().c_str();
else if (item->HasVideoInfoTag())
{
CStdString strPath, strFileName;
URIUtils::Split(item->GetCachedVideoThumb(), strPath, strFileName);
CStdString cachedThumb = strPath + "auto-" + strFileName;
if (CFile::Exists(cachedThumb))
object["thumbnail"] = cachedThumb;
}
else if (item->HasPictureInfoTag())
{
CStdString thumb = CTextureCache::Get().CheckAndCacheImage(CTextureCache::GetWrappedThumbURL(item->GetPath()));
if (!thumb.empty())
object["thumbnail"] = thumb;
}
if (!object.isMember("thumbnail"))
object["thumbnail"] = "";
}
if (item->HasVideoInfoTag())
FillDetails(item->GetVideoInfoTag(), item, validFields, object);
if (item->HasMusicInfoTag())
FillDetails(item->GetMusicInfoTag(), item, validFields, object);
if (item->HasPictureInfoTag())
FillDetails(item->GetPictureInfoTag(), item, validFields, object);
object["label"] = item->GetLabel().c_str();
}
else
object = CVariant(CVariant::VariantTypeNull);
if (resultname)
{
if (append)
result[resultname].append(object);
else
result[resultname] = object;
}
}
示例6: HandleFileItem
void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char *resultname, CFileItemPtr item, const CVariant ¶meterObject, const CVariant &validFields, CVariant &result, bool append /* = true */)
{
CVariant object;
bool hasFileField = false;
if (item.get())
{
for (unsigned int i = 0; i < validFields.size(); i++)
{
CStdString field = validFields[i].asString();
if (field == "file")
hasFileField = true;
}
if (allowFile && hasFileField)
{
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->GetPath().IsEmpty())
object["file"] = item->GetVideoInfoTag()->GetPath().c_str();
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().IsEmpty())
object["file"] = item->GetMusicInfoTag()->GetURL().c_str();
if (!object.isMember("file"))
object["file"] = item->GetPath().c_str();
}
if (ID)
{
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->HasMusicInfoTag())
{
if (item->m_bIsFolder && item->IsAlbum())
object["type"] = "album";
else
object["type"] = "song";
}
else if (item->HasVideoInfoTag())
{
switch (item->GetVideoContentType())
{
case VIDEODB_CONTENT_EPISODES:
object["type"] = "episode";
break;
case VIDEODB_CONTENT_MUSICVIDEOS:
object["type"] = "musicvideo";
break;
case VIDEODB_CONTENT_MOVIES:
object["type"] = "movie";
break;
case VIDEODB_CONTENT_TVSHOWS:
object["type"] = "tvshow";
break;
default:
break;
}
}
else if (item->HasPictureInfoTag())
object["type"] = "picture";
if (!object.isMember("type"))
object["type"] = "unknown";
}
}
FillDetails(item.get(), item, validFields, object);
if (item->HasVideoInfoTag())
FillDetails(item->GetVideoInfoTag(), item, validFields, object);
if (item->HasMusicInfoTag())
FillDetails(item->GetMusicInfoTag(), item, validFields, object);
if (item->HasPictureInfoTag())
FillDetails(item->GetPictureInfoTag(), item, validFields, object);
object["label"] = item->GetLabel().c_str();
}
else
object = CVariant(CVariant::VariantTypeNull);
if (resultname)
{
if (append)
result[resultname].append(object);
else
result[resultname] = object;
}
}
示例7: HandleFileItem
//.........这里部分代码省略.........
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().IsEmpty())
object["file"] = item->GetMusicInfoTag()->GetURL().c_str();
if (!object.isMember("file"))
object["file"] = item->GetPath().c_str();
}
if (ID)
{
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->HasMusicInfoTag())
{
if (item->m_bIsFolder && item->IsAlbum())
object["type"] = "album";
else
object["type"] = "song";
}
else if (item->HasVideoInfoTag())
{
switch (item->GetVideoContentType())
{
case VIDEODB_CONTENT_EPISODES:
object["type"] = "episode";
break;
case VIDEODB_CONTENT_MUSICVIDEOS:
object["type"] = "musicvideo";
break;
case VIDEODB_CONTENT_MOVIES:
object["type"] = "movie";
break;
case VIDEODB_CONTENT_TVSHOWS:
object["type"] = "tvshow";
break;
default:
break;
}
}
else if (item->HasPictureInfoTag())
object["type"] = "picture";
if (!object.isMember("type"))
object["type"] = "unknown";
}
}
if (hasThumbnailField)
{
if (item->HasThumbnail())
object["thumbnail"] = CTextureCache::Get().CheckAndCacheImage(item->GetThumbnailImage());
else if (item->HasVideoInfoTag())
{ // TODO: Should the JSON-API return actual image URLs, virtual thumb URLs, or local URLs to the cached image?
// ATM we return the latter
CStdString thumbURL = CVideoThumbLoader::GetEmbeddedThumbURL(*item);
CStdString cachedThumb = CTextureCache::Get().GetCachedImage(thumbURL);
if (!cachedThumb.IsEmpty())
object["thumbnail"] = cachedThumb;
}
else if (item->HasPictureInfoTag())
{
CStdString thumb = CTextureCache::Get().CheckAndCacheImage(CTextureCache::GetWrappedThumbURL(item->GetPath()));
if (!thumb.empty())
object["thumbnail"] = thumb;
}
if (!object.isMember("thumbnail"))
object["thumbnail"] = "";
}
FillDetails(item.get(), item, validFields, object);
if (item->HasVideoInfoTag())
FillDetails(item->GetVideoInfoTag(), item, validFields, object);
if (item->HasMusicInfoTag())
FillDetails(item->GetMusicInfoTag(), item, validFields, object);
if (item->HasPictureInfoTag())
FillDetails(item->GetPictureInfoTag(), item, validFields, object);
object["label"] = item->GetLabel().c_str();
}
else
object = CVariant(CVariant::VariantTypeNull);
if (resultname)
{
if (append)
result[resultname].append(object);
else
result[resultname] = object;
}
}
示例8: HandleFileItem
//.........这里部分代码省略.........
fields.erase(fileField);
}
if (ID)
{
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag()->ChannelID() > 0)
object[ID] = item->GetPVRChannelInfoTag()->ChannelID();
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->UniqueBroadcastID() > EPG_TAG_INVALID_UID)
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())
FillDetails(item->GetVideoInfoTag(), item, fields, object, thumbLoader);
if (item->HasMusicInfoTag())
FillDetails(item->GetMusicInfoTag(), item, fields, object, thumbLoader);
if (item->HasPictureInfoTag())
FillDetails(item->GetPictureInfoTag(), item, fields, object, thumbLoader);
FillDetails(item.get(), item, fields, object, thumbLoader);
if (deleteThumbloader)
delete thumbLoader;
object["label"] = item->GetLabel().c_str();
}
else
object = CVariant(CVariant::VariantTypeNull);
if (resultname)
{
if (append)
result[resultname].append(object);
else
result[resultname] = object;
}
}