+function update (servers, numServer, callback) {
+ if (!callback) callback = function () {}
+
+ videosUtils.getVideosList(servers[numServer].url, function (err, res) {
+ if (err) throw err
+
+ const videos = res.body.data.filter(function (video) { return video.isLocal })
+ if (videos.length === 0) return callback()
+
+ const toUpdate = videos[getRandomInt(0, videos.length)].id
+ const name = Date.now() + ' name'
+ const description = Date.now() + ' description'
+ const tags = [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ]
+
+ console.log('Updating video of server ' + numServer)
+
+ videosUtils.updateVideo(servers[numServer].url, servers[numServer].accessToken, toUpdate, name, description, tags, callback)
+ })
+}
+