aboutsummaryrefslogtreecommitdiff
path: root/Types
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-11-29 15:49:05 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-11-29 16:40:32 -0400
commit3b3f7512f6d0b91de21f6fcc4aba8897174bc4a8 (patch)
tree44c85fda3d6a35d62b00cca26bf6acaf474133c2 /Types
parentb7178922644c813a2cb69c185ca751aa234fa05b (diff)
youtube-dl working
Including resuming and cleanup of incomplete downloads. Still todo: --fast, --relaxed, importfeed, disk reserve checking, quvi code cleanup. This commit was sponsored by Anthony DeRobertis on Patreon.
Diffstat (limited to 'Types')
-rw-r--r--Types/GitConfig.hs4
-rw-r--r--Types/Transfer.hs25
2 files changed, 27 insertions, 2 deletions
diff --git a/Types/GitConfig.hs b/Types/GitConfig.hs
index 05b5623a6..9a48ad173 100644
--- a/Types/GitConfig.hs
+++ b/Types/GitConfig.hs
@@ -67,7 +67,7 @@ data GitConfig = GitConfig
, annexSyncContent :: Configurable Bool
, annexDebug :: Bool
, annexWebOptions :: [String]
- , annexQuviOptions :: [String]
+ , annexYoutubeDlOptions :: [String]
, annexAriaTorrentOptions :: [String]
, annexWebDownloadCommand :: Maybe String
, annexCrippledFileSystem :: Bool
@@ -127,7 +127,7 @@ extractGitConfig r = GitConfig
getmaybebool (annex "synccontent")
, annexDebug = getbool (annex "debug") False
, annexWebOptions = getwords (annex "web-options")
- , annexQuviOptions = getwords (annex "quvi-options")
+ , annexYoutubeDlOptions = getwords (annex "youtube-dl-options")
, annexAriaTorrentOptions = getwords (annex "aria-torrent-options")
, annexWebDownloadCommand = getmaybe (annex "web-download-command")
, annexCrippledFileSystem = getbool (annex "crippledfilesystem") False
diff --git a/Types/Transfer.hs b/Types/Transfer.hs
index ade8fc763..73952c56e 100644
--- a/Types/Transfer.hs
+++ b/Types/Transfer.hs
@@ -5,9 +5,12 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE FlexibleInstances #-}
+
module Types.Transfer where
import Types
+import Types.Remote (Verification(..))
import Utility.PID
import Utility.QuickCheck
@@ -66,3 +69,25 @@ instance Arbitrary TransferInfo where
-- associated file cannot be empty (but can be Nothing)
<*> (AssociatedFile <$> arbitrary `suchThat` (/= Just ""))
<*> arbitrary
+
+class Observable a where
+ observeBool :: a -> Bool
+ observeFailure :: a
+
+instance Observable Bool where
+ observeBool = id
+ observeFailure = False
+
+instance Observable (Bool, Verification) where
+ observeBool = fst
+ observeFailure = (False, UnVerified)
+
+instance Observable (Either e Bool) where
+ observeBool (Left _) = False
+ observeBool (Right b) = b
+ observeFailure = Right False
+
+instance Observable (Either e (Maybe a)) where
+ observeBool (Right (Just _)) = True
+ observeBool _ = False
+ observeFailure = Right Nothing