You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
895 B
37 lines
895 B
7 months ago
|
#pragma once
|
||
|
#include "ParseArgs.h"
|
||
|
#include "cache.h"
|
||
|
#include "curlfuncs.h"
|
||
|
#include "mdatetime.h"
|
||
|
#include <json/json.h>
|
||
|
|
||
|
using michlib::MDateTime;
|
||
|
using michlib::MString;
|
||
|
|
||
|
class COPERNICUSData
|
||
|
{
|
||
|
static const MString caturl;
|
||
|
|
||
|
std::unique_ptr<GenericCache> cache;
|
||
|
CURLRAII chandle;
|
||
|
Json::Value catalog;
|
||
|
char curlerr[CURL_ERROR_SIZE];
|
||
|
|
||
|
// Get url for product or dataset from catalog
|
||
|
static MString ReadURL(const Json::Value& cat, const MString& prod);
|
||
|
|
||
|
// Download JSON from url
|
||
|
std::pair<Json::Value, MString> GetJSON(const MString& url);
|
||
|
|
||
|
// Get remote file list from url
|
||
|
std::pair<std::vector<struct FileInfo>,MString> ReadRemoteFileList(const MString& url);
|
||
|
|
||
|
public:
|
||
|
static constexpr const char* name = "COPERNICUS";
|
||
|
|
||
|
COPERNICUSData() = default;
|
||
|
|
||
|
// Main mirror function
|
||
|
MString Mirror(const CLArgs& args);
|
||
|
};
|