jkoelndorfer / mccdl Goto Github PK
View Code? Open in Web Editor NEWA script to download modpacks from Minecraft CurseForge and create MultiMC instances for them.
License: GNU General Public License v3.0
A script to download modpacks from Minecraft CurseForge and create MultiMC instances for them.
License: GNU General Public License v3.0
hey,
is it possible to use this to download a modpack without it creating a multimc instance?
Instance creation can fail if the user's MultiMC configuration directory doesn't exist - in particular putting the icon file in place.
The modpacks on CurseForge have icons on their project page. It would be neat if we could pull that icon down and set it in newly created MultiMC instances.
Presently mccdl downloads a more recent version of a mod if it can't find a particular file ID as specified in the manifest. After some research, I found out that Curse's client is actually able to retrieve these (I used Fiddler to MITM my Curse client's traffic).
The basic mechanism is the client makes a request to https://addon-service.curse.com/AddOnService.svc, which is a Microsoft binary SOAP service endpoint (WSDL document: http://addon-service.curse.com/AddOnService.svc?wsdl).
There are some projects out there like the Curse REST Proxy that attempt to make this more accessible to non-.NET clients, but it would be nice to not need a third party service.
Another project of interest: https://github.com/khoad/msbingo
When I try to run it with the command:
./mccdl https://mods.curse.com/modpacks/minecraft/245163-ftb-presents-skyfactory-2-5 SkyFactory2.5
I get the following error:
INFO:mccdl.CurseForgeClient:Installing modpack 245163 in instance SkyFactory2.5, file ID latest
INFO:mccdl.CurseForgeProject:Fetching project 245163, file latest
Traceback (most recent call last):
File "./mccdl.py", line 525, in
MccdlCommandLineApplication().run(sys.argv[1:])
File "./mccdl.py", line 389, in run
action_method(project_id, file_id, args.instance_name)
File "./mccdl.py", line 73, in install_modpack
self._setup_modpack("install", project_id, file_id, instance_name)
File "./mccdl.py", line 92, in _setup_modpack
modpack_extract_dir = project.download_and_unpack_file(file_id)
File "./mccdl.py", line 142, in download_and_unpack_file
archive_path = self.download_file(file_id)
File "./mccdl.py", line 149, in download_file
file_path = self._client.downloader.download(self.file_url(file_id), destination)
File "./mccdl.py", line 279, in download
if os.path.exists(url_cache_path):
File "/home/aaron/MultiMC/mccdl-master/.venv/lib/python3.5/genericpath.py", line 19, in exists
os.stat(path)
TypeError: argument should be string, bytes or integer, not PosixPath
MultiMC version: 0.5.0-887
I have got all of the necessary python packages, and I have ran it with and without sudo
If the modpack manifest is busted and links to a nonexistent file, mccdl
fails. This might be appropriate, but I think we can be a little more resilient. Maybe determine what files are available for the failing project and grab the next highest one?
How to reproduce:
/mccdl --modpack-file-id 2402040 yonder yonder-1.2.0
Download Project Ozone 2's current release throws an error because MultiMC's Forge configuration for that version can't be found:
% ./mccdl 'https://mods.curse.com/modpacks/minecraft/244939-project-ozone-2-reloaded' "Project Ozone 2"
INFO:mccdl.CurseForgeClient:Installing modpack 244939 in instance Project Ozone 2, file ID latest
INFO:mccdl.CurseForgeProject:Fetching project 244939, file latest
INFO:mccdl.MultiMcInstance:Creating MultiMC instance Project Ozone 2, Minecraft version 1.7.10, Forge version 10.13.4.1614
Traceback (most recent call last):
File "./mccdl.py", line 525, in <module>
MccdlCommandLineApplication().run(sys.argv[1:])
File "./mccdl.py", line 389, in run
action_method(project_id, file_id, args.instance_name)
File "./mccdl.py", line 73, in install_modpack
self._setup_modpack("install", project_id, file_id, instance_name)
File "./mccdl.py", line 101, in _setup_modpack
setup_method(*setup_args)
File "./mccdl.py", line 437, in create
self.configure(minecraft_version, forge_version, icon_key=multimc_icon_key)
File "./mccdl.py", line 422, in configure
self._configure_instance_forge(minecraft_version, forge_version)
File "./mccdl.py", line 474, in _configure_instance_forge
patches_dir / "net.minecraftforge.json"
File "./mccdl.py", line 286, in download
cached_file_path = self._download(url)
File "./mccdl.py", line 303, in _download
response.raise_for_status()
File "/home/kdorf/src/mccdl/.venv/lib/python3.6/site-packages/requests/models.py", line 909, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://meta.multimc.org/net.minecraftforge/1.7.10-10.13.4.1614.json
This project really needs some tests.
Downloading of newer forge versions fails (log at [1]). This seems to happen because MultiMC does not include forge versions 14.23.2.* in the old API (v0) at [2]. Switching to the v1 API [3] fixes this. At a glance the only API difference is the removal of "parentUid": "net.minecraft", at the beginning of the JSON.
Modifying the URL at [4] fixes this. As a test I changed the URL and downloaded a recent (Modern Skyblock 3, did not work before), an older (Project Ozone 2 Reloaded) and an old (Agrarian Skies) modpack. All but the last work, the last one fails due to a missing mod (bdlib), but forge is downloaded correctly.
[1] https://gist.github.com/catt0/4c39942989d3bc99f0fab188294b2960
[2] https://meta.multimc.org/net.minecraftforge/
[3] https://v1.meta.multimc.org/net.minecraftforge/
[4] https://github.com/jkoelndorfer/mccdl/blob/master/mccdl.py#L410
P.S. thank you for the downloader, after this fix it works where the others I tried failed!
While trying to install a modpack (Project Ozone 2) I this error: https://pastebin.com/wRMPH80k.
This also happens with Sky Factory 2.5, which I also tried.
As discovered in #5, Python 3.4 and 3.5 standard libraries don't have great integration with pathlib. It's causing more headaches than anything, so it should be nixed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.