Redundant code
This commit is contained in:
parent
e1a6f650fb
commit
3da21a7856
@ -1,11 +1,7 @@
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
|
||||||
|
|
||||||
import sharp from 'sharp'
|
import sharp from 'sharp'
|
||||||
import { Server } from 'socket.io'
|
|
||||||
|
|
||||||
import { BaseCommand } from '#application/base/baseCommand'
|
import { BaseCommand } from '#application/base/baseCommand'
|
||||||
import { commandLogger } from '#application/logger'
|
|
||||||
import { getPublicPath } from '#application/storage'
|
import { getPublicPath } from '#application/storage'
|
||||||
|
|
||||||
export default class TilesCommand extends BaseCommand {
|
export default class TilesCommand extends BaseCommand {
|
||||||
@ -23,7 +19,7 @@ export default class TilesCommand extends BaseCommand {
|
|||||||
// Check if tile is already 66x34
|
// Check if tile is already 66x34
|
||||||
const metadata = await sharp(getPublicPath('tiles', tile)).metadata()
|
const metadata = await sharp(getPublicPath('tiles', tile)).metadata()
|
||||||
if (metadata.width === 66 && metadata.height === 34) {
|
if (metadata.width === 66 && metadata.height === 34) {
|
||||||
commandLogger.info(`Tile ${tile} already processed`)
|
this.logger.info(`Tile ${tile} already processed`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +40,7 @@ export default class TilesCommand extends BaseCommand {
|
|||||||
fs.unlinkSync(inputPath)
|
fs.unlinkSync(inputPath)
|
||||||
fs.renameSync(tempPath, inputPath)
|
fs.renameSync(tempPath, inputPath)
|
||||||
|
|
||||||
commandLogger.info(`Processed and replaced: ${tile}`)
|
this.logger.info(`Processed and replaced: ${tile}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error processing ${tile}:`, error)
|
console.error(`Error processing ${tile}:`, error)
|
||||||
// Clean up temp file if it exists
|
// 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.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user