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.

This commit is contained in:
Joey Hess 2015-05-08 13:39:00 -04:00
parent 54bee7dad4
commit f395ca7a41
4 changed files with 8 additions and 5 deletions

View file

@ -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"
)
)