bool_t write_player_data(player_db_data_t *db_data) { write_db_file(&db_data->key_data, get_db_file(DB_FILE_KEYS)); write_db_file(&db_data->att_data, get_db_file(DB_FILE_ATTRIBUTES)); write_db_file(&db_data->career_data, get_db_file(DB_FILE_CAREER)); write_db_file(&db_data->season_data, get_db_file(DB_FILE_SEASON)); return TRUE; }
bool_t read_player_data(player_db_data_t *db_data) { if (!read_db_file(&db_data->key_data, get_db_file(DB_FILE_KEYS))) return FALSE; if (!read_db_file(&db_data->att_data, get_db_file(DB_FILE_ATTRIBUTES))) return FALSE; if (!read_db_file(&db_data->career_data, get_db_file(DB_FILE_CAREER))) return FALSE; if (!read_db_file(&db_data->season_data, get_db_file(DB_FILE_SEASON))) return FALSE; return TRUE; }
void VideoMetaCache::setValues(Entry& entry) { if(entry.mType == ERROR_TYPE) { DS_LOG_WARNING("Attempted to cache an invalid media (path=" << entry.mPath << ")"); return; } if(entry.mDuration < 0.0f) { DS_LOG_WARNING("Attempted to cache media with no duration (path=" << entry.mPath << ")"); return; } if(entry.mType == VIDEO_TYPE && (entry.mWidth < 1 || entry.mHeight < 1)) { DS_LOG_WARNING("Attempted to cache video with no size (path=" << entry.mPath << ", width=" << entry.mWidth << ", height=" << entry.mHeight << ")"); return; } try { const std::string db = get_db_file(mName); std::stringstream buf; buf << "SELECT id FROM video_meta WHERE path='" << entry.mPath << "'"; ds::query::Result ans; if (ds::query::Client::query(db, buf.str(), ans) && !ans.rowsAreEmpty()) { buf.str(""); buf << "UPDATE video_meta SET type='" << db_type_from_type(entry.mType) << "', width=" << entry.mWidth << ", height=" << entry.mHeight << ", duration=" << entry.mDuration << ", colorspace='" << entry.mDuration << "', videocodec='" << entry.mDuration << "', audiocodec='" << entry.mDuration << "' WHERE path='" << entry.mPath << "'"; ds::query::Client::queryWrite(db, buf.str(), ans); load(); return; } buf.str(""); buf << "INSERT INTO video_meta (type, path, width, height, duration, colorspace, videocodec, audiocodec) values ('" << db_type_from_type(entry.mType) << "', '" << entry.mPath << "', " << entry.mWidth << ", " << entry.mHeight << ", " << entry.mDuration << ", '" << entry.mColorSpace << "', '" << entry.mVideoCodec << "', '" << entry.mAudioCodec << "')"; ds::query::Client::queryWrite(db, buf.str(), ans); mEntries.push_back(entry); } catch (std::exception const&) { } //load(); }