本文整理汇总了C++中CFileItemPtr::GetVideoInfoTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::GetVideoInfoTag方法的具体用法?C++ CFileItemPtr::GetVideoInfoTag怎么用?C++ CFileItemPtr::GetVideoInfoTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::GetVideoInfoTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BySongArtist
void SSortFileItem::BySongArtist(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (item->HasMusicInfoTag())
label = item->GetMusicInfoTag()->GetArtist();
else if (item->HasVideoInfoTag())
label = item->GetVideoInfoTag()->m_strArtist;
if (g_advancedSettings.m_bMusicLibraryAlbumsSortByArtistThenYear)
{
int year = 0;
if (item->HasMusicInfoTag())
year = item->GetMusicInfoTag()->GetYear();
else if (item->HasVideoInfoTag())
year = item->GetVideoInfoTag()->m_iYear;
label.AppendFormat(" %i", year);
}
CStdString album;
if (item->HasMusicInfoTag())
album = item->GetMusicInfoTag()->GetAlbum();
else if (item->HasVideoInfoTag())
album = item->GetVideoInfoTag()->m_strAlbum;
label += " " + album;
if (item->HasMusicInfoTag())
label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber());
item->SetSortLabel(label);
}
示例2: AddQueuingFolder
// Add an "* All ..." folder to the CFileItemList
// depending on the child node
void CDirectoryNode::AddQueuingFolder(CFileItemList& items) const
{
CFileItemPtr pItem;
// always hide "all" items
if (g_advancedSettings.m_bVideoLibraryHideAllItems)
return;
// no need for "all" item when only one item
if (items.GetObjectCount() <= 1)
return;
// hack - as the season node might return episodes
auto_ptr<CDirectoryNode> pNode(ParseURL(items.GetPath()));
switch (pNode->GetChildType())
{
case NODE_TYPE_SEASONS:
{
CStdString strLabel = g_localizeStrings.Get(20366);
pItem.reset(new CFileItem(strLabel)); // "All Seasons"
pItem->SetPath(BuildPath() + "-1/");
// set the number of watched and unwatched items accordingly
int watched = 0;
int unwatched = 0;
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items[i];
watched += (int)item->GetProperty("watchedepisodes").asInteger();
unwatched += (int)item->GetProperty("unwatchedepisodes").asInteger();
}
pItem->SetProperty("totalepisodes", watched + unwatched);
pItem->SetProperty("numepisodes", watched + unwatched); // will be changed later to reflect watchmode setting
pItem->SetProperty("watchedepisodes", watched);
pItem->SetProperty("unwatchedepisodes", unwatched);
if (items.Size() && items[0]->GetVideoInfoTag())
{
*pItem->GetVideoInfoTag() = *items[0]->GetVideoInfoTag();
pItem->GetVideoInfoTag()->m_iSeason = -1;
}
pItem->GetVideoInfoTag()->m_strTitle = strLabel;
pItem->GetVideoInfoTag()->m_iEpisode = watched + unwatched;
pItem->GetVideoInfoTag()->m_playCount = (unwatched == 0) ? 1 : 0;
if (XFILE::CFile::Exists(pItem->GetCachedSeasonThumb()))
pItem->SetThumbnailImage(pItem->GetCachedSeasonThumb());
}
break;
default:
break;
}
if (pItem)
{
pItem->m_bIsFolder = true;
pItem->SetSpecialSort(g_advancedSettings.m_bVideoLibraryAllItemsOnBottom ? SORT_ON_BOTTOM : SORT_ON_TOP);
pItem->SetCanQueue(false);
items.Add(pItem);
}
}
示例3: ByMovieSortTitle
void SSortFileItem::ByMovieSortTitle(CFileItemPtr &item)
{
if (!item) return;
if (!item->GetVideoInfoTag()->m_strSortTitle.IsEmpty())
item->SetSortLabel(item->GetVideoInfoTag()->m_strSortTitle);
else
item->SetSortLabel(item->GetVideoInfoTag()->m_strTitle);
}
示例4: OnPrepareFileItems
void CGUIWindowVideoNav::OnPrepareFileItems(CFileItemList &items)
{
CGUIWindowVideoBase::OnPrepareFileItems(items);
// set fanart
CQueryParams params;
CVideoDatabaseDirectory dir;
dir.GetQueryParams(items.m_strPath,params);
if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS)
CGUIWindowMusicNav::SetupFanart(items);
NODE_TYPE node = dir.GetDirectoryChildType(items.m_strPath);
// now filter as necessary
bool filterWatched=false;
if (node == NODE_TYPE_EPISODES
|| node == NODE_TYPE_SEASONS
|| node == NODE_TYPE_TITLE_MOVIES
|| node == NODE_TYPE_TITLE_TVSHOWS
|| node == NODE_TYPE_TITLE_MUSICVIDEOS
|| node == NODE_TYPE_RECENTLY_ADDED_EPISODES
|| node == NODE_TYPE_RECENTLY_ADDED_MOVIES
|| node == NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS)
filterWatched = true;
if (items.IsPlugin())
filterWatched = true;
if (items.IsSmartPlayList())
{
if (items.GetContent() == "tvshows")
node = NODE_TYPE_TITLE_TVSHOWS; // so that the check below works
filterWatched = true;
}
int watchMode = g_settings.GetWatchMode(m_vecItems->GetContent());
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items.Get(i);
if(item->HasVideoInfoTag() && (node == NODE_TYPE_TITLE_TVSHOWS || node == NODE_TYPE_SEASONS))
{
if (watchMode == VIDEO_SHOW_UNWATCHED)
item->GetVideoInfoTag()->m_iEpisode = item->GetPropertyInt("unwatchedepisodes");
if (watchMode == VIDEO_SHOW_WATCHED)
item->GetVideoInfoTag()->m_iEpisode = item->GetPropertyInt("watchedepisodes");
item->SetProperty("numepisodes", item->GetVideoInfoTag()->m_iEpisode);
}
if(filterWatched)
{
if((watchMode==VIDEO_SHOW_WATCHED && item->GetVideoInfoTag()->m_playCount== 0)
|| (watchMode==VIDEO_SHOW_UNWATCHED && item->GetVideoInfoTag()->m_playCount > 0))
{
items.Remove(i);
i--;
}
}
}
}
示例5: ByMovieSortTitleNoThe
void SSortFileItem::ByMovieSortTitleNoThe(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (!item->GetVideoInfoTag()->m_strSortTitle.IsEmpty())
label = item->GetVideoInfoTag()->m_strSortTitle;
else
label = item->GetVideoInfoTag()->m_strTitle;
item->SetSortLabel(RemoveArticles(label));
}
示例6: ByMovieRuntime
void SSortFileItem::ByMovieRuntime(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration() > 0)
label.Format("%i %s", item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration(), item->GetLabel().c_str());
else
label.Format("%s %s", item->GetVideoInfoTag()->m_strRuntime, item->GetLabel().c_str());
item->SetSortLabel(label);
}
示例7: HandleFileItem
void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char *resultname, CFileItemPtr item, const Json::Value ¶meterObject, const Json::Value &validFields, Json::Value &result, bool append /* = true */)
{
Value object;
bool hasFileField = false;
bool hasThumbnailField = false;
for (unsigned int i = 0; i < validFields.size(); i++)
{
CStdString field = validFields[i].asString();
if (field == "file")
hasFileField = true;
if (field == "thumbnail")
hasThumbnailField = true;
}
if (allowFile && hasFileField)
{
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strFileNameAndPath.IsEmpty())
object["file"] = item->GetVideoInfoTag()->m_strFileNameAndPath.c_str();
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().IsEmpty())
object["file"] = item->GetMusicInfoTag()->GetURL().c_str();
if (!object.isMember("file"))
object["file"] = item->m_strPath.c_str();
}
if (ID)
{
if (stricmp(ID, "genreid") == 0)
object[ID] = atoi(item->m_strPath.TrimRight('/').c_str());
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 (hasThumbnailField && !item->GetThumbnailImage().IsEmpty())
object["thumbnail"] = item->GetThumbnailImage().c_str();
if (item->HasVideoInfoTag())
FillDetails(item->GetVideoInfoTag(), item, validFields, object);
if (item->HasMusicInfoTag())
FillDetails(item->GetMusicInfoTag(), item, validFields, object);
object["label"] = item->GetLabel().c_str();
if (resultname)
{
if (append)
result[resultname].append(object);
else
result[resultname] = object;
}
}
示例8: ByYear
void SSortFileItem::ByYear(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
if (item->HasMusicInfoTag())
label.Format("%i %s", item->GetMusicInfoTag()->GetYear(), item->GetLabel().c_str());
else
label.Format("%s %s %i %s", item->GetVideoInfoTag()->m_strPremiered.c_str(), item->GetVideoInfoTag()->m_strFirstAired, item->GetVideoInfoTag()->m_iYear, item->GetLabel().c_str());
item->SetSortLabel(label);
}
示例9: OnAction
bool CGUIWindowVideoNav::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_TOGGLE_WATCHED)
{
CFileItemPtr pItem = m_vecItems->Get(m_viewControl.GetSelectedItem());
if (pItem->IsParentFolder())
return false;
if (pItem && pItem->GetVideoInfoTag()->m_playCount == 0)
return OnContextButton(m_viewControl.GetSelectedItem(),CONTEXT_BUTTON_MARK_WATCHED);
if (pItem && pItem->GetVideoInfoTag()->m_playCount > 0)
return OnContextButton(m_viewControl.GetSelectedItem(),CONTEXT_BUTTON_MARK_UNWATCHED);
}
return CGUIWindowVideoBase::OnAction(action);
}
示例10: ByMovieRating
void SSortFileItem::ByMovieRating(CFileItemPtr &item)
{
if (!item) return;
CStdString label;
label.Format("%f %s", item->GetVideoInfoTag()->m_fRating, item->GetLabel().c_str());
item->SetSortLabel(label);
}
示例11: Add
void CPlayList::Add(const CFileItemPtr &item, int iPosition, int iOrder)
{
int iOldSize = size();
if (iPosition < 0 || iPosition >= iOldSize)
iPosition = iOldSize;
if (iOrder < 0 || iOrder >= iOldSize)
item->m_iprogramCount = iOldSize;
else
item->m_iprogramCount = iOrder;
// videodb files are not supported by the filesystem as yet
if (item->IsVideoDb())
item->m_strPath = item->GetVideoInfoTag()->m_strFileNameAndPath;
// increment the playable counter
item->ClearProperty("unplayable");
if (m_iPlayableItems < 0)
m_iPlayableItems = 1;
else
m_iPlayableItems++;
//CLog::Log(LOGDEBUG,"%s item:(%02i/%02i)[%s]", __FUNCTION__, iPosition, item->m_iprogramCount, item->m_strPath.c_str());
if (iPosition == iOldSize)
m_vecItems.push_back(item);
else
{
ivecItems it = m_vecItems.begin() + iPosition;
m_vecItems.insert(it, 1, item);
// correct any duplicate order values
if (iOrder < iOldSize)
IncrementOrder(iPosition + 1, iOrder);
}
}
示例12: ByEpisodeNum
void SSortFileItem::ByEpisodeNum(CFileItemPtr &item)
{
if (!item) return;
const CVideoInfoTag *tag = item->GetVideoInfoTag();
// we calculate an offset number based on the episode's
// sort season and episode values. in addition
// we include specials 'episode' numbers to get proper
// sorting of multiple specials in a row. each
// of these are given their particular ranges to semi-ensure uniqueness.
// theoretical problem: if a show has > 2^15 specials and two of these are placed
// after each other they will sort backwards. if a show has > 2^32-1 seasons
// or if a season has > 2^16-1 episodes strange things will happen (overflow)
uint64_t num;
if (tag->m_iSpecialSortEpisode > 0)
num = ((uint64_t)tag->m_iSpecialSortSeason<<32)+(tag->m_iSpecialSortEpisode<<16)-((2<<15) - tag->m_iEpisode);
else
num = ((uint64_t)tag->m_iSeason<<32)+(tag->m_iEpisode<<16);
// check filename as there can be duplicates now
CURL file(tag->m_strFileNameAndPath);
CStdString label;
label.Format("%"PRIu64" %s", num, file.GetFileName().c_str());
item->SetSortLabel(label);
}
示例13: Announce
void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender, const char *message, CFileItemPtr item, CVariant &data)
{
// Extract db id of item
CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject;
CStdString type;
int id = 0;
if (item->HasVideoInfoTag())
{
CVideoDatabase::VideoContentTypeToString((VIDEODB_CONTENT_TYPE)item->GetVideoContentType(), type);
id = item->GetVideoInfoTag()->m_iDbId;
}
else if (item->HasMusicInfoTag())
{
if (item->IsAlbum())
type = "album";
else
type = "song";
id = item->GetMusicInfoTag()->GetDatabaseId();
}
else
type = "unknown";
object["type"] = type;
if (id > 0)
object["id"] = id;
Announce(flag, sender, message, object);
}
示例14: SetupFanart
void CGUIWindowMusicBase::SetupFanart(CFileItemList& items)
{
// set fanart
map<CStdString, CStdString> artists;
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items[i];
CStdString strArtist;
if (item->HasProperty("fanart_image"))
continue;
if (item->HasMusicInfoTag())
strArtist = StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator);
if (item->HasVideoInfoTag())
strArtist = StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator);
if (strArtist.IsEmpty())
continue;
map<CStdString, CStdString>::iterator artist = artists.find(strArtist);
if (artist == artists.end())
{
CStdString strFanart = item->GetCachedFanart();
if (XFILE::CFile::Exists(strFanart))
item->SetProperty("fanart_image",strFanart);
else
strFanart = "";
artists.insert(make_pair(strArtist, strFanart));
}
else
item->SetProperty("fanart_image",artist->second);
}
}
示例15: Announce
void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender, const char *message, CFileItemPtr item, CVariant &data)
{
// Extract db id of item
CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject;
CStdString type;
int id = 0;
if (item->HasVideoInfoTag())
{
CVideoDatabase::VideoContentTypeToString(item->GetVideoContentType(), type);
id = item->GetVideoInfoTag()->m_iDbId;
}
else if (item->HasMusicInfoTag())
{
type = "music";
id = item->GetMusicInfoTag()->GetDatabaseId();
}
if (id > 0)
{
type += "id";
object[type] = id;
}
Announce(flag, sender, message, object);
}