summaryrefslogtreecommitdiff
path: root/Utility/Quvi.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-05-08 13:39:00 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-05-08 13:39:00 -0400
commit88ee184494c8c51d2c00d5c1e195eebc9f472b7d (patch)
treef2e4280a23adbfe01a5e66047440a6f24a2d7448 /Utility/Quvi.hs
parentddb66a7f8d1bd2ce626522d1d2af97e1ae5cde12 (diff)
Improve quvi 0.4 output parsing to handle cases wher there is no known filename extension. This is currently the case when using quvi with youtube. In this case, the extension ".m" will be used.
Diffstat (limited to 'Utility/Quvi.hs')
-rw-r--r--Utility/Quvi.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Utility/Quvi.hs b/Utility/Quvi.hs
index 0669e7351..4dc15fe92 100644
--- a/Utility/Quvi.hs
+++ b/Utility/Quvi.hs
@@ -30,7 +30,7 @@ data Page = Page
} deriving (Show)
data Link = Link
- { linkSuffix :: String
+ { linkSuffix :: Maybe String
, linkUrl :: URLString
} deriving (Show)
@@ -43,7 +43,7 @@ instance FromJSON Page where
instance FromJSON Link where
parseJSON (Object v) = Link
- <$> v .: "file_suffix"
+ <$> v .:? "file_suffix"
<*> v .: "url"
parseJSON _ = mzero
@@ -53,7 +53,7 @@ parseEnum s = Page
<$> get "QUVI_MEDIA_PROPERTY_TITLE"
<*> ((:[]) <$>
( Link
- <$> get "QUVI_MEDIA_STREAM_PROPERTY_CONTAINER"
+ <$> Just <$> (get "QUVI_MEDIA_STREAM_PROPERTY_CONTAINER")
<*> get "QUVI_MEDIA_STREAM_PROPERTY_URL"
)
)