more robust fallback when a file is available from multiple torrents and some torrent files cannot be downloaded

This commit is contained in:
Joey Hess 2014-12-17 14:38:04 -04:00
parent 96721c3e4a
commit 2192c54877

View file

@ -77,16 +77,17 @@ downloadKey key _file dest p = do
get . map (torrentUrlNum . fst . getDownloader) =<< getBitTorrentUrls key get . map (torrentUrlNum . fst . getDownloader) =<< getBitTorrentUrls key
where where
get [] = do get [] = do
warning "no known torrent url" warning "could not download torrent"
return False return False
get urls = do get urls = do
showOutput -- make way for download progress bar showOutput -- make way for download progress bar
untilTrue urls $ \(u, filenum) -> do untilTrue urls $ \(u, filenum) -> do
registerTorrentCleanup u registerTorrentCleanup u
checkDependencies checkDependencies
unlessM (downloadTorrentFile u) $ ifM (downloadTorrentFile u)
error "could not download torrent file" ( downloadTorrentContent key u dest filenum p
downloadTorrentContent key u dest filenum p , return False
)
downloadKeyCheap :: Key -> FilePath -> Annex Bool downloadKeyCheap :: Key -> FilePath -> Annex Bool
downloadKeyCheap _ _ = return False downloadKeyCheap _ _ = return False