Copyright | This file is part of the package vimeta. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at: https://github.com/pjones/vimeta No part of this package including this file may be copied modified propagated or distributed except according to the terms contained in the LICENSE file. |
---|---|
License | BSD-2-Clause |
Safe Haskell | None |
Language | Haskell2010 |
Utility functions for downloading files.
Documentation
withArtwork :: MonadIO m => [Text] -> (Maybe FilePath -> Vimeta IO a) -> Vimeta m a Source #
Try to download artwork and run the given function. The
function will be passed a FilePath
if the artwork was downloaded.
See the withDownload
function for more details.
:: MonadIO m | |
=> Maybe Text | URL. |
-> (Maybe FilePath -> Vimeta IO a) | Function to call and pass the file name to. |
-> Vimeta m a | Result of above function. |
Download the given URL to a temporary file and pass the file name to the given function.
The reason a function needs to be passed to withDownload
is the
result of using withSystemTempFile
to store the downloaded file.
The file will be automatically removed after the given function
completes.