/src/main/scala/dk/mehmedbasic/audiobook/execution/ConversionCommandFactory.scala
Scala | 37 lines | 23 code | 8 blank | 6 comment | 0 complexity | d9569912494afa27b3b78be77060637e MD5 | raw file
- package dk.mehmedbasic.audiobook.execution
- import dk.mehmedbasic.audiobook.conversion.AudioConfig
- import java.io.File
- /**
- * Command factory creates commands based on OS.
- *
- * @author Jesenko Mehmedbasic
- * created 20-01-13, 00:16
- */
- class ConversionCommandFactory(
- system: OperatingSystem,
- inputFile: File,
- outputConfig: AudioConfig) extends CommandFactory(system) {
- val outputFile = File.createTempFile(System.nanoTime() + "", ".mp4")
- def getOutput = outputFile
- protected override def addParametersToCommand(command: Command) {
- command.addParameter("P", null)
- command.addParameter("C", outputConfig.channels)
- command.addParameter("R", outputConfig.sampleFrequency)
- command.addParameter("o", "\"" + outputFile.getAbsolutePath + "\"")
- command.addParameter("", null)
- }
- protected override def createWindowsCommand(): Command = {
- new Command("\"" + new File(".").getAbsolutePath + "\\external\\faac.exe\"")
- }
- protected override def createUnixCommand(): Command = {
- new Command("faac")
- }
- }