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 "."
let file = flip fromMaybe optfile $
truncateFilePath pathmax $ sanitizeFilePath $
Quvi.pageTitle page ++ "." ++ Quvi.linkSuffix link
Quvi.pageTitle page ++ "." ++ fromMaybe "m" (Quvi.linkSuffix link)
showStart "addurl" file
next $ performQuvi relaxed urlstring (Quvi.linkUrl link) file
#else

View file

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

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

3
debian/changelog vendored
View file

@ -32,6 +32,9 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
Closes: #698559
(fsck can still need to write to the repository if it find problems,
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
in Debian Jessie.
* Switch from the obsolete dataenc library for base64 encoding to sandi.