本文整理汇总了C++中CFileItemList::SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::SetProperty方法的具体用法?C++ CFileItemList::SetProperty怎么用?C++ CFileItemList::SetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemList
的用法示例。
在下文中一共展示了CFileItemList::SetProperty方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Modify
bool CSmartPlaylistFileItemListModifier::Modify(CFileItemList &items) const
{
if (items.HasProperty(PROPERTY_SORT_ORDER))
return false;
std::string xspOption = GetUrlOption(items.GetPath(), URL_OPTION_XSP);
if (xspOption.empty())
return false;
// check for smartplaylist-specific sorting information
CSmartPlaylist xsp;
if (!xsp.LoadFromJson(xspOption))
return false;
items.SetProperty(PROPERTY_SORT_ORDER, (int)xsp.GetOrder());
items.SetProperty(PROPERTY_SORT_ASCENDING, xsp.GetOrderDirection() == SortOrderAscending);
return true;
}
示例2: GetDirectory
bool CSmartPlaylistDirectory::GetDirectory(const CURL& url, CFileItemList& items)
{
// Load in the SmartPlaylist and get the WHERE query
CSmartPlaylist playlist;
if (!playlist.Load(url))
return false;
bool result = GetDirectory(playlist, items);
if (result)
items.SetProperty("library.smartplaylist", true);
return result;
}
示例3: GetDirectory
bool CGUIWindowAddonBrowser::GetDirectory(const CStdString& strDirectory,
CFileItemList& items)
{
bool result;
if (strDirectory.Equals("addons://downloading/"))
{
VECADDONS addons;
CAddonInstaller::Get().GetInstallList(addons);
CURL url(strDirectory);
CAddonsDirectory::GenerateListing(url,addons,items);
result = true;
items.SetProperty("reponame",g_localizeStrings.Get(24067));
items.SetPath(strDirectory);
if (m_guiState.get() && !m_guiState->HideParentDirItems())
{
CFileItemPtr pItem(new CFileItem(".."));
pItem->SetPath(m_history.GetParentPath());
pItem->m_bIsFolder = true;
pItem->m_bIsShareOrDrive = false;
items.AddFront(pItem, 0);
}
}
else
result = CGUIMediaWindow::GetDirectory(strDirectory,items);
if (strDirectory.IsEmpty() && CAddonInstaller::Get().IsDownloading())
{
CFileItemPtr item(new CFileItem("addons://downloading/",true));
item->SetLabel(g_localizeStrings.Get(24067));
item->SetLabelPreformated(true);
item->SetIconImage("DefaultNetwork.png");
items.Add(item);
}
items.SetContent("addons");
for (int i=0;i<items.Size();++i)
SetItemLabel2(items[i]);
return result;
}
示例4: Open
//.........这里部分代码省略.........
CFileItemList *l = new CFileItemList; //don't delete,
l->Add(std::make_shared<CFileItem>(*fileItem));
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, -1, -1, static_cast<void*>(l));
return ACK;
}
else
{
CFileItemList list;
if (FillFileItemList(parameterObject["item"], list) && list.Size() > 0)
{
bool slideshow = true;
for (int index = 0; index < list.Size(); index++)
{
if (!list[index]->IsPicture())
{
slideshow = false;
break;
}
}
if (slideshow)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!slideshow)
return FailedToExecute;
SendSlideshowAction(ACTION_STOP);
slideshow->Reset();
for (int index = 0; index < list.Size(); index++)
slideshow->Add(list[index].get());
return StartSlideshow("", false, optionShuffled.isBoolean() && optionShuffled.asBoolean());
}
else
{
std::string playername;
// Handle the "playerid" option
if (!optionPlayer.isNull())
{
if (optionPlayer.isString())
{
playername = optionPlayer.asString();
if (playername != "default")
{
// check if the there's actually a player with the given name
if (CPlayerCoreFactory::GetInstance().GetPlayerType(playername).empty())
return InvalidParams;
// check if the player can handle at least the first item in the list
std::vector<std::string> possiblePlayers;
CPlayerCoreFactory::GetInstance().GetPlayers(*list.Get(0).get(), possiblePlayers);
bool match = false;
for (auto entry : possiblePlayers)
{
if (StringUtils::CompareNoCase(entry, playername))
{
match = true;
break;
}
}
if (!match)
return InvalidParams;
}
}
else
return InvalidParams;
}
// Handle "shuffled" option
if (optionShuffled.isBoolean())
list.SetProperty("shuffled", optionShuffled);
// Handle "repeat" option
if (!optionRepeat.isNull())
list.SetProperty("repeat", ParseRepeatState(optionRepeat));
// Handle "resume" option
if (list.Size() == 1)
{
if (optionResume.isBoolean() && optionResume.asBoolean())
list[0]->m_lStartOffset = STARTOFFSET_RESUME;
else if (optionResume.isDouble())
list[0]->SetProperty("StartPercent", optionResume);
else if (optionResume.isObject())
list[0]->m_lStartOffset = (int)(ParseTimeInSeconds(optionResume) * 75.0);
}
auto l = new CFileItemList(); //don't delete
l->Copy(list);
CApplicationMessenger::GetInstance().SendMsg(TMSG_MEDIA_PLAY, -1, -1, static_cast<void*>(l), playername);
}
return ACK;
}
else
return InvalidParams;
}
return InvalidParams;
}
示例5: GetDirectory
bool CLibraryDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
std::string libNode = GetNode(strPath);
if (libNode.empty())
return false;
if (URIUtils::HasExtension(libNode, ".xml"))
{ // a filter or folder node
TiXmlElement *node = LoadXML(libNode);
if (node)
{
CStdString type = node->Attribute("type");
if (type == "filter")
{
CSmartPlaylist playlist;
CStdString type, label;
XMLUtils::GetString(node, "content", type);
if (type.IsEmpty())
{
CLog::Log(LOGERROR, "<content> tag must not be empty for type=\"filter\" node '%s'", libNode.c_str());
return false;
}
if (XMLUtils::GetString(node, "label", label))
label = CGUIControlFactory::FilterLabel(label);
playlist.SetType(type);
playlist.SetName(label);
if (playlist.LoadFromXML(node) &&
CSmartPlaylistDirectory::GetDirectory(playlist, items))
{
items.SetProperty("library.filter", "true");
items.SetPath(items.GetProperty("path.db").asString());
return true;
}
}
else if (type == "folder")
{
CStdString path;
XMLUtils::GetPath(node, "path", path);
if (!path.IsEmpty())
{
URIUtils::AddSlashAtEnd(path);
return CDirectory::GetDirectory(path, items, m_strFileMask, m_flags);
}
}
}
return false;
}
// just a plain node - read the folder for XML nodes and other folders
CFileItemList nodes;
if (!CDirectory::GetDirectory(libNode, nodes, ".xml", DIR_FLAG_NO_FILE_DIRS))
return false;
// iterate over our nodes
for (int i = 0; i < nodes.Size(); i++)
{
const TiXmlElement *node = NULL;
CStdString xml = nodes[i]->GetPath();
if (nodes[i]->m_bIsFolder)
node = LoadXML(URIUtils::AddFileToFolder(xml, "index.xml"));
else
{
node = LoadXML(xml);
if (node && URIUtils::GetFileName(xml).Equals("index.xml"))
{ // set the label on our items
CStdString label;
if (XMLUtils::GetString(node, "label", label))
label = CGUIControlFactory::FilterLabel(label);
items.SetLabel(label);
continue;
}
}
if (node)
{
CStdString label, icon;
if (XMLUtils::GetString(node, "label", label))
label = CGUIControlFactory::FilterLabel(label);
XMLUtils::GetString(node, "icon", icon);
int order = 0;
node->Attribute("order", &order);
// create item
URIUtils::RemoveSlashAtEnd(xml);
CStdString folder = URIUtils::GetFileName(xml);
CFileItemPtr item(new CFileItem(URIUtils::AddFileToFolder(strPath, folder), true));
item->SetLabel(label);
if (!icon.IsEmpty() && g_TextureManager.HasTexture(icon))
item->SetIconImage(icon);
item->m_iprogramCount = order;
items.Add(item);
}
}
items.Sort(SortByPlaylistOrder, SortOrderAscending);
return true;
}
示例6: GetDirectory
bool CGUIWindowAddonBrowser::GetDirectory(const std::string& strDirectory,
CFileItemList& items)
{
bool result;
if (URIUtils::PathEquals(strDirectory, "addons://downloading/"))
{
VECADDONS addons;
CAddonInstaller::Get().GetInstallList(addons);
CURL url(strDirectory);
CAddonsDirectory::GenerateListing(url,addons,items);
result = true;
items.SetProperty("reponame",g_localizeStrings.Get(24067));
items.SetPath(strDirectory);
if (m_guiState.get() && !m_guiState->HideParentDirItems())
{
CFileItemPtr pItem(new CFileItem(".."));
pItem->SetPath(m_history.GetParentPath());
pItem->m_bIsFolder = true;
pItem->m_bIsShareOrDrive = false;
items.AddFront(pItem, 0);
}
}
else
{
result = CGUIMediaWindow::GetDirectory(strDirectory,items);
if (CSettings::Get().GetBool("general.addonforeignfilter"))
{
int i=0;
while (i < items.Size())
{
if (!FilterVar(CSettings::Get().GetBool("general.addonforeignfilter"),
items[i]->GetProperty("Addon.Language"), "en") ||
!FilterVar(CSettings::Get().GetBool("general.addonforeignfilter"),
items[i]->GetProperty("Addon.Language"),
g_langInfo.GetLanguageLocale()))
{
i++;
}
else
items.Remove(i);
}
}
}
if (strDirectory.empty() && CAddonInstaller::Get().IsDownloading())
{
CFileItemPtr item(new CFileItem("addons://downloading/",true));
item->SetLabel(g_localizeStrings.Get(24067));
item->SetLabelPreformated(true);
item->SetIconImage("DefaultNetwork.png");
items.Add(item);
}
items.SetContent("addons");
for (int i=0;i<items.Size();++i)
SetItemLabel2(items[i]);
return result;
}
示例7: GetDirectory
bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
CStdString path1(strPath);
URIUtils::RemoveSlashAtEnd(path1);
CURL path(path1);
items.ClearProperties();
items.SetContent("addons");
VECADDONS addons;
// get info from repository
bool reposAsFolders = true;
if (path.GetHostName().Equals("enabled"))
{
CAddonMgr::Get().GetAllAddons(addons, true);
items.SetProperty("reponame",g_localizeStrings.Get(24062));
items.SetLabel(g_localizeStrings.Get(24062));
}
else if (path.GetHostName().Equals("disabled"))
{ // grab all disabled addons, including disabled repositories
reposAsFolders = false;
CAddonMgr::Get().GetAllAddons(addons, false, true);
items.SetProperty("reponame",g_localizeStrings.Get(24039));
items.SetLabel(g_localizeStrings.Get(24039));
}
else if (path.GetHostName().Equals("outdated"))
{
reposAsFolders = false;
CAddonMgr::Get().GetAllOutdatedAddons(addons);
items.SetProperty("reponame",g_localizeStrings.Get(24043));
items.SetLabel(g_localizeStrings.Get(24043));
}
else if (path.GetHostName().Equals("repos"))
{
CAddonMgr::Get().GetAddons(ADDON_REPOSITORY,addons,true);
items.SetLabel(g_localizeStrings.Get(24033)); // Get Add-ons
}
else if (path.GetHostName().Equals("sources"))
{
return GetScriptsAndPlugins(path.GetFileName(), items);
}
else if (path.GetHostName().Equals("all"))
{
CAddonDatabase database;
database.Open();
database.GetAddons(addons);
items.SetProperty("reponame",g_localizeStrings.Get(24032));
items.SetLabel(g_localizeStrings.Get(24032));
}
else if (path.GetHostName().Equals("search"))
{
CStdString search(path.GetFileName());
if (search.IsEmpty() && !GetKeyboardInput(16017, search))
return false;
items.SetProperty("reponame",g_localizeStrings.Get(283));
items.SetLabel(g_localizeStrings.Get(283));
CAddonDatabase database;
database.Open();
database.Search(search, addons);
GenerateListing(path, addons, items, true);
path.SetFileName(search);
items.SetPath(path.Get());
return true;
}
else
{
reposAsFolders = false;
AddonPtr addon;
CAddonMgr::Get().GetAddon(path.GetHostName(),addon);
if (!addon)
return false;
// ensure our repos are up to date
CAddonInstaller::Get().UpdateRepos(false, true);
CAddonDatabase database;
database.Open();
database.GetRepository(addon->ID(),addons);
items.SetProperty("reponame",addon->Name());
items.SetLabel(addon->Name());
}
if (path.GetFileName().IsEmpty())
{
if (!path.GetHostName().Equals("repos"))
{
for (int i=ADDON_UNKNOWN+1;i<ADDON_VIZ_LIBRARY;++i)
{
for (unsigned int j=0;j<addons.size();++j)
{
if (addons[j]->IsType((TYPE)i))
{
CFileItemPtr item(new CFileItem(TranslateType((TYPE)i,true)));
item->SetPath(URIUtils::AddFileToFolder(strPath,TranslateType((TYPE)i,false)));
item->m_bIsFolder = true;
CStdString thumb = GetIcon((TYPE)i);
if (!thumb.IsEmpty() && g_TextureManager.HasTexture(thumb))
item->SetArt("thumb", thumb);
//.........这里部分代码省略.........
示例8: GetDirectory
bool CGUIWindowVideoNav::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
if (m_bDisplayEmptyDatabaseMessage)
return true;
CFileItem directory(strDirectory, true);
if (m_thumbLoader.IsLoading())
m_thumbLoader.StopThread();
m_rootDir.SetCacheDirectory(DIR_CACHE_NEVER);
items.ClearProperties();
bool bResult = CGUIWindowVideoBase::GetDirectory(strDirectory, items);
if (bResult)
{
if (items.IsVideoDb())
{
XFILE::CVideoDatabaseDirectory dir;
CQueryParams params;
dir.GetQueryParams(items.m_strPath,params);
VIDEODATABASEDIRECTORY::NODE_TYPE node = dir.GetDirectoryChildType(items.m_strPath);
items.SetThumbnailImage("");
if (node == VIDEODATABASEDIRECTORY::NODE_TYPE_EPISODES ||
node == NODE_TYPE_SEASONS ||
node == NODE_TYPE_RECENTLY_ADDED_EPISODES)
{
CLog::Log(LOGDEBUG, "WindowVideoNav::GetDirectory");
// grab the show thumb
CFileItem showItem;
m_database.GetFilePathById(params.GetTvShowId(),showItem.m_strPath,VIDEODB_CONTENT_TVSHOWS);
showItem.SetVideoThumb();
items.SetProperty("tvshowthumb", showItem.GetThumbnailImage());
// Grab fanart data
CVideoInfoTag details;
m_database.GetTvShowInfo(showItem.m_strPath, details, params.GetTvShowId());
items.SetProperty("fanart_color1", details.m_fanart.GetColor(0));
items.SetProperty("fanart_color2", details.m_fanart.GetColor(1));
items.SetProperty("fanart_color3", details.m_fanart.GetColor(2));
if (showItem.CacheLocalFanart())
items.SetProperty("fanart_image", showItem.GetCachedFanart());
// save the show description (showplot)
items.SetProperty("showplot", details.m_strPlot);
// set the season thumb
CStdString strLabel;
if (params.GetSeason() == 0)
strLabel = g_localizeStrings.Get(20381);
else
strLabel.Format(g_localizeStrings.Get(20358), params.GetSeason());
CFileItem item(strLabel);
CUtil::GetParentPath(items.m_strPath,item.m_strPath);
item.m_bIsFolder = true;
item.SetCachedSeasonThumb();
if (item.HasThumbnail())
items.SetProperty("seasonthumb",item.GetThumbnailImage());
// the container folder thumb is the parent (i.e. season or show)
if (node == NODE_TYPE_EPISODES || node == NODE_TYPE_RECENTLY_ADDED_EPISODES)
{
items.SetContent("episodes");
// grab the season thumb as the folder thumb
CStdString strLabel;
CStdString strPath;
if (params.GetSeason() == -1 && items.Size() > 0)
{
CQueryParams params2;
dir.GetQueryParams(items[0]->m_strPath,params2);
strLabel.Format(g_localizeStrings.Get(20358), params2.GetSeason());
CUtil::GetParentPath(items.m_strPath,strPath);
}
else
{
if (params.GetSeason() == 0)
strLabel = g_localizeStrings.Get(20381);
else
strLabel.Format(g_localizeStrings.Get(20358), params.GetSeason());
strPath = items.m_strPath;
}
CFileItem item(strLabel);
item.m_strPath = strPath;
item.m_bIsFolder = true;
item.GetVideoInfoTag()->m_strPath = showItem.m_strPath;
item.SetCachedSeasonThumb();
items.SetThumbnailImage(item.GetThumbnailImage());
items.SetProperty("seasonthumb",item.GetThumbnailImage());
}
else
{
items.SetContent("seasons");
items.SetThumbnailImage(showItem.GetThumbnailImage());
}
}
else if (node == NODE_TYPE_TITLE_MOVIES ||
node == NODE_TYPE_RECENTLY_ADDED_MOVIES)
//.........这里部分代码省略.........
示例9: GetDirectory
bool CSmartPlaylistDirectory::GetDirectory(const CSmartPlaylist &playlist, CFileItemList& items, const CStdString &strBaseDir /* = "" */, bool filter /* = false */)
{
bool success = false, success2 = false;
std::set<CStdString> playlists;
SortDescription sorting;
sorting.limitEnd = playlist.GetLimit();
sorting.sortBy = playlist.GetOrder();
sorting.sortOrder = playlist.GetOrderAscending() ? SortOrderAscending : SortOrderDescending;
if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
sorting.sortAttributes = SortAttributeIgnoreArticle;
std::string option = !filter ? "xsp" : "filter";
if (playlist.GetType().Equals("movies") ||
playlist.GetType().Equals("tvshows") ||
playlist.GetType().Equals("episodes"))
{
CVideoDatabase db;
if (db.Open())
{
MediaType mediaType = DatabaseUtils::MediaTypeFromString(playlist.GetType());
CStdString baseDir = strBaseDir;
if (strBaseDir.empty())
{
switch (mediaType)
{
case MediaTypeTvShow:
case MediaTypeEpisode:
baseDir = "videodb://2/2/";
break;
case MediaTypeMovie:
baseDir = "videodb://1/2/";
break;
default:
return false;
}
}
CVideoDbUrl videoUrl;
if (!videoUrl.FromString(baseDir))
return false;
// store the smartplaylist as JSON in the URL as well
CStdString xsp;
if (!playlist.IsEmpty(filter))
{
if (!playlist.SaveAsJson(xsp, !filter))
return false;
}
videoUrl.AddOption(option, xsp);
CDatabase::Filter dbfilter;
success = db.GetSortedVideos(mediaType, videoUrl.ToString(), sorting, items, dbfilter, true);
db.Close();
// if we retrieve a list of episodes and we didn't receive
// a pre-defined base path, we need to fix it
if (strBaseDir.empty() && mediaType == MediaTypeEpisode)
videoUrl.AppendPath("-1/-1/");
items.SetProperty(PROPERTY_PATH_DB, videoUrl.ToString());
}
}
else if (playlist.GetType().Equals("albums"))
{
CMusicDatabase db;
if (db.Open())
{
CMusicDbUrl musicUrl;
if (!musicUrl.FromString(!strBaseDir.empty() ? strBaseDir : "musicdb://3/"))
return false;
// store the smartplaylist as JSON in the URL as well
CStdString xsp;
if (!playlist.IsEmpty(filter))
{
if (!playlist.SaveAsJson(xsp, !filter))
return false;
}
musicUrl.AddOption(option, xsp);
CDatabase::Filter dbfilter;
success = db.GetAlbumsByWhere(musicUrl.ToString(), dbfilter, items, sorting);
db.Close();
items.SetContent("albums");
items.SetProperty(PROPERTY_PATH_DB, musicUrl.ToString());
}
}
else if (playlist.GetType().Equals("artists"))
{
CMusicDatabase db;
if (db.Open())
{
CMusicDbUrl musicUrl;
if (!musicUrl.FromString("musicdb://2/"))
return false;
//.........这里部分代码省略.........
示例10: GetDirectory
bool CHTTPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
CCurlFile http;
CURL url(strPath);
CStdString strName, strLink;
CStdString strBasePath = url.GetFileName();
if(!http.Open(url))
{
CLog::Log(LOGERROR, "%s - Unable to get http directory", __FUNCTION__);
return false;
}
CRegExp reItem(true); // HTML is case-insensitive
reItem.RegComp("<a href=\"(.*)\">(.*)</a>");
CRegExp reDateTime(true);
reDateTime.RegComp("<td align=\"right\">([0-9]{2})-([A-Z]{3})-([0-9]{4}) ([0-9]{2}):([0-9]{2}) +</td>");
CRegExp reDateTimeNginx(true);
reDateTimeNginx.RegComp("</a> +([0-9]{2})-([A-Z]{3})-([0-9]{4}) ([0-9]{2}):([0-9]{2}) ");
CRegExp reSize(true);
reSize.RegComp(">*([0-9.]+)(B|K|M|G| )</td>");
CRegExp reSizeNginx;
reSizeNginx.RegComp("([0-9]+)$");
/* read response from server into string buffer */
char buffer[MAX_PATH + 1024];
while(http.ReadString(buffer, sizeof(buffer)-1))
{
CStdString strBuffer = buffer;
StringUtils::RemoveCRLF(strBuffer);
if (reItem.RegFind(strBuffer.c_str()) >= 0)
{
strLink = reItem.GetReplaceString("\\1");
strName = reItem.GetReplaceString("\\2");
if(strLink[0] == '/')
strLink = strLink.Mid(1);
CStdString strNameTemp = strName.Trim();
CStdString strLinkTemp = strLink;
URIUtils::RemoveSlashAtEnd(strLinkTemp);
URIUtils::RemoveSlashAtEnd(strNameTemp);
CURL::Decode(strLinkTemp);
if (strNameTemp == strLinkTemp && strLinkTemp != "..")
{
CStdStringW wName, wLink, wConverted;
g_charsetConverter.unknownToUTF8(strName);
g_charsetConverter.utf8ToW(strName, wName, false);
HTML::CHTMLUtil::ConvertHTMLToW(wName, wConverted);
g_charsetConverter.wToUTF8(wConverted, strName);
URIUtils::RemoveSlashAtEnd(strName);
g_charsetConverter.unknownToUTF8(strLink);
g_charsetConverter.utf8ToW(strLink, wLink, false);
HTML::CHTMLUtil::ConvertHTMLToW(wLink, wConverted);
g_charsetConverter.wToUTF8(wConverted, strLink);
CFileItemPtr pItem(new CFileItem(strName));
pItem->SetProperty("IsHTTPDirectory", true);
url.SetFileName(strBasePath + strLink);
pItem->SetPath(url.Get());
if(URIUtils::HasSlashAtEnd(pItem->GetPath()))
pItem->m_bIsFolder = true;
CStdString day, month, year, hour, minute;
if (reDateTime.RegFind(strBuffer.c_str()) >= 0)
{
day = reDateTime.GetReplaceString("\\1");
month = reDateTime.GetReplaceString("\\2");
year = reDateTime.GetReplaceString("\\3");
hour = reDateTime.GetReplaceString("\\4");
minute = reDateTime.GetReplaceString("\\5");
}
else if (reDateTimeNginx.RegFind(strBuffer.c_str()) >= 0)
{
day = reDateTimeNginx.GetReplaceString("\\1");
month = reDateTimeNginx.GetReplaceString("\\2");
year = reDateTimeNginx.GetReplaceString("\\3");
hour = reDateTimeNginx.GetReplaceString("\\4");
minute = reDateTimeNginx.GetReplaceString("\\5");
}
if (day.length() > 0 && month.length() > 0 && year.length() > 0)
{
pItem->m_dateTime = CDateTime(atoi(year.c_str()), CDateTime::MonthStringToMonthNum(month), atoi(day.c_str()), atoi(hour.c_str()), atoi(minute.c_str()), 0);
}
if (!pItem->m_bIsFolder)
{
if (reSize.RegFind(strBuffer.c_str()) >= 0)
//.........这里部分代码省略.........
示例11: GetDirectory
bool CRSSDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
CLog::Log(LOGDEBUG,"CRSSDirectory::GetDirectory - path [%s]", strPath.c_str());
m_cacheDirectory = DIR_CACHE_ALWAYS;
CStdString strURL = strPath;
CStdString newURL;
CStdString strRoot = strPath;
if (CUtil::HasSlashAtEnd(strRoot))
strRoot.Delete(strRoot.size() - 1);
// If we have the items in the cache, return them
if (g_directoryCache.GetDirectory(strRoot, items))
{
return true;
}
// Remove the rss:// prefix and replace it with http://
if (strURL.Left(7) == "http://")
{
newURL = strURL;
}
else
{
strURL.Delete(0,6);
// if first symbol is '/', we have local file
if (strURL.Left(1) == "/")
{
newURL = "file://";
}
else
{
newURL = "http://";
}
newURL = newURL + strURL;
}
// Remove the last slash
if (CUtil::HasSlashAtEnd(newURL))
{
CUtil::RemoveSlashAtEnd(newURL);
}
// Create new thread and run the feed retreival from it
// In order to allow progress dialog and cancel operation
m_strUrl = newURL;
Crc32 crc;
crc.ComputeFromLowerCase(newURL);
CStdString strLocalFile;
strLocalFile.Format("special://temp/rss-%08x-%lu.xml", (unsigned __int32)crc, CTimeUtils::GetTimeMS());
CLog::Log(LOGDEBUG,"CRSSDirectory::GetDirectory - going to load url [%s] to file [%s]", newURL.c_str(), strLocalFile.c_str());
if (!BOXEE::Boxee::GetInstance().AsyncLoadUrl(newURL, _P(strLocalFile), "rss-load", NULL))
{
CGUIDialogOK::ShowAndGetInput(51014,0,0,0);
return false;
}
SDL_LockMutex(m_pOpFinishedMutex);
int result = SDL_CondWaitTimeout(m_pOpFinishedCond,m_pOpFinishedMutex,REQUEST_WAIT_PERIOD);
SDL_UnlockMutex(m_pOpFinishedMutex);
m_feed.GetItemList(items);
if (result != 0)
{
m_cacheDirectory = DIR_CACHE_NEVER;
// set this property so that the UI will handle the timeout
CLog::Log(LOGDEBUG,"CRSSDirectory::GetDirectory, loading timed out, path [%s] loaded:%d out of %d", strPath.c_str(), items.Size(),items.GetPageContext().m_itemsPerPage);
items.SetProperty("isRequestTimedOut",true);
}
CLog::Log(LOGDEBUG,"CRSSDirectory::GetDirectory - done loading url, got [%d] items (result=[%d])",items.Size(),result);
if (items.Size() == 0)
{
m_cacheDirectory = DIR_CACHE_NEVER;
return true;
}
else
{
CLog::Log(LOGDEBUG,"CRSSDirectory::GetDirectory - Going to add [DefaultSortLabel] property to each item. [path=%s][NumOfItems=%d] (vns)",strPath.c_str(),items.Size());
for(int i=0; i<items.Size(); i++)
{
CFileItemPtr item = items[i];
char pos[5];
sprintf(pos,"%d",i+1);
item->SetProperty("DefaultSortLabel",pos);
//CLog::Log(LOGDEBUG,"CRSSDirectory::GetDirectory - For item [path=%s] set property [DefaultSortLabel=%s] (vns)", (item->m_strPath).c_str(),(item->GetProperty("DefaultSortLabel")).c_str());
//.........这里部分代码省略.........
示例12: Open
JSONRPC_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
CVariant optionShuffled = parameterObject["options"]["shuffled"];
CVariant optionRepeat = parameterObject["options"]["repeat"];
CVariant optionResume = parameterObject["options"]["resume"];
if (parameterObject["item"].isObject() && parameterObject["item"].isMember("playlistid"))
{
int playlistid = (int)parameterObject["item"]["playlistid"].asInteger();
if (playlistid < PLAYLIST_PICTURE)
{
// Apply the "shuffled" option if available
if (optionShuffled.isBoolean())
g_playlistPlayer.SetShuffle(playlistid, optionShuffled.asBoolean(), false);
// Apply the "repeat" option if available
if (!optionRepeat.isNull())
g_playlistPlayer.SetRepeat(playlistid, (REPEAT_STATE)ParseRepeatState(optionRepeat), false);
}
switch (playlistid)
{
case PLAYLIST_MUSIC:
case PLAYLIST_VIDEO:
CApplicationMessenger::Get().MediaPlay(playlistid, (int)parameterObject["item"]["position"].asInteger());
OnPlaylistChanged();
break;
case PLAYLIST_PICTURE:
return StartSlideshow("", false, optionShuffled.isBoolean() && optionShuffled.asBoolean());
break;
}
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("path"))
{
bool random = (optionShuffled.isBoolean() && optionShuffled.asBoolean()) ||
(!optionShuffled.isBoolean() && parameterObject["item"]["random"].asBoolean());
return StartSlideshow(parameterObject["item"]["path"].asString(), parameterObject["item"]["recursive"].asBoolean(), random);
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("partymode"))
{
if (g_partyModeManager.IsEnabled())
g_partyModeManager.Disable();
CApplicationMessenger::Get().ExecBuiltIn("playercontrol(partymode(" + parameterObject["item"]["partymode"].asString() + "))");
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("channelid"))
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
CPVRChannelGroupsContainer *channelGroupContainer = g_PVRChannelGroups;
if (channelGroupContainer == NULL)
return FailedToExecute;
CPVRChannelPtr channel = channelGroupContainer->GetChannelById((int)parameterObject["item"]["channelid"].asInteger());
if (channel == NULL)
return InvalidParams;
CApplicationMessenger::Get().MediaPlay(CFileItem(*channel.get()));
return ACK;
}
else
{
CFileItemList list;
if (FillFileItemList(parameterObject["item"], list) && list.Size() > 0)
{
bool slideshow = true;
for (int index = 0; index < list.Size(); index++)
{
if (!list[index]->IsPicture())
{
slideshow = false;
break;
}
}
if (slideshow)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!slideshow)
return FailedToExecute;
SendSlideshowAction(ACTION_STOP);
slideshow->Reset();
for (int index = 0; index < list.Size(); index++)
slideshow->Add(list[index].get());
return StartSlideshow("", false, optionShuffled.isBoolean() && optionShuffled.asBoolean());
}
else
{
// Handle "shuffled" option
if (optionShuffled.isBoolean())
list.SetProperty("shuffled", optionShuffled);
// Handle "repeat" option
if (!optionRepeat.isNull())
list.SetProperty("repeat", ParseRepeatState(optionRepeat));
//.........这里部分代码省略.........
示例13: Open
//.........这里部分代码省略.........
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("recordingid"))
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
CPVRRecordings *recordingsContainer = g_PVRRecordings;
if (recordingsContainer == NULL)
return FailedToExecute;
CFileItemPtr fileItem = recordingsContainer->GetById((int)parameterObject["item"]["recordingid"].asInteger());
if (fileItem == NULL)
return InvalidParams;
CApplicationMessenger::Get().MediaPlay(*fileItem);
return ACK;
}
else
{
CFileItemList list;
if (FillFileItemList(parameterObject["item"], list) && list.Size() > 0)
{
bool slideshow = true;
for (int index = 0; index < list.Size(); index++)
{
if (!list[index]->IsPicture())
{
slideshow = false;
break;
}
}
if (slideshow)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!slideshow)
return FailedToExecute;
SendSlideshowAction(ACTION_STOP);
slideshow->Reset();
for (int index = 0; index < list.Size(); index++)
slideshow->Add(list[index].get());
return StartSlideshow("", false, optionShuffled.isBoolean() && optionShuffled.asBoolean());
}
else
{
// Handle the "playerid" option
if (!optionPlayer.isNull())
{
PLAYERCOREID playerId = EPC_NONE;
if (optionPlayer.isInteger())
{
playerId = (PLAYERCOREID)optionPlayer.asInteger();
// check if the there's actually a player with the given player ID
if (CPlayerCoreFactory::Get().GetPlayerConfig(playerId) == NULL)
return InvalidParams;
// check if the player can handle at least the first item in the list
VECPLAYERCORES possiblePlayers;
CPlayerCoreFactory::Get().GetPlayers(*list.Get(0).get(), possiblePlayers);
VECPLAYERCORES::const_iterator matchingPlayer = std::find(possiblePlayers.begin(), possiblePlayers.end(), playerId);
if (matchingPlayer == possiblePlayers.end())
return InvalidParams;
}
else if (!optionPlayer.isString() || optionPlayer.asString().compare("default") != 0)
return InvalidParams;
// set the next player to be used
g_application.m_eForcedNextPlayer = playerId;
}
// Handle "shuffled" option
if (optionShuffled.isBoolean())
list.SetProperty("shuffled", optionShuffled);
// Handle "repeat" option
if (!optionRepeat.isNull())
list.SetProperty("repeat", ParseRepeatState(optionRepeat));
// Handle "resume" option
if (list.Size() == 1)
{
if (optionResume.isBoolean() && optionResume.asBoolean())
list[0]->m_lStartOffset = STARTOFFSET_RESUME;
else if (optionResume.isDouble())
list[0]->SetProperty("StartPercent", optionResume);
else if (optionResume.isObject())
list[0]->m_lStartOffset = (int)(ParseTimeInSeconds(optionResume) * 75.0);
}
CApplicationMessenger::Get().MediaPlay(list);
}
return ACK;
}
else
return InvalidParams;
}
return InvalidParams;
}
示例14: Open
JSONRPC_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
CVariant optionShuffled = parameterObject["options"]["shuffled"];
CVariant optionRepeat = parameterObject["options"]["repeat"];
CVariant optionResume = parameterObject["options"]["resume"];
if (parameterObject["item"].isObject() && parameterObject["item"].isMember("playlistid"))
{
int playlistid = (int)parameterObject["item"]["playlistid"].asInteger();
if (playlistid < PLAYLIST_PICTURE)
{
// Apply the "shuffled" option if available
if (optionShuffled.isBoolean())
g_playlistPlayer.SetShuffle(playlistid, optionShuffled.asBoolean(), false);
// Apply the "repeat" option if available
if (!optionRepeat.isNull())
g_playlistPlayer.SetRepeat(playlistid, (REPEAT_STATE)ParseRepeatState(optionRepeat), false);
}
switch (playlistid)
{
case PLAYLIST_MUSIC:
case PLAYLIST_VIDEO:
g_application.getApplicationMessenger().MediaPlay(playlistid, (int)parameterObject["item"]["position"].asInteger());
OnPlaylistChanged();
break;
case PLAYLIST_PICTURE:
return StartSlideshow();
break;
}
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("path"))
{
CStdString exec = "slideShow(";
exec += parameterObject["item"]["path"].asString();
if ((optionShuffled.isBoolean() && optionShuffled.asBoolean()) ||
(!optionShuffled.isBoolean() && parameterObject["item"]["random"].asBoolean()))
exec += ", random";
else
exec += ", notrandom";
if (parameterObject["item"]["recursive"].asBoolean())
exec += ", recursive";
exec += ")";
ThreadMessage msg = { TMSG_EXECUTE_BUILT_IN, (DWORD)0, (DWORD)0, exec };
g_application.getApplicationMessenger().SendMessage(msg);
return ACK;
}
else
{
CFileItemList list;
if (FillFileItemList(parameterObject["item"], list) && list.Size() > 0)
{
bool slideshow = true;
for (int index = 0; index < list.Size(); index++)
{
if (!list[index]->IsPicture())
{
slideshow = false;
break;
}
}
if (slideshow)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!slideshow)
return FailedToExecute;
SendSlideshowAction(ACTION_STOP);
slideshow->Reset();
for (int index = 0; index < list.Size(); index++)
slideshow->Add(list[index].get());
if (optionShuffled.isBoolean() && optionShuffled.asBoolean())
slideshow->Shuffle();
return StartSlideshow();
}
else
{
// Handle "shuffled" option
if (optionShuffled.isBoolean())
list.SetProperty("shuffled", optionShuffled);
// Handle "repeat" option
if (!optionRepeat.isNull())
list.SetProperty("repeat", ParseRepeatState(optionRepeat));
// Handle "resume" option
if (list.Size() == 1)
{
if (optionResume.isBoolean() && optionResume.asBoolean())
list[0]->m_lStartOffset = STARTOFFSET_RESUME;
//.........这里部分代码省略.........