diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-05-08 13:39:00 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-05-08 13:39:00 -0400 |
commit | 88ee184494c8c51d2c00d5c1e195eebc9f472b7d (patch) | |
tree | f2e4280a23adbfe01a5e66047440a6f24a2d7448 | |
parent | ddb66a7f8d1bd2ce626522d1d2af97e1ae5cde12 (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.
-rw-r--r-- | Command/AddUrl.hs | 2 | ||||
-rw-r--r-- | Command/ImportFeed.hs | 2 | ||||
-rw-r--r-- | Utility/Quvi.hs | 6 | ||||
-rw-r--r-- | debian/changelog | 3 |
4 files changed, 8 insertions, 5 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index 5defc52d9..6474f2614 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -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 diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs index 2a278dea1..379350c80 100644 --- a/Command/ImportFeed.hs +++ b/Command/ImportFeed.hs @@ -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 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" ) ) diff --git a/debian/changelog b/debian/changelog index fc7fcd46c..e677334df 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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. |