import { QueryTypes, Sequelize } from 'sequelize'
+import { forceNumber } from '@shared/core-utils'
import { AbstractCommand } from '../shared'
export class SQLCommand extends AbstractCommand {
if (!total) return 0
- return parseInt(total + '', 10)
+ return forceNumber(total)
}
getActorImage (filename: string) {
return seq.query(query, options)
}
+ // ---------------------------------------------------------------------------
+
setPluginField (pluginName: string, field: string, value: string) {
const seq = this.getSequelize()
return this.setPluginField(pluginName, 'latestVersion', newVersion)
}
+ // ---------------------------------------------------------------------------
+
+ async getPlaylistInfohash (playlistId: number) {
+ const result = await this.selectQuery('SELECT "p2pMediaLoaderInfohashes" FROM "videoStreamingPlaylist" WHERE id = ' + playlistId)
+ if (!result || result.length === 0) return []
+
+ return result[0].p2pMediaLoaderInfohashes
+ }
+
+ // ---------------------------------------------------------------------------
+
setActorFollowScores (newScore: number) {
const seq = this.getSequelize()
const dbname = 'peertube_test' + this.server.internalServerNumber
const username = 'peertube'
const password = 'peertube'
- const host = 'localhost'
+ const host = '127.0.0.1'
const port = 5432
this.sequelize = new Sequelize(dbname, username, password, {