Compare commits
2 commits
19bf4b5288
...
301a6423db
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
301a6423db | ||
|
|
19701af4ec |
1 changed files with 38 additions and 19 deletions
57
cimp.bas
57
cimp.bas
|
|
@ -16,12 +16,15 @@ const key_up=1001
|
||||||
const key_down=1002
|
const key_down=1002
|
||||||
const key_right=1003
|
const key_right=1003
|
||||||
const key_left=1004
|
const key_left=1004
|
||||||
|
dim slash as string
|
||||||
|
slash="/"
|
||||||
$if win then
|
$if win then
|
||||||
shell"chcp 65001 > nul"
|
shell"chcp 65001 > nul"
|
||||||
|
slash="\"
|
||||||
$end if
|
$end if
|
||||||
|
|
||||||
redim file(0) as string
|
redim file(0) as string
|
||||||
|
chdir _startdir$
|
||||||
if command$=""then
|
if command$=""then
|
||||||
print"please specify file to play."
|
print"please specify file to play."
|
||||||
goto quit
|
goto quit
|
||||||
|
|
@ -34,20 +37,37 @@ if ipc_status = 0 then
|
||||||
' --- CLIENT MODE ---
|
' --- CLIENT MODE ---
|
||||||
dim cmd_msg as string
|
dim cmd_msg as string
|
||||||
|
|
||||||
if command$(1) = "--next" then
|
Select Case command$(1)
|
||||||
cmd_msg = "NEXT"
|
Case "--next"
|
||||||
elseif command$(1) = "--prev" then
|
cmd_msg = "NEXT"
|
||||||
cmd_msg = "PREV"
|
|
||||||
elseif command$(1) = "-v" or command$(1) = "--volume" then
|
Case "--prev"
|
||||||
cmd_msg = "VOL:" + command$(2)
|
cmd_msg = "PREV"
|
||||||
elseif command$(1) = "--add" then
|
|
||||||
cmd_msg = "ADD:" + get_abs_path(command$(2))
|
Case "-v", "--volume"
|
||||||
elseif command$(1) = "--playlist" then
|
cmd_msg = "VOL:" + command$(2)
|
||||||
cmd_msg = "GET_PLAYLIST"
|
|
||||||
else
|
Case "--add"
|
||||||
' Default behavior: Resolve target file/playlist and replace active queue
|
For i = 2 To _commandcount
|
||||||
cmd_msg = "PLAY:" + get_abs_path(command$(1))
|
cmd_msg = "ADD:" + _cwd$ + slash + command$(i)
|
||||||
end if
|
ipc_send_message cmd_msg
|
||||||
|
Next i
|
||||||
|
System
|
||||||
|
|
||||||
|
Case "--playlist"
|
||||||
|
cmd_msg = "GET_PLAYLIST"
|
||||||
|
|
||||||
|
Case Else
|
||||||
|
' Default behavior: Resolve target file/playlist and replace active queue
|
||||||
|
cmd_msg = "PLAY:" + _cwd$ + slash + command$(1)
|
||||||
|
If _commandcount > 1 Then
|
||||||
|
For i = 2 To _commandcount
|
||||||
|
cmd_msg = "ADD:" + _cwd$ + slash + command$(i)
|
||||||
|
ipc_send_message cmd_msg
|
||||||
|
Next i
|
||||||
|
System
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
|
||||||
' Send instruction to the main player instance
|
' Send instruction to the main player instance
|
||||||
ipc_send_message cmd_msg
|
ipc_send_message cmd_msg
|
||||||
|
|
@ -88,7 +108,6 @@ end if
|
||||||
|
|
||||||
echooff
|
echooff
|
||||||
cursoroff
|
cursoroff
|
||||||
chdir _startdir$
|
|
||||||
|
|
||||||
dim volume as single
|
dim volume as single
|
||||||
dim repeat as integer
|
dim repeat as integer
|
||||||
|
|
@ -344,7 +363,7 @@ while keyin<>27
|
||||||
_sndvol musichandle, volume
|
_sndvol musichandle, volume
|
||||||
elseif left$(client_cmd, 4) = "ADD:" then
|
elseif left$(client_cmd, 4) = "ADD:" then
|
||||||
dim new_file as string
|
dim new_file as string
|
||||||
new_file = mid$(client_cmd, 5)
|
new_file = _trim$(mid$(client_cmd, 5))
|
||||||
if _fileexists(new_file) then
|
if _fileexists(new_file) then
|
||||||
if lcase$(right$(new_file, 4)) = ".m3u" then
|
if lcase$(right$(new_file, 4)) = ".m3u" then
|
||||||
parsem3u new_file, file()
|
parsem3u new_file, file()
|
||||||
|
|
@ -355,7 +374,7 @@ while keyin<>27
|
||||||
end if
|
end if
|
||||||
elseif left$(client_cmd, 5) = "PLAY:" then
|
elseif left$(client_cmd, 5) = "PLAY:" then
|
||||||
dim replace_file as string
|
dim replace_file as string
|
||||||
replace_file = mid$(client_cmd, 6)
|
replace_file = _trim$(mid$(client_cmd, 6))
|
||||||
if _fileexists(replace_file) then
|
if _fileexists(replace_file) then
|
||||||
redim file(0) as string
|
redim file(0) as string
|
||||||
if lcase$(right$(replace_file, 4)) = ".m3u" then
|
if lcase$(right$(replace_file, 4)) = ".m3u" then
|
||||||
|
|
@ -363,7 +382,7 @@ while keyin<>27
|
||||||
else
|
else
|
||||||
file(0) = replace_file
|
file(0) = replace_file
|
||||||
end if
|
end if
|
||||||
i = 0
|
i = -1
|
||||||
playnext = 1
|
playnext = 1
|
||||||
end if
|
end if
|
||||||
elseif client_cmd = "GET_PLAYLIST" then
|
elseif client_cmd = "GET_PLAYLIST" then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue