diff options
author | sfan5 <sfan5@live.de> | 2020-06-13 19:03:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-13 19:03:26 +0200 |
commit | 2424dfe007e451bb02f87884c2b272cf307d6e7c (patch) | |
tree | de43d4ab42126b0533bf5955de3ce68f97f53420 /src/client/clientmedia.cpp | |
parent | 982a030f330bd4f4953ed7d4a7f88286f6fd645d (diff) | |
download | minetest-2424dfe007e451bb02f87884c2b272cf307d6e7c.tar.gz minetest-2424dfe007e451bb02f87884c2b272cf307d6e7c.tar.bz2 minetest-2424dfe007e451bb02f87884c2b272cf307d6e7c.zip |
Server pushing media at runtime (#9961)
Diffstat (limited to 'src/client/clientmedia.cpp')
-rw-r--r-- | src/client/clientmedia.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/clientmedia.cpp b/src/client/clientmedia.cpp index 6da99bbbf..8cd3b6bcc 100644 --- a/src/client/clientmedia.cpp +++ b/src/client/clientmedia.cpp @@ -35,6 +35,15 @@ static std::string getMediaCacheDir() return porting::path_cache + DIR_DELIM + "media"; } +bool clientMediaUpdateCache(const std::string &raw_hash, const std::string &filedata) +{ + FileCache media_cache(getMediaCacheDir()); + std::string sha1_hex = hex_encode(raw_hash); + if (!media_cache.exists(sha1_hex)) + return media_cache.update(sha1_hex, filedata); + return true; +} + /* ClientMediaDownloader */ @@ -559,7 +568,6 @@ bool ClientMediaDownloader::checkAndLoad( return true; } - /* Minetest Hashset File Format |