summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpiotrborek <>2018-04-16 13:29:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-04-16 13:29:00 (GMT)
commitc7c8baede0126444c455765e547c0745976a70b4 (patch)
tree1edfe09113ebe84376e418bdb23cd6aebe19ba1c
parent8f9cdb2c640147ff8c3bdc31faea85ce7089f1d1 (diff)
version 1.0.2HEAD1.0.2master
-rw-r--r--mp.cabal2
-rw-r--r--src/Mp/UI/QueuePage.hs24
2 files changed, 18 insertions, 8 deletions
diff --git a/mp.cabal b/mp.cabal
index 5cffa4c..ce9cdb3 100644
--- a/mp.cabal
+++ b/mp.cabal
@@ -1,5 +1,5 @@
name: mp
-version: 1.0.1
+version: 1.0.2
cabal-version: >=1.22
build-type: Simple
author: Piotr Borek <piotrborek@op.pl>
diff --git a/src/Mp/UI/QueuePage.hs b/src/Mp/UI/QueuePage.hs
index da88d69..5722a45 100644
--- a/src/Mp/UI/QueuePage.hs
+++ b/src/Mp/UI/QueuePage.hs
@@ -28,9 +28,10 @@ module Mp.UI.QueuePage (
queuePageNew
) where
-import Control.Lens (ix, makeLensesFor, (.=), (^.), (^?))
+import Control.Lens (ix, makeLensesFor, (.=), (^.), (^?))
import Control.Monad
-import qualified Graphics.Vty as Vty
+import Control.Monad.Catch
+import qualified Graphics.Vty as Vty
import Simple.UI.All
import Mp.Player.Client
@@ -157,11 +158,20 @@ queuePageNew = do
return queue
where
- readFullStatusFromServer queuePage = catchIgnoreAll $ do
- items <- clientSendGetPlaylist
- index <- clientSendGetPlaying
- set queuePage _queuePageSongIndex index
- mpSongInit items
+ readFullStatusFromServer = readFullStatusFromServer' (100 :: Int)
+
+ readFullStatusFromServer' 0 _ = return ()
+ readFullStatusFromServer' counter queuePage =
+ catchAll
+ (do
+ items <- clientSendGetPlaylist
+ index <- clientSendGetPlaying
+ set queuePage _queuePageSongIndex index
+ mpSongInit items)
+ (\_ -> do
+ mpData <- view appUserData
+ mainScheduleAfter 100 $
+ liftUIApp mpData $ readFullStatusFromServer' (counter - 1) queuePage)
scheduleIndexFromServer queuePage = mainScheduleRepeat 200 $
catchIgnoreAll $ do