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

@ -178,7 +178,7 @@ startWeb relaxed optfile pathdepth s = go $ fromMaybe bad $ parseURI urlstring
pathmax <- liftIO $ fileNameLengthLimit "." pathmax <- liftIO $ fileNameLengthLimit "."
let file = flip fromMaybe optfile $ let file = flip fromMaybe optfile $
truncateFilePath pathmax $ sanitizeFilePath $ truncateFilePath pathmax $ sanitizeFilePath $
Quvi.pageTitle page ++ "." ++ Quvi.linkSuffix link Quvi.pageTitle page ++ "." ++ fromMaybe "m" (Quvi.linkSuffix link)
showStart "addurl" file showStart "addurl" file
next $ performQuvi relaxed urlstring (Quvi.linkUrl link) file next $ performQuvi relaxed urlstring (Quvi.linkUrl link) file
#else #else

View file

@ -196,7 +196,7 @@ performDownload opts cache todownload = case location todownload of
Just link -> do Just link -> do
let videourl = Quvi.linkUrl link let videourl = Quvi.linkUrl link
checkknown videourl $ checkknown videourl $
rundownload videourl ("." ++ Quvi.linkSuffix link) $ \f -> rundownload videourl ("." ++ fromMaybe "m" (Quvi.linkSuffix link)) $ \f ->
maybeToList <$> addUrlFileQuvi (relaxedOpt opts) quviurl videourl f maybeToList <$> addUrlFileQuvi (relaxedOpt opts) quviurl videourl f
#else #else
return False return False

View file

@ -30,7 +30,7 @@ data Page = Page
} deriving (Show) } deriving (Show)
data Link = Link data Link = Link
{ linkSuffix :: String { linkSuffix :: Maybe String
, linkUrl :: URLString , linkUrl :: URLString
} deriving (Show) } deriving (Show)
@ -43,7 +43,7 @@ instance FromJSON Page where
instance FromJSON Link where instance FromJSON Link where
parseJSON (Object v) = Link parseJSON (Object v) = Link
<$> v .: "file_suffix" <$> v .:? "file_suffix"
<*> v .: "url" <*> v .: "url"
parseJSON _ = mzero parseJSON _ = mzero
@ -53,7 +53,7 @@ parseEnum s = Page
<$> get "QUVI_MEDIA_PROPERTY_TITLE" <$> get "QUVI_MEDIA_PROPERTY_TITLE"
<*> ((:[]) <$> <*> ((:[]) <$>
( Link ( Link
<$> get "QUVI_MEDIA_STREAM_PROPERTY_CONTAINER" <$> Just <$> (get "QUVI_MEDIA_STREAM_PROPERTY_CONTAINER")
<*> get "QUVI_MEDIA_STREAM_PROPERTY_URL" <*> get "QUVI_MEDIA_STREAM_PROPERTY_URL"
) )
) )

3
debian/changelog vendored
View file

@ -32,6 +32,9 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
Closes: #698559 Closes: #698559
(fsck can still need to write to the repository if it find problems, (fsck can still need to write to the repository if it find problems,
but a successful fsck can be done read-only) but a successful fsck can be done read-only)
* 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.
* Dropped support for older versions of yesod, warp, and dbus than the ones * Dropped support for older versions of yesod, warp, and dbus than the ones
in Debian Jessie. in Debian Jessie.
* Switch from the obsolete dataenc library for base64 encoding to sandi. * Switch from the obsolete dataenc library for base64 encoding to sandi.