packages feed

XMMS-0.1: example/tut2.hs

import System
import Network.XMMS.Playback
import Network.XMMS.Client
import Prelude hiding (init)

main = do
    connection <- init "tutorial2"
    xmmsPath <- catch (getEnv "XMMS_PATH") 
                      (\e -> return "")
    connectRes <- connect connection xmmsPath
    if connectRes == 0 then do
        errorMsg <- getLastError connection
        putStrLn $ "Connection failed: " ++ errorMsg
     else do
        result <- currentID connection
        resultWait result
        returnValue <- resultGetValue result
        case returnValue of
            XMMSError msg -> putStrLn $ "playback start returned error: " ++ msg
            XMMSInt id -> putStrLn $ "playing track with ID:" ++ show id
            _ -> return ()