//------------------------------------------------------------------------
void CBookmarkManager::readBookmarkFile() {
    if (bookmarkfile.loadConfig(BOOKMARKFILE))
    {
        char bookmarkstring[BOOKMARKSTRINGLENGTH];
        strcpy(bookmarkstring, BOOKMARKSTRING);

        bookmarksmodified = false;
        bookmarks.clear();

        unsigned int bookmarkcount = bookmarkfile.getInt32("bookmarkcount", 0);

        if (bookmarkcount > MAXBOOKMARKS)
            bookmarkcount = MAXBOOKMARKS;

        while (bookmarkcount-- > 0)
        {
            std::string tmp = bookmarkstring;
            tmp += "name";
            std::string bookmarkname = bookmarkfile.getString(tmp, "");
            tmp = bookmarkstring;
            tmp += "url";
            std::string bookmarkurl = bookmarkfile.getString(tmp, "");
            tmp = bookmarkstring;
            tmp += "time";
            std::string bookmarktime = bookmarkfile.getString(tmp, "");

            bookmarks.push_back(CBookmark(bookmarkname, bookmarkurl, bookmarktime));

            bookmarkstring[BOOKMARKSTRINGMODIFICATIONPOINT]++;
        }
    }
    else
        bookmarkfile.clear();
}
Exemple #2
0
 bool MarkWatched(const CFileItem& item, const bool watched)
 {
     if (watched) {
         CFileItem temp(item);
         temp.SetProperty("original_listitem_url", item.GetPath());
         return SaveFileState(temp, CBookmark(), watched);
     }
     else {
         CLog::Log(LOGDEBUG, "UPNP: Marking video item %s as watched", item.GetPath().c_str());
         return InvokeUpdateObject(item.GetPath().c_str(), "<upnp:playCount>1</upnp:playCount>", "<upnp:playCount>0</upnp:playCount>");
     }
 }
//------------------------------------------------------------------------
void CBookmarkManager::readBookmarkFile() {
	if (bookmarkfile.loadConfig(BOOKMARKFILE))
	{
		bookmarksmodified = false;
		bookmarks.clear();

		unsigned int bookmarkcount = bookmarkfile.getInt32("bookmarkcount", 0);

		if (bookmarkcount > MAXBOOKMARKS)
			bookmarkcount = MAXBOOKMARKS;

		while (bookmarkcount-- > 0)
		{
			std::string bookmarkstring = "bookmark" + to_string(bookmarkcount) + ".";
			std::string bookmarkname = bookmarkfile.getString(bookmarkstring + "name", "");
			std::string bookmarkurl = bookmarkfile.getString(bookmarkstring + "url", "");
			std::string bookmarktime = bookmarkfile.getString(bookmarkstring + "time", "");
			bookmarks.push_back(CBookmark(bookmarkname, bookmarkurl, bookmarktime));
		}
	}
}
//------------------------------------------------------------------------
inline int CBookmarkManager::createBookmark (const std::string & name, const std::string & url, const std::string & time) {
	return addBookmark(CBookmark(name, url, time));
}