summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-10 20:33:24 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-10 20:33:24 +0100
commit10e13df00d618c408d4772920e7bc64efc8df174 (patch)
treec0e82d74e96a66036792b70e6c87db85c7430988 /logic
parent1b185eba41319be846eed07efb1e90d8b6d9e9aa (diff)
downloadMultiMC-10e13df00d618c408d4772920e7bc64efc8df174.tar
MultiMC-10e13df00d618c408d4772920e7bc64efc8df174.tar.gz
MultiMC-10e13df00d618c408d4772920e7bc64efc8df174.tar.lz
MultiMC-10e13df00d618c408d4772920e7bc64efc8df174.tar.xz
MultiMC-10e13df00d618c408d4772920e7bc64efc8df174.zip
Use metacache for minecraft.jar downloads
Diffstat (limited to 'logic')
-rw-r--r--logic/LegacyUpdate.cpp18
-rw-r--r--logic/OneSixUpdate.cpp21
2 files changed, 24 insertions, 15 deletions
diff --git a/logic/LegacyUpdate.cpp b/logic/LegacyUpdate.cpp
index fa3fd240..60dde3e8 100644
--- a/logic/LegacyUpdate.cpp
+++ b/logic/LegacyUpdate.cpp
@@ -261,16 +261,20 @@ void LegacyUpdate::jarStart()
// Build a list of URLs that will need to be downloaded.
setStatus("Downloading new minecraft.jar");
- QString urlstr("http://s3.amazonaws.com/Minecraft.Download/versions/");
- QString intended_version_id = inst->intendedVersionId();
- urlstr += intended_version_id + "/" + intended_version_id + ".jar";
+ QString version_id = inst->intendedVersionId();
+ QString localPath = version_id + "/" + version_id + ".jar";
+ QString urlstr = "http://s3.amazonaws.com/Minecraft.Download/versions/" + localPath;
- auto dljob = new NetJob("Minecraft.jar for version " + intended_version_id);
- dljob->addNetAction(MD5EtagDownload::make(QUrl(urlstr), inst->defaultBaseJar()));
- legacyDownloadJob.reset(dljob);
+ auto dljob = new NetJob("Minecraft.jar for version " + version_id);
+
+
+ auto metacache = MMC->metacache();
+ auto entry = metacache->resolveEntry("versions", localPath);
+ dljob->addNetAction(CacheDownload::make(QUrl(urlstr), entry));
connect(dljob, SIGNAL(succeeded()), SLOT(jarFinished()));
connect(dljob, SIGNAL(failed()), SLOT(jarFailed()));
connect(dljob, SIGNAL(progress(qint64, qint64)), SIGNAL(progress(qint64, qint64)));
+ legacyDownloadJob.reset(dljob);
legacyDownloadJob->start();
}
@@ -482,4 +486,4 @@ void LegacyUpdate::ModTheJar()
// inst->UpdateVersion(true);
emitSucceeded();
return;
-} \ No newline at end of file
+}
diff --git a/logic/OneSixUpdate.cpp b/logic/OneSixUpdate.cpp
index feaba6a5..44314e1e 100644
--- a/logic/OneSixUpdate.cpp
+++ b/logic/OneSixUpdate.cpp
@@ -290,17 +290,22 @@ void OneSixUpdate::jarlibStart()
return;
}
+ // Build a list of URLs that will need to be downloaded.
std::shared_ptr<OneSixVersion> version = inst->getFullVersion();
+ // minecraft.jar for this version
+ {
+ QString version_id = version->id;
+ QString localPath = version_id + "/" + version_id + ".jar";
+ QString urlstr = "http://s3.amazonaws.com/Minecraft.Download/versions/" + localPath;
- // download the right jar, save it in versions/$version/$version.jar
- QString urlstr("http://s3.amazonaws.com/Minecraft.Download/versions/");
- urlstr += version->id + "/" + version->id + ".jar";
- QString targetstr("versions/");
- targetstr += version->id + "/" + version->id + ".jar";
+ auto job = new NetJob("Libraries for instance " + inst->name());
- auto job = new NetJob("Libraries for instance " + inst->name());
- job->addNetAction(MD5EtagDownload::make(QUrl(urlstr), targetstr));
- jarlibDownloadJob.reset(job);
+ auto metacache = MMC->metacache();
+ auto entry = metacache->resolveEntry("versions", localPath);
+ job->addNetAction(CacheDownload::make(QUrl(urlstr), entry));
+
+ jarlibDownloadJob.reset(job);
+ }
auto libs = version->getActiveNativeLibs();
libs.append(version->getActiveNormalLibs());