summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-08-22 18:25:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-08-22 18:50:43 -0400
commitd40c7ca41b64013c76ce33e516579dbeae35744f (patch)
tree454bf4e4e52137d9a789c469829307560a8bf0d3 /Logs
parentb485fa17ab070eaeb0501e2b249326056798f183 (diff)
Youtube support! (And 53 other video hosts)
When quvi is installed, git-annex addurl automatically uses it to detect when an page is a video, and downloads the video file. web special remote: Also support using quvi, for getting files, or checking if files exist in the web. This commit was sponsored by Mark Hepburn. Thanks!
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Web.hs22
1 files changed, 21 insertions, 1 deletions
diff --git a/Logs/Web.hs b/Logs/Web.hs
index cbce7a36e..44d511267 100644
--- a/Logs/Web.hs
+++ b/Logs/Web.hs
@@ -13,7 +13,10 @@ module Logs.Web (
setUrlMissing,
urlLog,
urlLogKey,
- knownUrls
+ knownUrls,
+ Downloader(..),
+ getDownloader,
+ setDownloader,
) where
import qualified Data.ByteString.Lazy.Char8 as L
@@ -101,3 +104,20 @@ knownUrls = do
where
geturls Nothing = return []
geturls (Just logsha) = getLog . L.unpack <$> catObject logsha
+
+data Downloader = DefaultDownloader | QuviDownloader
+ deriving (Eq)
+
+{- Determines the downloader for an URL.
+ -
+ - Some URLs are not downloaded by normal means, and this is indicated
+ - by prefixing them with downloader: when they are recorded in the url
+ - logs. -}
+getDownloader :: URLString -> (URLString, Downloader)
+getDownloader u = case separate (== ':') u of
+ ("quvi", u') -> (u', QuviDownloader)
+ _ -> (u, DefaultDownloader)
+
+setDownloader :: URLString -> Downloader -> URLString
+setDownloader u DefaultDownloader = u
+setDownloader u QuviDownloader = "quvi:" ++ u