1
0
forked from noxious/server

Redundant code

This commit is contained in:
Dennis Postma 2024-12-28 20:41:53 +01:00
parent e1a6f650fb
commit 3da21a7856

View File

@ -1,11 +1,7 @@
import fs from 'fs'
import path from 'path'
import sharp from 'sharp'
import { Server } from 'socket.io'
import { BaseCommand } from '#application/base/baseCommand'
import { commandLogger } from '#application/logger'
import { getPublicPath } from '#application/storage'
export default class TilesCommand extends BaseCommand {
@ -23,7 +19,7 @@ export default class TilesCommand extends BaseCommand {
// Check if tile is already 66x34
const metadata = await sharp(getPublicPath('tiles', tile)).metadata()
if (metadata.width === 66 && metadata.height === 34) {
commandLogger.info(`Tile ${tile} already processed`)
this.logger.info(`Tile ${tile} already processed`)
continue
}
@ -44,7 +40,7 @@ export default class TilesCommand extends BaseCommand {
fs.unlinkSync(inputPath)
fs.renameSync(tempPath, inputPath)
commandLogger.info(`Processed and replaced: ${tile}`)
this.logger.info(`Processed and replaced: ${tile}`)
} catch (error) {
console.error(`Error processing ${tile}:`, error)
// Clean up temp file if it exists
@ -54,6 +50,6 @@ export default class TilesCommand extends BaseCommand {
}
}
commandLogger.info('Tile processing completed.')
this.logger.info('Tile processing completed.')
}
}