mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Improve prune script
This commit is contained in:
@@ -146,6 +146,38 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
|
||||
return VideoRedundancyModel.findOne(query)
|
||||
}
|
||||
|
||||
static async isLocalByVideoUUIDExists (uuid: string) {
|
||||
const actor = await getServerActor()
|
||||
|
||||
const query = {
|
||||
raw: true,
|
||||
attributes: [ 'id' ],
|
||||
where: {
|
||||
actorId: actor.id
|
||||
},
|
||||
include: [
|
||||
{
|
||||
attributes: [ ],
|
||||
model: VideoFileModel,
|
||||
required: true,
|
||||
include: [
|
||||
{
|
||||
attributes: [ ],
|
||||
model: VideoModel,
|
||||
required: true,
|
||||
where: {
|
||||
uuid
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
return VideoRedundancyModel.findOne(query)
|
||||
.then(r => !!r)
|
||||
}
|
||||
|
||||
static async getVideoSample (p: Bluebird<VideoModel[]>) {
|
||||
const rows = await p
|
||||
const ids = rows.map(r => r.id)
|
||||
|
||||
Reference in New Issue
Block a user