You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
|
2 years ago
|
package tv.anypoint.proxy.shell
|
||
|
|
|
||
|
|
import mu.KLogging
|
||
|
|
import org.springframework.shell.standard.ShellComponent
|
||
|
|
import org.springframework.shell.standard.ShellMethod
|
||
|
|
import tv.anypoint.proxy.service.StbService
|
||
|
|
|
||
|
|
@ShellComponent
|
||
|
|
class ShellController(
|
||
|
|
private val stbService: StbService
|
||
|
|
) {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 채널 변경
|
||
|
|
*/
|
||
|
|
@ShellMethod
|
||
|
|
fun ch(channelNumber: String) {
|
||
|
|
stbService.changeChannelNumber(channelNumber)
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* STB 에 접속
|
||
|
|
* ip, port 지정하지 않을 경우 설정된 STB 에 접속
|
||
|
|
*/
|
||
|
|
@ShellMethod
|
||
|
|
fun start(
|
||
|
|
restart: Boolean = false,
|
||
|
|
ip: String? = null,
|
||
|
|
port: Int? = null
|
||
|
|
) {
|
||
|
|
when {
|
||
|
|
ip == null && port == null -> stbService.start(restartStb = restart)
|
||
|
|
ip != null && port != null -> stbService.start(restartStb = restart, serverIp = ip, serverPort = port)
|
||
|
|
ip != null && port == null -> stbService.start(restartStb = restart, serverIp = ip)
|
||
|
|
ip == null && port != null -> stbService.start(restartStb = restart, serverPort = port)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
companion object : KLogging()
|
||
|
|
}
|