vimeta-0.3.0.1: Frontend for video metadata tagging tools
CopyrightThis 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.
LicenseBSD-2-Clause
Safe HaskellNone
LanguageHaskell2010

Vimeta.Core.Download

Description

Utility functions for downloading files.

Synopsis

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.

withDownload Source #

Arguments

:: 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.