]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-file.ts
Avoid error when file has no torrent file
[github/Chocobozzz/PeerTube.git] / server / models / video / video-file.ts
index 1ad79610414088d34b3221fd6c50ad23002a9777..0b5946149fb617334ad3751ec4d4b3f0121f1ed2 100644 (file)
@@ -401,6 +401,10 @@ export class VideoFileModel extends Model {
     return VideoFileModel.destroy(options)
   }
 
+  hasTorrent () {
+    return this.infoHash && this.torrentFilename
+  }
+
   getVideoOrStreamingPlaylist (this: MVideoFileVideo | MVideoFileStreamingPlaylistVideo): MVideo | MStreamingPlaylistVideo {
     if (this.videoId) return (this as MVideoFileVideo).Video