More robust updateTorrentMetadata fn

pull/6527/head
Chocobozzz 2024-07-11 08:07:30 +02:00
parent 5d62c3c1cb
commit c5fa9fe70e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 5 additions and 0 deletions

View File

@ -142,6 +142,11 @@ async function createTorrentAndSetInfoHashFromPath (
async function updateTorrentMetadata (videoOrPlaylist: MVideo | MStreamingPlaylistVideo, videoFile: MVideoFile) { async function updateTorrentMetadata (videoOrPlaylist: MVideo | MStreamingPlaylistVideo, videoFile: MVideoFile) {
const video = extractVideo(videoOrPlaylist) const video = extractVideo(videoOrPlaylist)
if (!videoFile.torrentFilename) {
logger.error(`Video file ${videoFile.filename} of video ${video.uuid} doesn't have a torrent file, skipping torrent metadata update`)
return
}
const oldTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, videoFile.torrentFilename) const oldTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, videoFile.torrentFilename)
if (!await pathExists(oldTorrentPath)) { if (!await pathExists(oldTorrentPath)) {