nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
geometry: make `BoxedArray` a subclass of `Array`
[nit.git]
/
lib
/
mpd.nit
diff --git
a/lib/mpd.nit
b/lib/mpd.nit
index
97c38f2
..
b0d25d8
100644
(file)
--- a/
lib/mpd.nit
+++ b/
lib/mpd.nit
@@
-14,7
+14,7
@@
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
-# Client for a MPD server
+# Music Player Daemon client library
module mpd
import socket
module mpd
import socket
@@
-23,7
+23,7
@@
import socket
class MPDConnection
# Socket connection to server.
class MPDConnection
# Socket connection to server.
- var socket: nullable Socket = null
+ var socket: nullable TCPStream = null
# Server hostname.
var host: String
# Server hostname.
var host: String
@@
-40,9
+40,10
@@
class MPDConnection
# Connect to the MPD server
fun connect
do
# Connect to the MPD server
fun connect
do
- var p: nullable Socket = null
+ var p: nullable TCPStream = null
- p = new Socket.client(host, port)
+ p = new TCPStream.connect(host, port)
+ assert p.connected
sys.nanosleep(0,5000)
sys.nanosleep(0,5000)
@@
-129,7
+130,7
@@
class MPDConnection
var vol = status.volume
if vol != null then
var new_vol = vol + diff
var vol = status.volume
if vol != null then
var new_vol = vol + diff
- new_vol = new_vol.max(0).min(100)
+ new_vol = new_vol.clamp(0, 100)
volume = new_vol
return
end
volume = new_vol
return
end