Expand checkurl to support recommended filename, and multi-file-urls
This commit was sponsored by an anonymous bitcoiner.
This commit is contained in:
parent
7ae16bb6f7
commit
2cd84fcc8b
18 changed files with 115 additions and 77 deletions
|
@ -25,6 +25,7 @@ import Types.UUID
|
|||
import Types.GitConfig
|
||||
import Types.Availability
|
||||
import Types.Creds
|
||||
import Types.UrlContents
|
||||
import Config.Cost
|
||||
import Utility.Metered
|
||||
import Git.Types
|
||||
|
@ -104,11 +105,10 @@ data RemoteA a = Remote {
|
|||
getInfo :: a [(String, String)],
|
||||
-- Some remotes can download from an url (or uri).
|
||||
claimUrl :: Maybe (URLString -> a Bool),
|
||||
-- Checks that the url is accessible, and gets the size of its
|
||||
-- content. Returns Nothing if the url is accessible, but
|
||||
-- its size cannot be determined inexpensively.
|
||||
-- Checks that the url is accessible, and gets information about
|
||||
-- its contents, without downloading the full content.
|
||||
-- Throws an exception if the url is inaccessible.
|
||||
checkUrl :: URLString -> a (Maybe Integer)
|
||||
checkUrl :: Maybe (URLString -> a UrlContents)
|
||||
}
|
||||
|
||||
instance Show (RemoteA a) where
|
||||
|
|
19
Types/UrlContents.hs
Normal file
19
Types/UrlContents.hs
Normal file
|
@ -0,0 +1,19 @@
|
|||
{- git-annex URL contents
|
||||
-
|
||||
- Copyright 2014 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Types.UrlContents where
|
||||
|
||||
import Utility.Url
|
||||
|
||||
data UrlContents
|
||||
-- An URL contains a file, whose size may be known.
|
||||
-- A default filename will be provided, and can be overridded
|
||||
-- or built on.
|
||||
= UrlContents (Maybe Integer) (FilePath -> FilePath)
|
||||
-- Sometimes an URL points to multiple files, each accessible
|
||||
-- by their own URL.
|
||||
| UrlNested [(URLString, UrlContents)]
|
Loading…
Add table
Add a link
Reference in a new issue