lord 2.20140625 → 2.20150122
raw patch · 4 files changed
+20/−14 lines, 4 filesdep ~libmpddep ~optparse-applicativePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: libmpd, optparse-applicative
API changes (from Hackage documentation)
- Web.Radio: class FromJSON a => Radio a where data family Param a :: * reportRequired _ = False report _ _ = return () reportLoop param x = do { time <- liftM stTime <$> withMPD status; case time of { Right (elapsed, _) -> if elapsed < 30 then threadDelay (5 * 1000000) >> reportLoop param x else report param x Left err -> print err } } play logger reqData xxs = do { st <- withMPD status; case st of { Right _ -> playWithMPD logger reqData xxs Left _ -> playWithMplayer logger reqData xxs } }
+ Web.Radio: class FromJSON a => Radio a where data family Param a :: * reportRequired _ = False report _ _ = return () reportLoop param x = do { time <- liftM stTime <$> withMPD status; case time of { Right (Just (elapsed, _)) -> if elapsed < 30 then threadDelay (5 * 1000000) >> reportLoop param x else report param x Right Nothing -> return () Left err -> print err } } play logger reqData xxs = do { st <- withMPD status; case st of { Right _ -> playWithMPD logger reqData xxs Left _ -> playWithMplayer logger reqData xxs } }
Files
- CHANGELOG +4/−0
- Web/Radio.hs +5/−4
- lord.cabal +7/−7
- main.hs +4/−3
CHANGELOG view
@@ -1,5 +1,9 @@ CHANGELOG +2.20140625 -> 2.20150122+ - Update to libmpd-0.9+ - Update to optpare-applicative-0.11+ 2.20140324 -> 2.20140625 - Update to optpare-applicative-0.8 - Fix 8tracks.com api
Web/Radio.hs view
@@ -20,11 +20,11 @@ import Control.Monad (liftM, when, void) import Data.Aeson hiding (encode) import qualified Data.ByteString as B-import qualified Data.ByteString.Char8 as C import Data.Maybe (isJust, fromJust) import Data.Monoid ((<>))+import Data.String (fromString) import Data.Yaml-import Network.MPD hiding (play, pause, Value)+import Network.MPD hiding (play, pause, config, Value) import qualified Network.MPD as MPD import Network.MPD.Core (getResponse) import Network.Wai.Logger (ZonedDate, clockDateCacher)@@ -70,10 +70,11 @@ reportLoop param x = do time <- liftM stTime <$> withMPD status case time of- Right (elapsed, _) ->+ Right (Just (elapsed, _)) -> if elapsed < 30 then threadDelay (5*1000000) >> reportLoop param x else report param x+ Right Nothing -> return () Left err -> print err play :: LoggerSet -> Param a -> [a] -> IO ()@@ -92,7 +93,7 @@ print surl when (surl /= "") $ do logAndReport logger reqData x- mpdLoad $ Path $ C.pack surl+ mpdLoad $ fromString surl takeMVar eof -- Finished playWithMPD logger reqData xs where
lord.cabal view
@@ -1,5 +1,5 @@ name: lord-version: 2.20140625+version: 2.20150122 synopsis: A command line interface to online radios. description: A unified command line interface to several online radios, use mpd (<http://musicpd.org>) as backend by default. Will fallback to mplayer (<http://www.mplayerhq.hu>) when mpd is unavailable.@@ -47,7 +47,7 @@ category: Web, Music build-type: Simple cabal-version: >=1.10-tested-with: GHC == 7.8.2+tested-with: GHC == 7.8.3 data-files: bash_completion.d/lord extra-source-files: CHANGELOG @@ -71,7 +71,7 @@ HTTP >= 4000.2, http-conduit >= 1.9, http-types >= 0.8,- libmpd >= 0.8,+ libmpd >= 0.9, process >= 1.1, resourcet >= 1.1, text >= 0.11,@@ -112,8 +112,8 @@ HTTP >= 4000.2, http-conduit >= 1.9, http-types >= 0.8,- libmpd >= 0.8,- optparse-applicative >= 0.8,+ libmpd >= 0.9,+ optparse-applicative >= 0.11, process >= 1.1, resourcet >= 1.1, text >= 0.11,@@ -148,8 +148,8 @@ http-conduit >= 1.9, http-types >= 0.8, HUnit >= 1.2,- libmpd >= 0.8,- optparse-applicative >= 0.5,+ libmpd >= 0.9,+ optparse-applicative >= 0.11, process >= 1.1, text >= 0.11, transformers >= 0.3,
main.hs view
@@ -3,6 +3,7 @@ import Network.MPD (withMPD, clear, status, stState) import Network.MPD.Commands.Extensions (toggle) import Options.Applicative+import Options.Applicative.Help.Types (renderHelp) import System.Directory (createDirectoryIfMissing) import System.Environment (getArgs, getProgName) import System.Exit (exitWith, exitSuccess, ExitCode(..))@@ -135,10 +136,10 @@ Success a -> return a Failure failure -> do progn <- getProgName- let (msg, exit) = execFailure failure progn+ let (h, exit, cols) = execFailure failure progn case exit of- ExitSuccess -> putStrLn msg- _ -> hPutStrLn stderr msg+ ExitSuccess -> putStrLn $ renderHelp cols h+ _ -> hPutStrLn stderr $ renderHelp cols h exitWith exit CompletionInvoked compl -> do progn <- getProgName