diff options
-rwxr-xr-x[-rw-r--r--] | installer.py | 0 | ||||
-rwxr-xr-x | modpackman.py | 3 | ||||
-rw-r--r-- | packs/jeffrey-2/icon.ico | bin | 0 -> 1662 bytes | |||
-rw-r--r-- | packs/jeffrey-2/icon.png | bin | 0 -> 1195 bytes | |||
-rw-r--r-- | packs/jeffrey-2/pack-lock.ini | 52 | ||||
-rw-r--r-- | packs/jeffrey-2/pack.ini | 54 | ||||
-rw-r--r-- | packs/jeffrey-2/version.txt | 48 | ||||
-rw-r--r-- | util.py | 50 |
8 files changed, 187 insertions, 20 deletions
diff --git a/installer.py b/installer.py index bdad7a6..bdad7a6 100644..100755 --- a/installer.py +++ b/installer.py diff --git a/modpackman.py b/modpackman.py index 69ebe41..e5e5fdc 100755 --- a/modpackman.py +++ b/modpackman.py @@ -85,6 +85,9 @@ def apply_updates(): print("Getting new versions of all mods...") mod_urls = util.find_updated_urls([x for x in config['mods'].values()], config['pack']['game_version'], threads=16) print("Downloading and checksumming all mods...") + if None in mod_urls: + print("[!] Checksum generation aborted due to invalid URLs. Please fix them and try again.") + exit(1) checksums = util.find_checksums(mod_urls) # Write the updated mods list out to pack-lock.ini diff --git a/packs/jeffrey-2/icon.ico b/packs/jeffrey-2/icon.ico Binary files differnew file mode 100644 index 0000000..0525305 --- /dev/null +++ b/packs/jeffrey-2/icon.ico diff --git a/packs/jeffrey-2/icon.png b/packs/jeffrey-2/icon.png Binary files differnew file mode 100644 index 0000000..0dfbb45 --- /dev/null +++ b/packs/jeffrey-2/icon.png diff --git a/packs/jeffrey-2/pack-lock.ini b/packs/jeffrey-2/pack-lock.ini new file mode 100644 index 0000000..abaf013 --- /dev/null +++ b/packs/jeffrey-2/pack-lock.ini @@ -0,0 +1,52 @@ +[global] +pack_version = 33 +config_files = + +[mod_versions] +twilightforest = 23521ca2f42916cc6fe112464b6647d91b0e22cb,https://media.forgecdn.net/files/2756/932/twilightforest-1.12.2-3.9.984-universal.jar +tconstruct = e37e1f05ad0eaf567497ce655bc877dc1778bd0f,https://media.forgecdn.net/files/2902/483/TConstruct-1.12.2-2.13.0.183.jar +baubles = cb13fcfb18a9cb0cbd825fd5fe8d813c77368549,https://media.forgecdn.net/files/2518/667/Baubles-1.12-1.5.2.jar +jei = 3e88d2896ca868c3cedb65e117ad3a1b82488fa8,https://media.forgecdn.net/files/3043/174/jei_1.12.2-4.16.1.302.jar +psi = c76503880249a7e92f99d0ef68637076c6844218,https://media.forgecdn.net/files/3085/917/Psi-r1.1-78.2.jar +opencomputers = 8eff5dc6b00a50b13ad6f3e6a838049bbf8306f8,https://media.forgecdn.net/files/2828/357/OpenComputers-MC1.12.2-1.7.5.192.jar +chisel-bits = 0e6f159254e6899651087e5b1464bac91698d1d3,https://media.forgecdn.net/files/2720/655/chiselsandbits-14.33.jar +chisel = 1dda45074e17128451b3c8f66172bfaddf84f443,https://media.forgecdn.net/files/2619/468/Chisel-MC1.12.2-0.2.1.35.jar +dynamictrees = 7598b342c7585a64ab57a1bb7348bc95114a7d75,https://media.forgecdn.net/files/2960/958/DynamicTrees-1.12.2-0.9.8.jar +dynamictrees-compat = 2e429e9705cb49afb72e2650001d003fd755ce42,https://media.forgecdn.net/files/2656/685/DynamicTreesPHC-1.12.2-1.4.2.jar +dynamictreestraverse = 19c1e2e6b9c6ee4a9a93b8b50969be7bb6e13011,https://f-1.karel.pw/dttraverse-1.4.1e.jar +traverse = b16aaff09a6e77ba193e42f88f5d5bb8a85e063a,https://media.forgecdn.net/files/2613/657/Traverse-1.12.2-1.6.0-69.jar +roots = f954f42522ad35355e5215caa0a8b61904f29cd2,https://media.forgecdn.net/files/3056/896/Roots-1.12.2-3.0.32.jar +ae2 = e5c3c11eafc5daf73652a2dabe855e3759caa8b5,https://media.forgecdn.net/files/2747/63/appliedenergistics2-rv6-stable-7.jar +gravestones = 3daa7d4563965f6ec1954c8176e11fa3ba0b85ee,https://media.forgecdn.net/files/2608/278/gravestone-1.10.2.jar +enderstorage = 7a872baf72b1da038704056a0cf7bbcc40bfa4d6,https://media.forgecdn.net/files/2755/787/EnderStorage-1.12.2-2.4.6.137-universal.jar +waila = 7280d5c0dab42436549bcefc63ff64a1049e5501,https://media.forgecdn.net/files/2568/751/Hwyla-1.8.26-B41_1.12.2.jar +harvestcraft = fb4df84de5f52125d0339b614787222b9ee45442,https://media.forgecdn.net/files/2751/199/Pam%27s%20HarvestCraft%201.12.2ze.jar +akashictome = b11bf9d93f4bd7a2eeb8cfe49c1b30ce1a2f5a37,https://media.forgecdn.net/files/2648/656/AkashicTome-1.2-12.jar +railcraft = ea2085a509b816bb9a3cdd79f2f44175b588737a,https://media.forgecdn.net/files/2687/757/railcraft-12.0.0.jar +optifine = e805d4be5c2a3343488c573145606e90bb13816d,https://karel.pw/optifine-1.12.2.jar +autoreglib = 267269ca7f1a71fb3bb35bdb8e61702a4da6263e,https://media.forgecdn.net/files/2746/11/AutoRegLib-1.3-32.jar +ctm = 03be3e20dacf6b52abcee09436b2d06c06f2add0,https://media.forgecdn.net/files/2642/375/CTM-MC1.12.2-0.3.3.22.jar +codechickenlib = b6a7e3b889c354216059a3bfad298e30a1e46a2d,https://media.forgecdn.net/files/2779/848/CodeChickenLib-1.12.2-3.2.3.358-universal.jar +mysticallib = cb8c57761ca503c7ca4985991106d5df5ae2dd1a,https://media.forgecdn.net/files/3040/592/mysticallib-1.12.2-1.9.0.jar +patchouli = 9804876a655365926757eda750189cd97b5bad69,https://media.forgecdn.net/files/2731/963/Patchouli-1.0-20.jar +mysticalworld = df31d6c6777ff03a643425fbb9114421e58aef95,https://media.forgecdn.net/files/3054/945/mysticalworld-1.12.2-1.9.2.jar +diet = 2aea3d9a64551cefe0a1b6f5c5edf57959796b66,https://media.forgecdn.net/files/2482/543/diethopper-1.1.jar +worsebarrels = bd81a26550b4dc107f6781768973b650b4ffd6f4,https://media.forgecdn.net/files/2729/49/worsebarrels-1.2.0.jar +wearable = 195614d96ebab5758605c7d89f95877bd2b7bbcc,https://media.forgecdn.net/files/2576/699/WearableBackpacks-1.12.2-3.1.3.jar +eerie-entities = 30713af2e103899250239cbdfd2f7afb75e29f81,https://media.forgecdn.net/files/2872/906/EerieEntities-1.12.2-1.0.8.jar +bookshelf = 83a1864dd78f48102609849dd36866d6cf32b907,https://media.forgecdn.net/files/2836/960/Bookshelf-1.12.2-2.3.590.jar +veining = a0dbc6ad8021c8fa2f7d00de8058499268000232,https://media.forgecdn.net/files/2578/505/veining-1.3.2-1.12.x.jar +minecoprocessors = aa953ffcfb6935669392c95cab68f552f9b1942c,https://media.forgecdn.net/files/2599/694/minecoprocessors-1.12.2-5.jar +librarianlib = f2e75d6899a26fe32b0b0ee2ad33c68a70bd91e6,https://media.forgecdn.net/files/3041/340/librarianlib-1.12.2-4.22.jar +forgelin = 7a87553fcb808a45d9c7e03f113b355ac7fd10d7,https://media.forgecdn.net/files/2785/465/Forgelin-1.8.4.jar +dimdoors = 30c939f2305b862ed70b2144912ba25418430c36,https://media.forgecdn.net/files/2558/528/DimensionalDoors-3.0.9-287.jar +translocators = b008cc099c15e0cb121c43c889504fc367b3dedd,https://media.forgecdn.net/files/2755/795/Translocators-1.12.2-2.5.2.81-universal.jar +forgemultipartcbe = 3306ea22380bc9b6a0170b23fa0251085d5a6e25,https://media.forgecdn.net/files/2755/790/ForgeMultipart-1.12.2-2.6.2.83-universal.jar +magneticraft = 1e32b4d2e0c38a3f129605ed945e55af19d17d13,https://media.forgecdn.net/files/2807/901/Magneticraft_1.12-2.8.2-dev.jar +ic2 = 43e4af33528087ac448b9fcb5b31c6a6cd3a10ce,https://media.forgecdn.net/files/3078/604/industrialcraft-2-2.8.221-ex112.jar +modelloader = 8f77152980cafb1be5a4204f5773daef74de8627,https://media.forgecdn.net/files/2744/735/modelloader-1.1.7.jar +mtlib = a4625a61c9ef53412e0e467d23f25c5543658677,https://media.forgecdn.net/files/2684/561/MTLib-3.0.6.jar +appleskin = 23162a97cab0adb4be2fc6d3937c613929d1d5c7,https://media.forgecdn.net/files/2496/585/AppleSkin-mc1.12-1.0.9.jar +mantle = a1e5d5c197dae3e92637cafb8cd996185191165b,https://media.forgecdn.net/files/2713/386/Mantle-1.12-1.3.3.55.jar +worleys0caves = ad8d5845683a65981b54d9737d9dcccaf8ae9b9c,https://media.forgecdn.net/files/3038/801/worleycaves-1.12.2-1.5.2.jar + diff --git a/packs/jeffrey-2/pack.ini b/packs/jeffrey-2/pack.ini new file mode 100644 index 0000000..445cfa5 --- /dev/null +++ b/packs/jeffrey-2/pack.ini @@ -0,0 +1,54 @@ +[pack] +name = J.E.F.F.R.E.Y. 2 +pack_base_url = https://gitlab +forge_url = https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-installer.jar +game_version = 1.12.2 +java_args = -Xmx6G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M + +[mods] +twilightforest = https://www.curseforge.com/minecraft/mc-mods/the-twilight-forest +tconstruct = https://www.curseforge.com/minecraft/mc-mods/tinkers-construct +baubles = https://www.curseforge.com/minecraft/mc-mods/baubles +jei = https://www.curseforge.com/minecraft/mc-mods/jei +psi = https://www.curseforge.com/minecraft/mc-mods/psi +opencomputers = https://www.curseforge.com/minecraft/mc-mods/opencomputers +chisel-bits = https://www.curseforge.com/minecraft/mc-mods/chisels-bits +chisel = https://www.curseforge.com/minecraft/mc-mods/chisel +dynamictrees = https://www.curseforge.com/minecraft/mc-mods/dynamictrees +dynamictrees-compat = https://www.curseforge.com/minecraft/mc-mods/dtphc +dynamictreestraverse = https://f-1.karel.pw/dttraverse-1.4.1e.jar +traverse = https://media.forgecdn.net/files/2613/657/Traverse-1.12.2-1.6.0-69.jar +roots = https://www.curseforge.com/minecraft/mc-mods/roots +ae2 = https://www.curseforge.com/minecraft/mc-mods/applied-energistics-2 +gravestones = https://media.forgecdn.net/files/2608/278/gravestone-1.10.2.jar +enderstorage = https://www.curseforge.com/minecraft/mc-mods/ender-storage-1-8 +waila = https://media.forgecdn.net/files/2568/751/Hwyla-1.8.26-B41_1.12.2.jar +harvestcraft = https://www.curseforge.com/minecraft/mc-mods/pams-harvestcraft +akashictome = https://www.curseforge.com/minecraft/mc-mods/akashic-tome +railcraft = https://www.curseforge.com/minecraft/mc-mods/railcraft +optifine = https://karel.pw/optifine-1.12.2.jar +autoreglib = https://media.forgecdn.net/files/2746/11/AutoRegLib-1.3-32.jar +ctm = https://www.curseforge.com/minecraft/mc-mods/ctm +codechickenlib = https://www.curseforge.com/minecraft/mc-mods/codechicken-lib-1-8 +mysticallib = https://media.forgecdn.net/files/3040/592/mysticallib-1.12.2-1.9.0.jar +patchouli = https://media.forgecdn.net/files/2731/963/Patchouli-1.0-20.jar +mysticalworld = https://media.forgecdn.net/files/3054/945/mysticalworld-1.12.2-1.9.2.jar +diet = https://www.curseforge.com/minecraft/mc-mods/diet-hoppers +worsebarrels = https://www.curseforge.com/minecraft/mc-mods/worse-barrels +wearable = https://www.curseforge.com/minecraft/mc-mods/wearable-backpacks +eerie-entities = https://www.curseforge.com/minecraft/mc-mods/eerie-entities +bookshelf = https://media.forgecdn.net/files/2836/960/Bookshelf-1.12.2-2.3.590.jar +veining = https://www.curseforge.com/minecraft/mc-mods/veining +minecoprocessors = https://www.curseforge.com/minecraft/mc-mods/minecoprocessors +librarianlib = https://www.curseforge.com/minecraft/mc-mods/librarianlib +forgelin = https://media.forgecdn.net/files/2785/465/Forgelin-1.8.4.jar +dimdoors = https://www.curseforge.com/minecraft/mc-mods/dimensionaldoors +translocators = https://www.curseforge.com/minecraft/mc-mods/translocators-1-8 +forgemultipartcbe = https://www.curseforge.com/minecraft/mc-mods/forge-multipart-cbe +magneticraft = https://www.curseforge.com/minecraft/mc-mods/magneticraft +ic2 = https://www.curseforge.com/minecraft/mc-mods/industrial-craft +modelloader = https://www.curseforge.com/minecraft/mc-mods/modelloader +mtlib = https://www.curseforge.com/minecraft/mc-mods/mtlib +appleskin = https://media.forgecdn.net/files/2496/585/AppleSkin-mc1.12-1.0.9.jar +mantle = https://www.curseforge.com/minecraft/mc-mods/mantle +worleys0caves = https://www.curseforge.com/minecraft/mc-mods/worleys-caves diff --git a/packs/jeffrey-2/version.txt b/packs/jeffrey-2/version.txt new file mode 100644 index 0000000..1cc2ba4 --- /dev/null +++ b/packs/jeffrey-2/version.txt @@ -0,0 +1,48 @@ +# Format: <jarname> <hex digested sha1> <direct download url> +#VERSION 29 +twilightforest.jar 9a4afa9c65bc13045d07823433fa6b25372bb481 https://media.forgecdn.net/files/2818/55/twilightforest-1.12.2-3.10.1013-universal.jar +tconstruct.jar e27b77377aa9e9b8dbe7dcd33d01cf22a989112b https://media.forgecdn.net/files/2809/406/TConstruct-1.12.2-2.13.0.171.jar +baubles.jar cb13fcfb18a9cb0cbd825fd5fe8d813c77368549 https://media.forgecdn.net/files/2518/667/Baubles-1.12-1.5.2.jar +jei.jar b7ce5f00e9709e08e81c597dc2d7336f58b7fe8e https://media.forgecdn.net/files/2803/400/jei_1.12.2-4.15.0.291.jar +psi.jar f8a0d27b42d639101b39632d2a309dd7a45f0593 https://media.forgecdn.net/files/2724/967/Psi-r1.1-77.jar +opencomputers.jar 8eff5dc6b00a50b13ad6f3e6a838049bbf8306f8 https://media.forgecdn.net/files/2828/357/OpenComputers-MC1.12.2-1.7.5.192.jar +chisel-and-bits.jar 0e6f159254e6899651087e5b1464bac91698d1d3 https://media.forgecdn.net/files/2720/655/chiselsandbits-14.33.jar +chisel.jar d9a74dde6aafade73328dbf45bf7ec8aca30e038 https://media.forgecdn.net/files/2813/538/Chisel-MC1.12.2-1.0.1.44.jar +dynamictrees.jar 835d7e360839e59186aa72b73ab5d592a68e0b0a https://media.forgecdn.net/files/2822/231/DynamicTrees-1.12.2-0.9.6.jar +dynamictrees-pams-compat.jar 2e429e9705cb49afb72e2650001d003fd755ce42 https://media.forgecdn.net/files/2656/685/DynamicTreesPHC-1.12.2-1.4.2.jar +dynamictreestraverse.jar 19c1e2e6b9c6ee4a9a93b8b50969be7bb6e13011 https://f-1.karel.pw/dttraverse-1.4.1e.jar +traverse.jar b16aaff09a6e77ba193e42f88f5d5bb8a85e063a https://media.forgecdn.net/files/2613/657/Traverse-1.12.2-1.6.0-69.jar +roots.jar 7baac411d3cda10d55e80718ea2e3bb707c2cc89 https://media.forgecdn.net/files/2865/501/Roots-1.12.2-3.0.24.jar +ae2.jar e5c3c11eafc5daf73652a2dabe855e3759caa8b5 https://media.forgecdn.net/files/2747/63/appliedenergistics2-rv6-stable-7.jar +gravestones.jar b2cc9a25054fd6878ba242a6080a2866140bbeb0 https://media.forgecdn.net/files/2744/766/gravestone-1.10.3.jar +enderstorage.jar 7a872baf72b1da038704056a0cf7bbcc40bfa4d6 https://media.forgecdn.net/files/2755/787/EnderStorage-1.12.2-2.4.6.137-universal.jar +waila.jar 7280d5c0dab42436549bcefc63ff64a1049e5501 https://media.forgecdn.net/files/2568/751/Hwyla-1.8.26-B41_1.12.2.jar +harvestcraft.jar ffeb8369801e898c8a1598b37d124c251f40ba93 https://media.forgecdn.net/files/2771/840/Pam's%20HarvestCraft%201.12.2zf.jar +akashictome.jar b11bf9d93f4bd7a2eeb8cfe49c1b30ce1a2f5a37 https://media.forgecdn.net/files/2648/656/AkashicTome-1.2-12.jar +railcraft.jar ea2085a509b816bb9a3cdd79f2f44175b588737a https://media.forgecdn.net/files/2687/757/railcraft-12.0.0.jar +optifine.jar e805d4be5c2a3343488c573145606e90bb13816d https://karel.pw/optifine-1.12.2.jar +autoreglib.jar 267269ca7f1a71fb3bb35bdb8e61702a4da6263e https://media.forgecdn.net/files/2746/11/AutoRegLib-1.3-32.jar +ctm.jar d9133571636ec2c4c590dd69ac41ef813c63a8ab https://media.forgecdn.net/files/2832/564/CTM-MC1.12.2-1.0.1.30.jar +codechickenlib.jar b6a7e3b889c354216059a3bfad298e30a1e46a2d https://media.forgecdn.net/files/2779/848/CodeChickenLib-1.12.2-3.2.3.358-universal.jar +mysticallib.jar 6b08bddd8c2f4e08a60b8bc995f60becb6d4fcaa https://media.forgecdn.net/files/2865/499/mysticallib-1.12.2-1.6.0.jar +patchouli.jar 9804876a655365926757eda750189cd97b5bad69 https://media.forgecdn.net/files/2731/963/Patchouli-1.0-20.jar +mysticalworld.jar 43dc67caef3bff6fd4ecae0b2bde8e12a5ba4cf7 https://media.forgecdn.net/files/2838/234/mysticalworld-1.12.2-1.6.1.jar +diet-hoppers.jar 2aea3d9a64551cefe0a1b6f5c5edf57959796b66 https://media.forgecdn.net/files/2482/543/diethopper-1.1.jar +worsebarrels.jar 2a5a0b83b503d7b8b2e995fc1669f54e15fe62f2 https://media.forgecdn.net/files/2769/265/worsebarrels-1.3.0.jar +wearable-backpacks.jar 3774558b2abb31af680bc169d5058b80db5184c2 https://media.forgecdn.net/files/2800/372/WearableBackpacks-1.12.2-3.1.4.jar +eerie-entities.jar d0011e4888ddd5f95cd3677ea1fc8cffb723c696 https://media.forgecdn.net/files/2728/340/EerieEntities-1.12.2-1.0.7.jar +bookshelf.jar 83a1864dd78f48102609849dd36866d6cf32b907 https://media.forgecdn.net/files/2836/960/Bookshelf-1.12.2-2.3.590.jar +veining.jar a0dbc6ad8021c8fa2f7d00de8058499268000232 https://media.forgecdn.net/files/2578/505/veining-1.3.2-1.12.x.jar +minecoprocessors.jar aa953ffcfb6935669392c95cab68f552f9b1942c https://media.forgecdn.net/files/2599/694/minecoprocessors-1.12.2-5.jar +librarianlib.jar 8cab3fe9c5cd969625cd8655d17163f1f1617f64 https://media.forgecdn.net/files/2836/225/librarianlib-1.12.2-4.20-release.jar +forgelin.jar 7a87553fcb808a45d9c7e03f113b355ac7fd10d7 https://media.forgecdn.net/files/2785/465/Forgelin-1.8.4.jar +dimdoors.jar 30c939f2305b862ed70b2144912ba25418430c36 https://media.forgecdn.net/files/2558/528/DimensionalDoors-3.0.9-287.jar +translocators.jar b008cc099c15e0cb121c43c889504fc367b3dedd https://media.forgecdn.net/files/2755/795/Translocators-1.12.2-2.5.2.81-universal.jar +forgemultipartcbe.jar 3306ea22380bc9b6a0170b23fa0251085d5a6e25 https://media.forgecdn.net/files/2755/790/ForgeMultipart-1.12.2-2.6.2.83-universal.jar +magneticraft.jar 1e32b4d2e0c38a3f129605ed945e55af19d17d13 https://media.forgecdn.net/files/2807/901/Magneticraft_1.12-2.8.2-dev.jar +ic2.jar 2f5597fc13866f8e88fbb7359046511cac2f5371 https://media.forgecdn.net/files/2746/892/industrialcraft-2-2.8.170-ex112.jar +modelloader.jar 8f77152980cafb1be5a4204f5773daef74de8627 https://media.forgecdn.net/files/2744/735/modelloader-1.1.7.jar +mtlib.jar a4625a61c9ef53412e0e467d23f25c5543658677 https://media.forgecdn.net/files/2684/561/MTLib-3.0.6.jar +appleskin.jar 23162a97cab0adb4be2fc6d3937c613929d1d5c7 https://media.forgecdn.net/files/2496/585/AppleSkin-mc1.12-1.0.9.jar +mantle.jar a1e5d5c197dae3e92637cafb8cd996185191165b https://media.forgecdn.net/files/2713/386/Mantle-1.12-1.3.3.55.jar +worleys-caves.jar b0449312ce83d420b7f79c1444fd40891e278faf https://media.forgecdn.net/files/2781/861/worleycaves-1.5.1.jar @@ -236,28 +236,37 @@ def find_cdn(ffx, url, version): Returns the direct Forge CDN download URL """ try: - # This goes to the "all files" page, where we get a table view of all - ffx.get(url + '/files/all') - mod_versions = ffx.find_elements_by_class_name("listing")[0].find_elements_by_xpath("tbody/tr") # extract the table of files from the page - row_info = collections.namedtuple("row_info", ["type", "filename", "cdn_id", "game_version"]) # create a custom tuple because data - rows = [] - for version_entry in mod_versions: - # parse out the four fields that we use - entry_cells = version_entry.find_elements_by_tag_name("td") - release_type = entry_cells[0].text - # Note that this is NOT the final filename - this is just the "release name". - filename = urllib.parse.quote(entry_cells[1].find_elements_by_tag_name("a")[0].text) + # This goes to the "all files" page, where we get a table view of all + page_index = 0; + while True: + ffx.get(url + f'/files/all?page={page_index}') + mod_versions = ffx.find_elements_by_class_name("listing")[0].find_elements_by_xpath("tbody/tr") # extract the table of files from the page + row_info = collections.namedtuple("row_info", ["type", "filename", "cdn_id", "game_version"]) # create a custom tuple because data + rows = [] + for version_entry in mod_versions: + # parse out the four fields that we use + entry_cells = version_entry.find_elements_by_tag_name("td") + release_type = entry_cells[0].text + # Note that this is NOT the final filename - this is just the "release name". + filename = urllib.parse.quote(entry_cells[1].find_elements_by_tag_name("a")[0].text) + try: + game_version = tuple([int(x) for x in entry_cells[4].find_element_by_class_name("mr-2").text.split(".")]) # get game version and convert to tuple + except: + game_version = (0, 0, 0) + cdn_id = entry_cells[1].find_element_by_tag_name("a").get_property("href").split("/")[-1] + + #TODO make this configurable + if 'fabric' not in filename.lower() or 'forge' in filename.lower(): + rows.append(row_info(release_type, filename, cdn_id, game_version)) + rows.sort(key=lambda x: x.game_version, reverse=True) try: - game_version = tuple([int(x) for x in entry_cells[4].find_element_by_class_name("mr-2").text.split(".")]) # get game version and convert to tuple - except: - game_version = (0, 0, 0) - cdn_id = entry_cells[1].find_element_by_tag_name("a").get_property("href").split("/")[-1] + best_row = next(x for x in rows if x.game_version <= version) + break + except StopIteration: + if len(ffx.find_elements_by_class_name("pagination-next--inactive")) != 0: + raise + page_index += 1 - #TODO make this configurable - if 'fabric' not in filename.lower() or 'forge' in filename.lower(): - rows.append(row_info(release_type, filename, cdn_id, game_version)) - rows.sort(key=lambda x: x.game_version, reverse=True) - best_row = next(x for x in rows if x.game_version <= version) # We need to find the real, ForgeCDN compatible filename now by going to the file page. ffx.get(f'{url}/files/{best_row.cdn_id}') @@ -271,6 +280,7 @@ def find_cdn(ffx, url, version): except: # import traceback; traceback.print_exc() + print(f"[!] Failed to retrieve valid CDN URL for {url}") return None |