Represents a file managed by data::downloader.
Returns the storage path for this file. This is calculated using the md5, the disk, and the storage root of the repository associated with this file.
Download a file. This may be called as either a class method or an instance method. In the former case, it acts as a constructor, saving the object to the database.
Compute the URL if necessary. The URL may come from either an RSS feed (i.e. this file is already in the database) or may be computed using the url template.
# make a new file, download it, store it, update symlinks my $file = Data::Downloader::File->download( md5 => "a46cee6a6d8df570b0ca977b9e8c3097", filename => "OMI-Aura_L2-OMTO3_2007m0220t0052-o13831_v002-2007m0220t221310.he5", repository => "local_repo", ); # equivalent my $file = Data::Downloader::File->new( md5 => "a46cee6a6d8df570b0ca977b9e8c3097", filename => "OMI-Aura_L2-OMTO3_2007m0220t0052-o13831_v002-2007m0220t221310.he5", repository => Data::Downloader::Repository->new( name => "local_repo" )->load->id, ); $file->download or die $file->error; # download all files for a certain feed $_->download for $feed->files;
Parameters : repository - a repository name fake - fake the download? skip_links - Skip making symlinks? <name> - value : value for the variable "<name>" in the url_template.
true (1) - the file was downloaded or cached false (0) - there was an error (look in $obj->error for a message)
Put the links for a file within a single linktree. A tree may contain multiple symlinks for a file if there are metadata_transformations defined for this repository which transform a set of metadata into mutltiple sets of template parameters.
tree -- A DD::Linktree object
Make all the symlinks for a file by iterating through the linktrees and checking which satisfy the condition for the tree.
loads the representation of a file in the database.
filename -- filename to be pruned
Returns : reference to self on success
List all the symlinks for a file
Remove this file from the disk, set "on_disk" to false and remove any symlinks too.
Remove this file and any information stored about it.
Check a file and its symlinks and ensure that the database information represents what is stored on disk.
checksum -- if true, also compute the checksum fix -- if true, also attempt to fix anything broken
nothing, just produces warnings and errors
Remove all the symlinks for a file matching a particular regular expression.
regex -- a regex to match against.
false if a link could not be removed true if all links matching regex could be removed.
Load this object using the urn stored for it.