├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── LICENSE ├── MANIFEST.in ├── README.md ├── extras.json ├── gamedata.json ├── gamedata.json.readme.txt ├── hooks ├── adobeair │ ├── adobeair.install.hook │ └── adobeair.uninstall.hook ├── blastem │ └── blastem.install.hook ├── canabalt_android_and_pc │ └── canabalt_android_and_pc.install.hook ├── dontmove │ └── dontmove.install.hook ├── doodlegod │ └── doodlegod.install.hook ├── drawastickmanepic_bundle │ └── drawastickmanepic_bundle.install.hook ├── greedcorp │ └── greedcorp.install.hook ├── incredipede │ ├── incredipede.install.hook │ └── incredipede.patch ├── machinarium │ ├── machinarium │ └── machinarium.desktop ├── mcpixel_android_pc │ ├── mcpixel_android_pc.install.hook │ └── mcpixel_android_pc.uninstall.hook ├── monsterlovesyou │ └── monsterlovesyou.install.hook ├── nightsky_android_pc │ └── nightsky_android_pc.install.hook └── regencysolitaire │ └── regencysolitaire.install.hook ├── httpbot.py ├── humblebundle.py ├── installers ├── adobeair.install ├── adobeair.uninstall ├── basementcollection.install ├── basementcollection.uninstall ├── bindingofisaac.install ├── bindingofisaac.uninstall ├── bit_trip_beat.install ├── bit_trip_beat.uninstall ├── bit_trip_runner.install ├── bit_trip_runner.uninstall ├── blastem.install ├── blastem.uninstall ├── canabalt.install ├── canabalt.uninstall ├── crayonphysicsdeluxe.install ├── crayonphysicsdeluxe.uninstall ├── dearesther.install ├── dearesther.uninstall ├── dontmove.install ├── dontmove.uninstall ├── drawastickman.install ├── drawastickman.uninstall ├── fieldrunners.install ├── fieldrunners.uninstall ├── fieldrunners2.install ├── fieldrunners2.uninstall ├── fractal.install ├── fractal.uninstall ├── greedcorp.install ├── greedcorp.uninstall ├── incredipede.install ├── incredipede.uninstall ├── lonesurvivor.install ├── lonesurvivor.uninstall ├── machinarium.install ├── machinarium.uninstall ├── mcpixel.install ├── mcpixel.uninstall ├── metalslug3.install ├── metalslug3.uninstall ├── monsterlosvesyou.install ├── monsterlosvesyou.uninstall ├── nightsky.install ├── nightsky.uninstall ├── offspringfling.install ├── offspringfling.uninstall ├── papoandyo.install ├── papoandyo.uninstall ├── regencysolitaire.install ├── regencysolitaire.uninstall ├── starseedpilgrim.install ├── starseedpilgrim.uninstall ├── swordsandsoldiers.install ├── swordsandsoldiers.uninstall ├── torchlight.install ├── torchlight.uninstall ├── vessel.install └── vessel.uninstall ├── makeinstall ├── setup.cfg ├── setup.py └── todo.txt /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.pyc 3 | *.egg-info 4 | ref/ 5 | dist/ 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include hooks/*/*.hook 2 | include installers/*.install 3 | include installers/*.uninstall 4 | include extras.json 5 | include gamedata.json 6 | include makeinstall 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Humble Bundle Manager 2 | ===================== 3 | 4 | Python library and command line tool to manage Humble Bundle games 5 | 6 | List your bundles and games, Show their info, Download, Install and Uninstall them! 7 | It's like `apt-get` for Humble Bundle :) 8 | 9 | 10 | --- 11 | 12 | 13 | Requirements 14 | ------------ 15 | 16 | - **Python** (tested in Python 2.7, can easily be ported to Python 3) 17 | - **Bash** (for the install hooks. Some may require version 4+) 18 | 19 | Python and Bash are already installed by default in virtually all GNU/Linux distros. 20 | 21 | 22 | Dependencies 23 | ------------ 24 | 25 | - [lxml](http://lxml.de) 26 | - [Progressbar](https://code.google.com/p/python-progressbar) 27 | - [Python Keyring Lib](https://github.com/jaraco/keyring) 28 | - [PyXDG](https://freedesktop.org/wiki/Software/pyxdg/) 29 | 30 | The above can be installed in any modern Debian-like distros (like Ubuntu/Mint) with: 31 | 32 | sudo apt-get install python-{lxml,progressbar,keyring,xdg} 33 | 34 | 35 | Install 36 | ------- 37 | 38 | Clone the repository and install as an editable package: 39 | 40 | cd ~/some/dir 41 | git clone https://github.com/MestreLion/humblebundle.git 42 | pip install -e humblebundle 43 | 44 | This installs both the main script `humblebundle` and the library `humblebundle`. 45 | 46 | Uninstall 47 | --------- 48 | 49 | Remove authentication files: 50 | 51 | humblebundle --clear 52 | 53 | Uninstall and delete the directory: 54 | 55 | pip uninstall humblebundle-manager 56 | rm -rf ~/some/dir/humblebundle 57 | 58 | There may be additional files in the config folder, such as `bundles.json` and 59 | `games.json`, that are downloaded while using the app, as well as downloaded 60 | files in the cache folder. The default config folder on Unix-like systems is 61 | `~/.config/humblebundle`, and the default cache folder is 62 | `~/.cache/humblebundle` 63 | 64 | --- 65 | 66 | 67 | Usage as a command-line tool 68 | ---------------------------- 69 | 70 | Adapted from `--help`: 71 | 72 | Usage: humblebundle [general options] [command] [command options] 73 | 74 | Optional arguments: 75 | -h|--help 76 | show this help message and exit 77 | -g|--loglevel {debug,info,warn,error,critical} 78 | set logging level, default is 'warn' 79 | -D|--debug 80 | alias for --loglevel debug 81 | 82 | -u|--update 83 | Fetch all games and bundles data from the server, 84 | rebuilding the cache 85 | 86 | Login options: 87 | -U|--username USERNAME 88 | Account login, the user's email 89 | -P|--password PASSWORD 90 | Account password 91 | -A|--auth AUTH 92 | Account _simpleauth_sess cookie 93 | 94 | 95 | Commands: 96 | -l|--list [REGEX] 97 | List all available Games (Products), including 98 | Soundtracks and eBooks, optionally filtering 99 | by REGEX (Regular Expression) 100 | -L|--list-bundles 101 | List all available Bundles (Purchases), including 102 | Store Front (single product) purchases 103 | 104 | -s|--show GAME 105 | Show all info about selected game 106 | -S|--show-bundle BUNDLE 107 | Show all info about selected bundle 108 | 109 | -d|--download GAME 110 | Name of the game to download. See --list 111 | 112 | -i|--install GAME 113 | Install selected game 114 | -I|--uninstall GAME 115 | Uninstall selected game 116 | 117 | 118 | Download options: 119 | -t|--type NAME 120 | Type (name) of the download, for example '.deb', 121 | 'mojo', 'flash', etc 122 | -a|--arch {32,64} 123 | Download architecture: 32-bit (also known as i386) or 124 | 64-bit (amd64, x86_64, etc) 125 | -p|--platform {windows,mac,linux,android,audio,ebook,comedy} 126 | Download platform. Default is 'linux' 127 | -F|--server-file FILE 128 | Basename of the server file to download. Useful when 129 | no combination of --type, --arch and --platform is 130 | enough to narrow down choices to a single download. 131 | -b|--bittorrent 132 | Download bittorrent file instead of direct download 133 | -f|--path PATH 134 | Path to download. If PATH is a directory, default 135 | download basename will be used. By if omitted, 136 | download to current directory. 137 | 138 | Show options: 139 | -j|--json 140 | Output --show/--show-bundle in machine-readable, JSON 141 | format 142 | 143 | Install options: 144 | -m|--method {custom,deb,apt,mojo,air,steam} 145 | Use this method instead of the default for 146 | (un-)installing a game 147 | 148 | 149 | Command line interface is heavily inspired on `apt` workflow: 150 | 151 | - List games and bundles to get their humble bundle `id` 152 | 153 | - Show info on a particular game or bundle (similar to `apt-cache show`) 154 | 155 | - Download a game archive (similar to `apt-get download`, and as such not needed for install) 156 | 157 | - Install and Uninstall a game (as easy as `apt-get install`) 158 | 159 | 160 | Examples and sample output: 161 | --------------------------- 162 | 163 | Authenticating (only needed once, it stores credentials in keyring): 164 | 165 | $ humblebundle --username 'user@gmail.com' --password '1234' --update --list 166 | 167 | 168 | Show bundle and game info: 169 | 170 | $ humblebundle --show-bundle androidbundle5 171 | 172 | Bundle : androidbundle5 173 | Name : Humble Bundle with Android 5 174 | Category : bundle 175 | Price US$ : 176 | Games : 177 | Beat Hazard Ultra [beathazardultra] 178 | Beat Hazard Ultra [beathazardultra_android] 179 | Beat Hazard Ultra [beathazardultra_soundtrack] 180 | Crayon Physics Deluxe [crayonphysicsdeluxe_android_pc_soundtrack] 181 | Dungeon Defenders + All DLC [dungeondefenders_dlc_android_pc] 182 | Dynamite Jack [dynamitejack_android_pc] 183 | NightSky [nightsky_android_pc] 184 | NightSky [nightsky_soundtrack] 185 | Solar 2 [solar_android_pc] 186 | Splice [splice] 187 | Splice [splice_android] 188 | Splice Soundtrack [splice_soundtrack] 189 | Super Hexagon [superhexagon_android_pc] 190 | Super Hexagon [superhexagon_asm] 191 | Superbrothers: Sword & Sworcery EP [swordandsworcery_android_pc_soundtrack] 192 | 193 | 194 | $ humblebundle --list solar 195 | 196 | solar_android_pc 197 | solarflux 198 | solarflux_android 199 | 200 | 201 | $ humblebundle --show solar_android_pc 202 | 203 | Game : solar_android_pc 204 | Name : Solar 2 205 | Developer : Murudai 206 | URL : http://murudai.com 207 | Bundles : 208 | Humble Bundle with Android 5 [androidbundle5] 209 | Humble Bundle: PC and Android 8 [androidbundle8] 210 | Downloads : 211 | android 212 | Download 45.3 MB Solar2_Android_1.13_1388267491.apk 213 | audio 214 | MP3 53.5 MB solar2_ost_mp3_1409159048.zip 215 | FLAC 179.9 MB solar_2_ost_flac_1409159048.zip 216 | linux 217 | .deb 101.3 MB solar2_1.10_i386_1409159048.deb 218 | .tar.gz 101.3 MB solar2-linux-1.10_1409159048.tar.gz 219 | mac 220 | Download 69.5 MB solar2-mac-1.10_1409159048.dmg 221 | windows 222 | Download 41.2 MB solar2-windows-1.10_1409159048.exe 223 | 224 | Download a file: 225 | 226 | $ humblebundle --download solar_android_pc --platform audio --type mp3 227 | 228 | Downloading 'Solar 2' [solar_android_pc] 'MP3' 53.5 MB solar2_ost_mp3_1409159048.zip 229 | 27% of 53.5 MiB |................ | 1.23 M/s ETA: 00:00:3 230 | 231 | 232 | Install a game (may require an entry in `gamedata.json` or manual options): 233 | 234 | $ humblebundle --install dontmove 235 | 236 | Downloading "Don't Move" [dontmove] (64-bit) 4.7 MB DontMove_v1-3_Linux-64.tar 237 | Installing Don't Move 238 | Done! 239 | 240 | 241 | Usage as a library 242 | ------------------ 243 | 244 | import humblebundle 245 | 246 | hb = HumbleBundle('user@gmail.com', '1234') 247 | 248 | hb.update() 249 | 250 | for name in hb.games: 251 | game = hb.get_game(name) 252 | # or simply hb.games[name] - It's a dictonary! (for now) 253 | print game['human_name'] 254 | 255 | # Blame Humble Bundle for their weird dictionary structure, not me! 256 | for platforms in game.get('downloads', []): 257 | for download in platforms.get('download_struct', []): 258 | url = download.get('url', {}).get('web', '') 259 | if url: 260 | print url 261 | 262 | 263 | filename = hb.download('dontmove', platform='linux', arch=64) 264 | 265 | --- 266 | 267 | 268 | Building the `humblebundle-manager` package 269 | ------------------------------------------- 270 | 271 | Due to an earlier package called `humblebundle`, the package is called `humblebundle-manager`. To build the package: 272 | 273 | pip install build twine 274 | python -m build 275 | twine check dist/* 276 | 277 | Contributing 278 | ------------ 279 | 280 | Patches are welcome! Fork, hack, request pull! Here is my current to-do list: 281 | 282 | - **Better documentation**: Improve this `README`, document `installers/` usage, custom `hooks/` interface, explain how credentials are used and stored, `gamedata.json` format and usage, config dir structure. And, most important, describe the install mechanics in more detail. 283 | 284 | - **Classes**: convert the games and bundles dictionaries to classes with attributes and methods. `HumbleBundle.get_game()` would return a `Game` instance, methods `.install()`, `.download()` etc would be there and not on the "main" HumbleBundle class. 285 | 286 | If you find a bug or have any enhancement request, please to open a [new issue](https://github.com/MestreLion/humblebundle/issues/new) 287 | 288 | 289 | Written by 290 | ---------- 291 | 292 | Rodrigo Silva (MestreLion) 293 | 294 | Licenses and Copyright 295 | ---------------------- 296 | 297 | Copyright (C) 2014 Rodrigo Silva (MestreLion) . 298 | 299 | License GPLv3+: GNU GPL version 3 or later . 300 | 301 | This is free software: you are free to change and redistribute it. 302 | 303 | There is NO WARRANTY, to the extent permitted by law. 304 | -------------------------------------------------------------------------------- /extras.json: -------------------------------------------------------------------------------- 1 | { 2 | "adobeair": { 3 | "machine_name": "adobeair", 4 | "human_name": "Adobe AIR 2.6 Runtime", 5 | "url": "http://get.adobe.com/air", 6 | "icon": "http://wwwimages.adobe.com/www.adobe.com/images/store/product_boxshots/90x90/air_90x90.jpg", 7 | "payee": { 8 | "human_name": "Adobe", 9 | "machine_name": "adobe" 10 | }, 11 | "downloads": [ 12 | { 13 | "download_struct": [ 14 | { 15 | "file_size": 16127348, 16 | "human_size": "15.4 MB", 17 | "md5": "a91369be7ab40e3c5d5bc9fb02b95041", 18 | "name": "Adobe .bin installer", 19 | "url": { 20 | "web": "http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRInstaller.bin" 21 | } 22 | } 23 | ], 24 | "machine_name": "adobeair_upstream_installer_linux", 25 | "platform": "linux" 26 | }, 27 | { 28 | "download_struct": [ 29 | { 30 | "file_size": 14855686, 31 | "human_size": "14.2 MB", 32 | "md5": "a8d7051edf745d8b73d798f833f1c339", 33 | "name": "Adobe upstream .deb", 34 | "url": { 35 | "web": "http://airdownload.adobe.com/air/lin/download/2.6/adobeair.deb" 36 | } 37 | } 38 | ], 39 | "machine_name": "adobeair_upstream_debian_linux", 40 | "platform": "linux" 41 | }, 42 | { 43 | "download_struct": [ 44 | { 45 | "file_size": 14852158, 46 | "human_size": "14.2 MB", 47 | "md5": "c72efd38ca020311ce220c58d1b2299a", 48 | "name": "Ubuntu Lucid .deb", 49 | "url": { 50 | "web": "http://launchpadlibrarian.net/73533974/adobeair_2.6.0.19170-0lucid1_i386.deb" 51 | } 52 | } 53 | ], 54 | "machine_name": "adobeair_ubuntu_linux", 55 | "platform": "linux" 56 | } 57 | ] 58 | }, 59 | "flashplayer": { 60 | "machine_name": "flashplayer", 61 | "human_name": "Flash Player 11.2 Standalone (Projector)", 62 | "url": "http://www.adobe.com/support/flashplayer/downloads.html", 63 | "icon": "http://wwwimages.adobe.com/labs.adobe.com/cdn/technologies/flash/images/fl_appicon_150x150.jpg", 64 | "payee": { 65 | "human_name": "Adobe", 66 | "machine_name": "adobe" 67 | }, 68 | "downloads": [ 69 | { 70 | "download_struct": [ 71 | { 72 | "file_size": 5959028, 73 | "human_size": "5.7 MB", 74 | "md5": "557b961af0d2e56a2a8ac512b9cf44bb", 75 | "name": "Download", 76 | "url": { 77 | "web": "http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa.i386.tar.gz" 78 | } 79 | } 80 | ], 81 | "machine_name": "flashplayer_linux", 82 | "platform": "linux" 83 | } 84 | ] 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /gamedata.json: -------------------------------------------------------------------------------- 1 | { 2 | "basementcollection": {"install": "deb", "package": "the-basement-collection"}, 3 | "bindingofisaac_dlc": {"install": "deb", "package": "isaac"}, 4 | "bittripbeat": {"install": "apt", "package": "bit-trip-beat"}, 5 | "bittriprunner": {"install": "deb", "package": "bit.trip.runner"}, 6 | "blastem": {"install": "custom"}, 7 | "canabalt_android_and_pc": {"install": "custom", "basename": "canabalt", "download": "flash"}, 8 | "crayonphysicsdeluxe_android_pc_soundtrack": {"install": "apt", "package": "crayon-physics-deluxe"}, 9 | "dearesther": {"install": "deb", "package": "ia32-dearesther"}, 10 | "dontmove": {"install": "custom", "basename": "dontmove"}, 11 | "doodlegod": {"install": "custom"}, 12 | "drawastickmanepic_bundle": {"install": "custom", "basename": "drawastickman"}, 13 | "fieldrunners_android_pc_soundtrack": {"install": "apt", "package": "fieldrunners"}, 14 | "fieldrunners2": {"install": "mojo", "mojoname": "Fieldrunners2"}, 15 | "fractal": {"install": "apt", "package": "fractal"}, 16 | "greedcorp": {"install": "custom"}, 17 | "incredipede": {"install": "custom"}, 18 | "jamestown": {"install": "apt", "package": "jamestown"}, 19 | "lonesurvivor_linux": {"install": "apt", "package": "lonesurvivor"}, 20 | "machinarium": {"install": "deb", "package": "machinarium"}, 21 | "mcpixel_android_pc": {"install": "custom", "basename": "mcpixel", "download": "air", "package": "gd.sos.mcpixel"}, 22 | "metalslug3": {"install": "mojo", "mojoname": "MetalSlug3"}, 23 | "monsterlovesyou": {"install": "custom"}, 24 | "nightsky_android_pc": {"install": "custom", "basename": "nightsky"}, 25 | "offspringfling": {"install": "apt", "package": "offspring-fling"}, 26 | "papoandyo": {"install": "mojo", "mojoname": "PapoYo"}, 27 | "regencysolitaire": {"install": "custom"}, 28 | "starseedpilgrim": {"install": "air"}, 29 | "swordsandsoldiers_android_and_pc": {"install": "apt", "package": "swordsandsoldiers"}, 30 | "torchlight": {"install": "apt", "package": "torchlight"}, 31 | "vessel": {"install": "mojo", "mojoname": "vessel"}, 32 | "wizorb_soundtrack": {"install": "deb", "package": "wizorb"}, 33 | 34 | "adobeair": {"install": "custom", "download": "bin", "package": "adobeair"} 35 | } 36 | -------------------------------------------------------------------------------- /gamedata.json.readme.txt: -------------------------------------------------------------------------------- 1 | gamedata.json contains instructions on how to install each Humble Bundle game. 2 | 3 | Relevant fields used by install methods are: 4 | package: Name of the installed package. Defaults to HB name. [apt, deb] 5 | mojoname: Defines install dir and uninstall script name. Defaults to simplified, titled HB name. [mojo] 6 | gamename_with_underscores -> Gamename 7 | download: Name (type) of the install file to download. [deb, mojo, custom] 8 | No default value, but favors .deb packages. 9 | steamid: Steam AppID of the game [steam] 10 | basename: A "game ID" name that defines install dir, icon name and other settings. [custom] 11 | Similar in usage to mojoname, defaults to a simplified HB name 12 | dirname: Basename of install path. Defaults to basename. [custom] 13 | 14 | 15 | Additional info on some games 16 | ----------------------------- 17 | 18 | adobeair 19 | There's also 2 .deb files available, one from Ubuntu Lucid 10.04 partner repository, which is 20 | expected to go End of Life and shut down on April 2015, the other from Adobe itself. 21 | Both install fine in Ubuntu Precise 12.04 64-bit, but both fail to succeed installing games. 22 | So currently the configured install method uses the .bin installer from Adobe. 23 | It requires custom install script, a GUI, and it's not fully unattended, but version is exactly 24 | the same (1:2.6.0.19170). It also registers itself in dpkg as an installed package 25 | 26 | amnesia 27 | Also available in USC apt-get as 'amnesia' package, but not from any particular bundle list 28 | 29 | anomalywarzoneearth_pc 30 | Package 'anomaly' exists in USC, but is not available in HiB Android 3 USC list anymore 31 | 32 | bastion 33 | bastion_bundle 34 | Same game, but "bastion" from HiB 5 is in USC as 'bastion' package, 35 | "bastion_bundle" is from from HiB 9, which has no USC list. 36 | 37 | brokenswordshadowofthetemplars 38 | Also available in HiB Android 6 USC list, but not in HiB Android 7. 39 | Package 'broken-sword-directors-cut' 40 | 41 | fieldrunners_android_pc_soundtrack 42 | USC apt-get only available for HiB Android 3. For HiB Android 10 use 'deb' method 43 | 44 | gianasisters_twisteddreams 45 | Not available for Linux or Mac 46 | 47 | limbo 48 | limbo_bundle 49 | Crossover version in USC as 'limbo'. 50 | Recently got native version in both HB (mojo installer 'limbo') and SteamOS 51 | 52 | mcpixel_android_pc 53 | 3 download choices, all have pros and cons: 54 | '32 bit .deb': .deb inside a .zip. Package 'gd.sos.mcpixel', predepends on 'adobeair'. 55 | The .swf inside is not standalone, so it requires Adobe AIR anyway. 56 | 'Air': .air installer inside a .zip. Obviously requires Adobe AIR to run 57 | '.tar.gz': standalone .swf inside. The only that runs on Flash and does not require AIR. But zip has no icons. 58 | 59 | 60 | The following games are in SteamOS but are also available in Ubuntu Software Center (USC): 61 | 62 | HumbleBundle Name USC Package 63 | ----------------- ----------- 64 | amnesia amnesia 65 | anomalywarzoneearth_pc anomaly 66 | braid braid 67 | capsized capsized 68 | cavestoryplus cave-story-plus 69 | closure closure 70 | dustforce dustforce 71 | dynamitejack_android_pc dynamitejack 72 | edge edge 73 | englishcountrytune english-country-tune 74 | eufloriahd_android_pc_soundtrack eufloriahd 75 | gratuitousspacebattles gratuitous-space-battles 76 | hotlinemiami hotline-miami-meta 77 | legendofgrimrock legend-of-grimrock 78 | limbo limbo 79 | littleinferno little-inferno-meta 80 | offspringfling offspring-fling 81 | oilrush oilrush 82 | organtraildirectorscut organ-trail 83 | osmos_android_pc_soundtrack osmos 84 | proteus proteus-meta 85 | psychonauts psychonauts 86 | rochard rochard 87 | shank2 shank2 88 | shatter shatter 89 | snapshot_hib7 snapshot 90 | solar_android_pc solar2 91 | spacechem_android_pc_soundtrack spacechem 92 | spaz spacepiratesandzombies 93 | spirits_android_pc_soundtrack spirits 94 | splice splice 95 | stealthbastarddeluxe stealth-bastard-deluxe-meta 96 | superhexagon_android_pc super-hexagon 97 | supermeatboy_no_soundtrack supermeatboy 98 | swordandsworcery swordandsworcery 99 | uplink_android_pc_soundtrack uplink 100 | wakingmars_android_pc waking-mars 101 | worldofgoo_android_pc_soundtrack worldofgoo 102 | -------------------------------------------------------------------------------- /hooks/adobeair/adobeair.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Adobe AIR 4 | # Based on AIR installer from Anodyne for Steam 5 | # See ~/.local/share/Steam/SteamApps/common/Anodyne/install.sh 6 | 7 | # Additional references: 8 | # http://www.defendersquest.com/1/?page=linux_steam 9 | # https://launchpad.net/ubuntu/lucid/i386/adobeair 10 | # http://steamcommunity.com/app/218410/discussions/0/666826069039698014/ 11 | # http://orkultus.wordpress.com/2013/03/23/installing-adobe-air-2-6-on-64bit-linux-mint-ubuntu/ 12 | 13 | # Alternate methods: 14 | # https://aur.archlinux.org/packages/ad/adobe-air/adobe-air.tar.gz 15 | # http://www.reddit.com/r/linux_gaming/comments/1dtpf4/ 16 | 17 | basename=$1 18 | dir=$2 19 | archive=$3 20 | 21 | if [ $# -ne 3 ] ; then 22 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE" 23 | exit 1 24 | fi 25 | 26 | echo "Installing Adobe AIR" 27 | 28 | ARCH=$(uname -m) 29 | 30 | find_lib() { 31 | if [ "$ARCH" = "x86_64" ]; then 32 | /sbin/ldconfig -p | grep -F "$1" | grep -F -m 1 x86-64 | awk '{print $NF}' 33 | else 34 | /sbin/ldconfig -p | grep -F -m 1 "$1" | awk '{print $NF}' 35 | fi 36 | } 37 | 38 | LIB_PATHS= 39 | # try to figure out where the gnome keyring/kwallet libraries for the 40 | # actual system architecture are, so the installer can load them (since it 41 | # tries to load them manually ...) 42 | # TODO: not sure yet if the 32bit installer needs this 43 | KEYRING="$(find_lib libgnome-keyring.so)" 44 | if [ -n "$KEYRING" ]; then 45 | LIB_PATHS="$(dirname "$KEYRING"):$LIB_PATHS" 46 | fi 47 | # TODO: find actual library name AIR is looking for (qdbus?!) 48 | KWALLET="$(find_lib kwallet)" 49 | if [ -n "$KWALLET" ]; then 50 | LIB_PATHS="$(dirname "$KWALLET"):$LIB_PATHS" 51 | fi 52 | 53 | export LD_LIBRARY_PATH="$LIB_PATHS${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}" 54 | chmod +x "$archive" 55 | "$archive" 56 | 57 | echo "Done!" 58 | -------------------------------------------------------------------------------- /hooks/adobeair/adobeair.uninstall.hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # Custom uninstall hook for Adobe AIR 4 | 5 | echo "Uninstalling Adobe AIR" 6 | ../../humblebundle --uninstall adobeair --method apt 7 | echo "Done!" 8 | -------------------------------------------------------------------------------- /hooks/blastem/blastem.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Blast Em! 4 | 5 | # Copyright (C) 2016 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | hibname=$4 12 | gamename=$5 13 | 14 | if [ $# -lt 5 ] ; then 15 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE _ GAMENAME" 16 | exit 1 17 | fi 18 | 19 | exec="$dir"/blastem_lin/BlastEmLinux.x86 20 | icon="$dir"/blastem_lin/BlastEmLinux_Data/Resources/UnityPlayer.png 21 | size=128 # $(identify -format '%w' "$icon") 22 | uninstall="$dir"/uninstall 23 | desktop="$dir"/"$basename".desktop 24 | wmclass=${exec##*/} 25 | 26 | 27 | echo "Installing $gamename" 28 | 29 | # Create install dir 30 | mkdir -p "$dir" 31 | 32 | # Extract archive 33 | unzip -qo -d "$dir" "$archive" 34 | 35 | # Set executable permition 36 | chmod +x "$exec" 37 | 38 | # create uninstall script 39 | cat > "$uninstall" <<-EOF 40 | #!/bin/sh -e 41 | 42 | # $gamename uninstall script 43 | # Generated by Humble Bundle automated installer 44 | # https://github.com/MestreLion/humblebundle 45 | 46 | echo "Uninstalling $gamename" 47 | xdg-desktop-menu uninstall "$basename.desktop" 48 | xdg-icon-resource uninstall --size $size "$basename" 49 | rm -rf "$dir" 50 | echo "Done" 51 | EOF 52 | chmod +x "$uninstall" 53 | 54 | # Install Icon 55 | xdg-icon-resource install --novendor --size "$size" "$icon" "$basename" 56 | 57 | # Create and install Launcher 58 | cat > "$desktop" <<-EOF 59 | [Desktop Entry] 60 | Version=1.0 61 | Type=Application 62 | Name=${gamename} 63 | Comment=Blast your way through wave upon wave of enemies trying to take you out 64 | Categories=Game; 65 | Terminal=false 66 | StartupNotify=true 67 | StartupWMClass=${wmclass} 68 | Path=$(printf '%q' "$dir") 69 | Icon=$basename 70 | Exec=$(printf '%q' "$exec") 71 | EOF 72 | xdg-desktop-menu install --novendor "$desktop" 73 | 74 | echo "Done!" 75 | -------------------------------------------------------------------------------- /hooks/canabalt_android_and_pc/canabalt_android_and_pc.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Canabalt 4 | 5 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | gamename=$5 12 | iconurl=$6 13 | 14 | if [ $# -lt 6 ] ; then 15 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE _ _ ICON" 16 | exit 1 17 | fi 18 | 19 | url="$dir"/Canabalt_for_Browser/Canabalt.html 20 | 21 | exec="$dir"/"$basename" 22 | icon="$dir"/"$basename".png 23 | uninstall="$dir"/uninstall 24 | desktop="$dir"/"$basename".desktop 25 | wmclass=${url//\//_} 26 | 27 | echo "Installing $gamename" 28 | 29 | # Create install dir 30 | mkdir -p "$dir" 31 | 32 | # Extract archive 33 | unzip -qo -d "$dir" "$archive" "Canabalt_for_Browser/*" 34 | 35 | # create uninstall script 36 | cat > "$uninstall" <<-EOF 37 | #!/bin/sh -e 38 | 39 | # $gamename uninstall script 40 | # Generated by Humble Bundle automated installer 41 | # https://github.com/MestreLion/humblebundle 42 | 43 | echo "Uninstalling $gamename" 44 | xdg-desktop-menu uninstall "$basename.desktop" 45 | rm -rf "$dir" 46 | echo "Done" 47 | EOF 48 | chmod +x "$uninstall" 49 | 50 | # Create executable 51 | cat > "$exec" <<-EOF 52 | #!/bin/bash 53 | 54 | # Canabalt launcher 55 | # Generated by Humble Bundle automated installer 56 | # https://github.com/MestreLion/humblebundle 57 | 58 | url="$url" 59 | chromish_args=(--user-data-dir="\${XDG_CONFIG_HOME:-"\$HOME"/.config}/$basename" --app="file://\$url") 60 | 61 | has(){ type "\$1" 1>/dev/null 2>&1; } 62 | 63 | if has google-chrome; then 64 | browser=(google-chrome "\${chromish_args[@]}") 65 | elif has chromium-browser; then 66 | browser=(chromium-browser "\${chromish_args[@]}") 67 | elif has firefox; then 68 | browser=(firefox -new-window "\$url") 69 | else 70 | browser=(x-www-browser "\$url") 71 | fi 72 | "\${browser[@]}" 73 | EOF 74 | chmod +x "$exec" 75 | 76 | # Download icon 77 | wget -q "$iconurl" -O "$icon" 78 | 79 | # Create and install Launcher 80 | cat > "$desktop" <<-EOF 81 | [Desktop Entry] 82 | Version=1.0 83 | Type=Application 84 | Name=Canabalt 85 | Categories=Game; 86 | Terminal=false 87 | StartupNotify=true 88 | StartupWMClass=${wmclass#_} 89 | Icon=$(printf '%q' "$icon") 90 | Exec=$(printf '%q' "$exec") 91 | EOF 92 | xdg-desktop-menu install --novendor "$desktop" 93 | 94 | echo "Done!" 95 | -------------------------------------------------------------------------------- /hooks/dontmove/dontmove.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Don't Move 4 | 5 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | hibname=$4 12 | gamename=$5 13 | iconurl=$6 14 | 15 | if [ $# -lt 6 ] ; then 16 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE _ GAMENAME ICON" 17 | exit 1 18 | fi 19 | 20 | exec="$dir"/DontMove 21 | 22 | icon="$dir"/"$basename".png 23 | uninstall="$dir"/uninstall 24 | desktop="$dir"/"$basename".desktop 25 | wmclass=${exec##*/} 26 | 27 | echo "Installing $gamename" 28 | 29 | # Create install dir 30 | mkdir -p "$dir" 31 | 32 | # Extract archive 33 | tar -xf "$archive" --directory "$dir" 34 | 35 | # create uninstall script 36 | cat > "$uninstall" <<-EOF 37 | #!/bin/sh -e 38 | 39 | # $gamename uninstall script 40 | # Generated by Humble Bundle automated installer 41 | # https://github.com/MestreLion/humblebundle 42 | 43 | echo "Uninstalling $gamename" 44 | xdg-desktop-menu uninstall "$basename.desktop" 45 | rm -rf "$dir" 46 | echo "Done" 47 | EOF 48 | chmod +x "$uninstall" 49 | 50 | # Download icon 51 | wget -q "$iconurl" -O "$icon" 52 | 53 | # Create and install Launcher 54 | cat > "$desktop" <<-EOF 55 | [Desktop Entry] 56 | Version=1.0 57 | Type=Application 58 | Name=${gamename} 59 | Categories=Game; 60 | Terminal=false 61 | StartupNotify=true 62 | StartupWMClass=${wmclass} 63 | Path=$(printf '%q' "$dir") 64 | Icon=$(printf '%q' "$icon") 65 | Exec=$(printf '%q' "$exec") 66 | EOF 67 | xdg-desktop-menu install --novendor "$desktop" 68 | 69 | echo "Done!" 70 | -------------------------------------------------------------------------------- /hooks/doodlegod/doodlegod.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Doodle God 4 | 5 | # Copyright (C) 2015 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | hibname=$4 12 | gamename=$5 13 | 14 | if [ $# -lt 5 ] ; then 15 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE HIBNAME GAMENAME" 16 | exit 1 17 | fi 18 | 19 | uninstall="$dir"/uninstall 20 | desktop="$dir"/"$basename".desktop 21 | fakeroot="$dir"/fakeroot 22 | 23 | # official .desktop uses icon_dg.png, which is 123x123 24 | icon="$dir"/icons/icon128.png 25 | size=128 26 | 27 | echo "Installing $gamename" 28 | 29 | # Create install dir 30 | mkdir -p "$dir" 31 | 32 | # Extract archive 33 | sh -- "$archive" --noexec --target "$dir" 34 | 35 | # DoodleGod was compiled using glibc 2.17, but Ubuntu 12.04 uses glibc 2.15 36 | # There's a workaround for that particular distro and release (and glibc): 37 | # Download glibc 2.19 package from Ubuntu 14.04, extract it in a "fakeroot" dir, 38 | # and run the game using the loader in that fakeroot environment 39 | if type lsb_release > /dev/null 2>&1 && 40 | [[ "$(lsb_release -i -r -s)" = "$(printf '%s\n' Ubuntu 12.04)" ]] && 41 | [[ "$(ldd --version 2>/dev/null | awk '{print $NF; exit}')" = "2.15" ]] 42 | then 43 | arch=$(arch) 44 | if [[ "$arch" = "x86_64" ]]; then 45 | debarch=amd64 46 | else 47 | debarch=i386 48 | fi 49 | url=http://security.ubuntu.com/ubuntu/pool/main 50 | libs=(/e/eglibc/libc6_2.19-0ubuntu6.9_"$debarch".deb) 51 | mkdir -p "$fakeroot" 52 | for lib in "${libs[@]}"; do 53 | wget -P "$fakeroot" "$url"/"$lib" 54 | dpkg -x "$fakeroot"/"${lib##*/}" "$fakeroot" 55 | done 56 | 57 | exec="$dir"/"$basename" 58 | 59 | # Create launcher script 60 | cat > "$exec" <<-EOF 61 | #!/bin/sh 62 | 63 | # $gamename launcher script 64 | # Generated by Humble Bundle automated installer 65 | # https://github.com/MestreLion/humblebundle 66 | 67 | dir=\$(dirname "\$(readlink -f "\$0")") 68 | exec="\$dir"/DoodleGame 69 | ldpath="\$dir"/fakeroot/lib/$arch-linux-gnu 70 | loader="\$ldpath"/ld-2.19.so 71 | 72 | cd "\$dir" && 73 | LD_LIBRARY_PATH="\$ldpath" "\$loader" "\$exec" 74 | rm -f "\$dir"/core 75 | EOF 76 | chmod +x "$exec" 77 | else 78 | # We're (hopefully) in a more recent distro/release. 79 | # No need of any workarounds 80 | exec="$dir"/DoodleGame 81 | fi 82 | 83 | # Create uninstall script 84 | cat > "$uninstall" <<-EOF 85 | #!/bin/sh -e 86 | 87 | # $gamename uninstall script 88 | # Generated by Humble Bundle automated installer 89 | # https://github.com/MestreLion/humblebundle 90 | 91 | echo "Uninstalling $gamename" 92 | xdg-desktop-menu uninstall "$basename.desktop" 93 | xdg-icon-resource uninstall --size $size "$basename" 94 | rm -rf "$dir" 95 | echo "Done" 96 | EOF 97 | chmod +x "$uninstall" 98 | 99 | # Install Icon 100 | xdg-icon-resource install --novendor --size "$size" "$icon" "$basename" 101 | 102 | # Create and install Launcher 103 | cat > "$desktop" <<-EOF 104 | [Desktop Entry] 105 | Version=1.0 106 | Type=Application 107 | Name=${gamename} 108 | Comment=Be a God! 109 | Categories=Game; 110 | Terminal=false 111 | StartupNotify=true 112 | Path=$(printf '%q' "$dir") 113 | Icon=$basename 114 | Exec=$(printf '%q' "$exec") 115 | EOF 116 | xdg-desktop-menu install --novendor "$desktop" 117 | 118 | # Remove archive cruft 119 | rm -f "$dir"/{setup.sh,"Doodle God.desktop"} 120 | 121 | echo "Done!" 122 | -------------------------------------------------------------------------------- /hooks/drawastickmanepic_bundle/drawastickmanepic_bundle.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Draw a Stickman EPIC 4 | 5 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | gamename=$5 12 | 13 | if [ $# -lt 3 ] ; then 14 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE" 15 | exit 1 16 | fi 17 | 18 | exec="$dir"/DrawAStickman.Linux.exe 19 | icon="$dir"/Game.ico 20 | icondir="$dir"/icons 21 | 22 | uninstall="$dir"/uninstall 23 | desktop="$dir"/"$basename".desktop 24 | 25 | echo "Installing $basename" 26 | 27 | # Install dependencies, as per upstream install.sh, and ImageMagick for icon handling 28 | sudo apt-get -y install mono-complete libsdl-mixer1.2 libsdl1.2debian libopenal1 imagemagick 29 | 30 | # Create install dir 31 | mkdir -p "$dir" 32 | 33 | # Extract archive 34 | tar -xf "$archive" --strip 1 --directory "$dir" 35 | 36 | # Remove upstream execution permission for .dlls 37 | chmod -x "$dir"/*.dll 38 | 39 | # create uninstall script 40 | cat > "$uninstall" <<-EOF 41 | #!/bin/sh -e 42 | 43 | # $gamename uninstall script 44 | # Generated by Humble Bundle automated installer 45 | # https://github.com/MestreLion/humblebundle 46 | 47 | dir="$dir" 48 | 49 | echo "Uninstalling $gamename" 50 | while read -r size; do 51 | xdg-icon-resource uninstall --noupdate --size "\$size" "$basename" 52 | done < "\$dir"/icons/sizes 53 | xdg-icon-resource forceupdate 54 | xdg-desktop-menu uninstall "$basename.desktop" 55 | rm -rf "\$dir" 56 | echo "Done" 57 | EOF 58 | chmod +x "$uninstall" 59 | 60 | # Generate and Install icons 61 | mkdir -p "$icondir" 62 | convert "$icon" "$icondir"/"$basename".png 63 | truncate --size 0 "$icondir"/sizes 64 | for icon in "$icondir"/*.png ; do 65 | size=$(identify -format '%w' "$icon") 66 | if grep -q -x "$size" "$icondir"/sizes; then 67 | rm "$icon" 68 | continue 69 | fi 70 | echo "$size" >> "$icondir"/sizes 71 | xdg-icon-resource install --noupdate --novendor --size "$size" "$icon" "$basename" 72 | done 73 | xdg-icon-resource forceupdate 74 | 75 | # Create and install Launcher 76 | cat > "$desktop" <<-EOF 77 | [Desktop Entry] 78 | Version=1.0 79 | Type=Application 80 | Name=Draw a Stickman: EPIC 81 | Categories=Game; 82 | Terminal=false 83 | StartupNotify=true 84 | Icon=$basename 85 | Exec=$(printf '%q' "$exec") 86 | EOF 87 | xdg-desktop-menu install --novendor "$desktop" 88 | 89 | echo "Done!" 90 | -------------------------------------------------------------------------------- /hooks/greedcorp/greedcorp.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Greed Corp 4 | 5 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | gamename=$5 12 | 13 | if [ $# -lt 3 ] ; then 14 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE" 15 | exit 1 16 | fi 17 | 18 | exec="$dir"/GreedCorp.$(uname -m) 19 | icon="$dir"/GreedCorp_Data/Resources/UnityPlayer.png 20 | size=128 # $(identify -format '%w' "$icon") 21 | 22 | uninstall="$dir"/uninstall 23 | desktop="$dir"/"$basename".desktop 24 | 25 | echo "Installing $basename" 26 | 27 | # Create install dir 28 | mkdir -p "$dir" 29 | 30 | # Extract archive 31 | tar -xf "$archive" --strip 1 --directory "$dir" 32 | 33 | # create uninstall script 34 | cat > "$uninstall" <<-EOF 35 | #!/bin/sh -e 36 | 37 | # $gamename uninstall script 38 | # Generated by Humble Bundle automated installer 39 | # https://github.com/MestreLion/humblebundle 40 | 41 | echo "Uninstalling $gamename" 42 | xdg-desktop-menu uninstall "$basename.desktop" 43 | xdg-icon-resource uninstall --size $size "$basename" 44 | rm -rf "$dir" 45 | echo "Done" 46 | EOF 47 | chmod +x "$uninstall" 48 | 49 | # Install icon 50 | xdg-icon-resource install --novendor --size "$size" "$icon" "$basename" 51 | 52 | # Create and install Launcher 53 | cat > "$desktop" <<-EOF 54 | [Desktop Entry] 55 | Version=1.0 56 | Type=Application 57 | Name=Greed Corp 58 | Categories=Game; 59 | Terminal=false 60 | StartupNotify=true 61 | Icon=$basename 62 | Exec=$(printf '%q' "$exec") 63 | EOF 64 | xdg-desktop-menu install --novendor "$desktop" 65 | 66 | echo "Done!" 67 | -------------------------------------------------------------------------------- /hooks/incredipede/incredipede.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Incredipede 4 | 5 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | gamename=$5 12 | 13 | if (($# < 3)); then 14 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE" 15 | exit 1 16 | fi 17 | 18 | exec="$dir"/"$basename" 19 | uninstall="$dir"/uninstall 20 | iconpath=data/northwaygames-incredipede.png 21 | icon="$dir"/"$iconpath" 22 | size=256 ## $(identify -format '%w' "$icon") 23 | url=$dir/data/Incredipede.html 24 | wmclass=${url//\//_} 25 | 26 | echo "Installing $basename" 27 | 28 | # Create install dir 29 | mkdir -p "$dir" 30 | 31 | # Extract archive 32 | tar -xf "$archive" --strip 1 --directory "$dir" 33 | 34 | # create uninstall script 35 | cat > "$uninstall" <<-EOF 36 | #!/bin/sh -e 37 | 38 | # $gamename uninstall script 39 | # Generated by Humble Bundle automated installer 40 | # https://github.com/MestreLion/humblebundle 41 | 42 | echo "Uninstalling $gamename" 43 | xdg-icon-resource uninstall --size $size "$basename" 44 | xdg-desktop-menu uninstall "$basename.desktop" 45 | rm -rf "$dir" 46 | echo "Done" 47 | EOF 48 | chmod +x "$uninstall" 49 | 50 | # Create executable 51 | cat > "$exec" <<-EOF 52 | #!/bin/bash 53 | 54 | # Incredipede launcher 55 | # Generated by Humble Bundle automated installer 56 | # https://github.com/MestreLion/humblebundle 57 | 58 | url="$url" 59 | chromish_args=(--ignore-gpu-blacklist --user-data-dir="\${XDG_CONFIG_HOME:-"\$HOME"/.config}/$basename" --app="file://\$url") 60 | 61 | has(){ type "\$1" 1>/dev/null 2>&1; } 62 | 63 | if has google-chrome; then 64 | browser=(google-chrome "\${chromish_args[@]}") 65 | elif has chromium-browser; then 66 | browser=(chromium-browser "\${chromish_args[@]}") 67 | elif has firefox; then 68 | browser=(firefox -new-window "\$url") 69 | else 70 | browser=(x-www-browser "\$url") 71 | fi 72 | "\${browser[@]}" 73 | EOF 74 | chmod +x "$exec" 75 | 76 | # Install Icon 77 | xdg-icon-resource install --novendor --size "$size" "$icon" "$basename" 78 | 79 | # Create and install Launcher 80 | cat > "$dir"/"$basename".desktop <<-EOF 81 | [Desktop Entry] 82 | Version=1.0 83 | Type=Application 84 | Name=Incredipede 85 | Comment=A beautifully-crafted puzzle game about life and feet. 86 | Categories=Game; 87 | StartupWMClass=${wmclass#_} 88 | Terminal=false 89 | StartupNotify=true 90 | Icon=$basename 91 | Exec=$(printf '%q' "$exec") 92 | EOF 93 | xdg-desktop-menu install --novendor "$dir"/"$basename".desktop 94 | 95 | # Add "favicon" to the HTML 96 | sed -i 's/\r//' "$dir"/data/Incredipede.html 97 | patch -uls -p1 --dir "$dir" < "incredipede.patch" 98 | 99 | echo "Done!" 100 | -------------------------------------------------------------------------------- /hooks/incredipede/incredipede.patch: -------------------------------------------------------------------------------- 1 | diff -ur a/data/Incredipede.html b/data/Incredipede.html 2 | --- a/data/Incredipede.html 2013-06-13 18:28:00.000000000 -0300 3 | +++ b/data/Incredipede.html 2013-10-15 19:12:48.331303612 -0300 4 | @@ -2,6 +2,7 @@ 5 | 6 | 7 | Incredipede: a game about life and feet 8 | + 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /hooks/machinarium/machinarium: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir=/opt/machinarium 4 | 5 | reslist=(1280x800 1280x960 1600x900 1440x900) 6 | supported= 7 | changed= 8 | 9 | { 10 | read -r display 11 | while read -r res; do 12 | if [[ "$res" ]]; then 13 | supported+="$res"$'\n' 14 | fi 15 | current=$res 16 | done 17 | } < <(xrandr | awk ' 18 | active && $1 ~ /^[0-9]+x[0-9]+$/ { 19 | print $1 20 | } 21 | active && $0 ~ /\*/ { 22 | current=$1 23 | } 24 | active && $2 ~ /connected$/ { 25 | exit 26 | } 27 | $2 == "connected" && $3 ~ /^[0-9]/ { 28 | active=1 29 | print $1 30 | } 31 | END { 32 | print current 33 | } 34 | ') 35 | 36 | if [[ "$display" && "$current" ]]; then 37 | for res in "${reslist[@]}"; do 38 | if grep -q "$res" <<< "$supported"; then 39 | xrandr --output "$display" --mode "$res" 40 | changed=1 41 | break 42 | fi 43 | done 44 | fi 45 | 46 | cd "$dir" 47 | "$dir"/Machinarium 48 | 49 | if [[ "$display" && "$current" && "$changed" ]]; then 50 | xrandr --output "$display" --mode "$current" 51 | fi 52 | -------------------------------------------------------------------------------- /hooks/machinarium/machinarium.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Categories=Game; 5 | StartupNotify=true 6 | Terminal=false 7 | Name=Machinarium 8 | Icon=machinarium 9 | Exec=machinarium 10 | #Exec=/opt/machinarium/Machinarium 11 | Path=/opt/machinarium 12 | -------------------------------------------------------------------------------- /hooks/mcpixel_android_pc/mcpixel_android_pc.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # Custom install hook for Humble Bundle game McPixel 4 | 5 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | gamename=$5 12 | 13 | if [ $# -lt 3 ] ; then 14 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE" 15 | exit 1 16 | fi 17 | 18 | # Check if Adobe AIR is installed 19 | if ! dpkg -s 'adobeair' 1>/dev/null 2>&1 ; then 20 | ../../humblebundle --install adobeair 21 | fi 22 | 23 | echo "Installing $gamename" 24 | 25 | # Extract archive to a temp dir 26 | tempdir=$(mktemp -d) 27 | trap "rm -rf -- '$tempdir'" EXIT 28 | unzip -qo -d "$tempdir" "$archive" # an .air inside a zip. Nice job upstream! 29 | 30 | # Execute the installer 31 | "/usr/bin/Adobe AIR Application Installer" "$tempdir"/McPixel.air 32 | 33 | echo "Done!" 34 | -------------------------------------------------------------------------------- /hooks/mcpixel_android_pc/mcpixel_android_pc.uninstall.hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # Custom uninstall hook for Adobe AIR 4 | 5 | echo "Uninstalling McPixel" 6 | ../../humblebundle --uninstall mcpixel_android_pc --method apt 7 | echo "Done!" 8 | -------------------------------------------------------------------------------- /hooks/monsterlovesyou/monsterlovesyou.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Monster Loves You! 4 | 5 | # Copyright (C) 2015 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | hibname=$4 12 | gamename=$5 13 | 14 | if [ $# -lt 5 ] ; then 15 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE HIBNAME GAMENAME" 16 | exit 1 17 | fi 18 | 19 | exec="$dir"/'Monster Loves You.x86' 20 | icon="$dir"/'Monster Loves You_Data/Resources/UnityPlayer.png' 21 | size=128 # $(identify -format '%w' "$icon") 22 | uninstall="$dir"/uninstall 23 | desktop="$dir"/"$basename".desktop 24 | 25 | echo "Installing $gamename" 26 | 27 | # Create install dir 28 | mkdir -p "$dir" 29 | 30 | # Extract archive 31 | unzip -qo -d "$dir" "$archive" 32 | 33 | # create uninstall script 34 | cat > "$uninstall" <<-EOF 35 | #!/bin/sh -e 36 | 37 | # $gamename uninstall script 38 | # Generated by Humble Bundle automated installer 39 | # https://github.com/MestreLion/humblebundle 40 | 41 | echo "Uninstalling $gamename" 42 | xdg-desktop-menu uninstall "$basename.desktop" 43 | xdg-icon-resource uninstall --size $size "$basename" 44 | rm -rf "$dir" 45 | echo "Done" 46 | EOF 47 | chmod +x "$uninstall" 48 | 49 | # Install Icon 50 | # Workaround spaces in filename, as xdg-icon-resource does not handle them 51 | # see https://bugs.freedesktop.org/show_bug.cgi?id=91758 52 | newicon="$dir"/"$basename"."${icon##*.}" 53 | cp "$icon" "$newicon" 54 | xdg-icon-resource install --novendor --size "$size" "$newicon" "$basename" 55 | 56 | # Create and install Launcher 57 | cat > "$desktop" <<-EOF 58 | [Desktop Entry] 59 | Version=1.0 60 | Type=Application 61 | Name=${gamename} 62 | Comment=Live the life of a Monster, from birth to elderhood and beyond 63 | Categories=Game; 64 | Terminal=false 65 | StartupNotify=true 66 | Path=$(printf '%q' "$dir") 67 | Icon=$basename 68 | Exec=$(printf '%q' "$exec") 69 | EOF 70 | xdg-desktop-menu install --novendor "$desktop" 71 | 72 | echo "Done!" 73 | -------------------------------------------------------------------------------- /hooks/nightsky_android_pc/nightsky_android_pc.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Night Sky 4 | 5 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | gamename=$5 12 | iconurl=$6 13 | 14 | if [ $# -lt 3 ] ; then 15 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE" 16 | exit 1 17 | fi 18 | 19 | if [ "$(uname -m)" = "x86_64" ] ; then 20 | arch=_64 21 | else 22 | arch= 23 | fi 24 | 25 | exec="$dir"/NightSkyHD$arch 26 | icon="$dir"/"$basename".png 27 | uninstall="$dir"/uninstall 28 | desktop="$dir"/"$basename".desktop 29 | 30 | echo "Installing $gamename" 31 | 32 | # Create install dir 33 | mkdir -p "$dir" 34 | 35 | # Extract archive 36 | tar -xf "$archive" --strip 1 --directory "$dir" 37 | 38 | # create uninstall script 39 | cat > "$uninstall" <<-EOF 40 | #!/bin/sh -e 41 | 42 | # $gamename uninstall script 43 | # Generated by Humble Bundle automated installer 44 | # https://github.com/MestreLion/humblebundle 45 | 46 | echo "Uninstalling $gamename" 47 | xdg-desktop-menu uninstall "$basename.desktop" 48 | rm -rf "$dir" 49 | echo "Done" 50 | EOF 51 | chmod +x "$uninstall" 52 | 53 | # Download icon 54 | wget -q "$iconurl" -O "$icon" 55 | 56 | # Create and install Launcher 57 | cat > "$desktop" <<-EOF 58 | [Desktop Entry] 59 | Version=1.0 60 | Type=Application 61 | Name=$gamename 62 | Categories=Game; 63 | Terminal=false 64 | StartupNotify=true 65 | Icon=$(printf '%q' "$icon") 66 | Path=$(printf '%q' "$dir") 67 | Exec=$(printf '%q' "$exec") 68 | EOF 69 | xdg-desktop-menu install --novendor "$desktop" 70 | 71 | echo "Done!" 72 | -------------------------------------------------------------------------------- /hooks/regencysolitaire/regencysolitaire.install.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Custom install hook for Humble Bundle game Regency Solitaire 4 | 5 | # Copyright (C) 2016 Rodrigo Silva (MestreLion) 6 | # License: GPLv3 or later. See 7 | 8 | basename=$1 9 | dir=$2 10 | archive=$3 11 | hibname=$4 12 | gamename=$5 13 | iconurl=$6 14 | 15 | if [ $# -lt 6 ] ; then 16 | echo "Usage: ${0##*/} BASENAME INSTALLDIR ARCHIVE _ GAMENAME ICON" 17 | exit 1 18 | fi 19 | 20 | uninstall="$dir"/uninstall 21 | desktop="$dir"/"$basename".desktop 22 | fakeroot="$dir"/fakeroot 23 | 24 | icon="$dir"/"$basename".png 25 | uninstall="$dir"/uninstall 26 | desktop="$dir"/"$basename".desktop 27 | wmclass=${exec##*/} 28 | 29 | echo "Installing $gamename" 30 | 31 | # Create install dir 32 | mkdir -p "$dir" 33 | 34 | # Extract archive 35 | tar -xf "$archive" --strip-components=1 --directory "$dir" 36 | 37 | exec="$dir"/RegencySolitaire 38 | 39 | # create uninstall script 40 | cat > "$uninstall" <<-EOF 41 | #!/bin/sh -e 42 | 43 | # $gamename uninstall script 44 | # Generated by Humble Bundle automated installer 45 | # https://github.com/MestreLion/humblebundle 46 | 47 | echo "Uninstalling $gamename" 48 | xdg-desktop-menu uninstall "$basename.desktop" 49 | rm -rf "$dir" 50 | echo "Done" 51 | EOF 52 | chmod +x "$uninstall" 53 | 54 | # Download icon 55 | wget -q "$iconurl" -O "$icon" 56 | 57 | # Create and install Launcher 58 | cat > "$desktop" <<-EOF 59 | [Desktop Entry] 60 | Version=1.0 61 | Type=Application 62 | Name=${gamename} 63 | Categories=Game; 64 | Terminal=false 65 | StartupNotify=true 66 | StartupWMClass=${wmclass} 67 | Path=$(printf '%q' "$dir") 68 | Icon=$(printf '%q' "$icon") 69 | Exec=$(printf '%q' "$exec") 70 | EOF 71 | xdg-desktop-menu install --novendor "$desktop" 72 | 73 | echo "Done!" 74 | -------------------------------------------------------------------------------- /httpbot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright (C) 2012 Rodrigo Silva (MestreLion) 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. See 18 | # 19 | # urllib2 wrapper for a simpler, higher-level API 20 | 21 | import os 22 | import sys 23 | import urllib 24 | import logging 25 | import hashlib 26 | 27 | if sys.version_info.major < 3: 28 | import urllib2 # @UnresolvedImport 29 | import urlparse # @UnresolvedImport 30 | HTTPError = urllib2.HTTPError 31 | else: 32 | import urllib.request as urllib2 33 | import urllib.parse as urlparse 34 | urllib.unquote = urlparse.unquote 35 | HTTPError = urllib.error.HTTPError 36 | 37 | 38 | from lxml import html # Debian/Ubuntu: python-lxml 39 | try: 40 | import progressbar # Debian/Ubuntu: python-progressbar 41 | except ImportError: 42 | progressbar = None 43 | 44 | 45 | log = logging.getLogger(__name__) 46 | 47 | class HttpBot(object): 48 | """ Base class for other handling basic http tasks like requesting a page, 49 | download a file and cache content. Not to be used directly 50 | """ 51 | def __init__(self, base_url="", tag="", cookiejar=None, debug=False): 52 | self.tag = tag 53 | hh = urllib2.HTTPHandler( debuglevel=1 if debug else 0) 54 | hsh = urllib2.HTTPSHandler(debuglevel=1 if debug else 0) 55 | cp = urllib2.HTTPCookieProcessor(cookiejar) 56 | self._opener = urllib2.build_opener(hh, hsh, cp) 57 | scheme, netloc, path, q, f = urlparse.urlsplit(base_url, "http") 58 | if not netloc: 59 | netloc, _, path = path.partition('/') 60 | self.base_url = urlparse.urlunsplit((scheme, netloc, path, q, f)) 61 | 62 | def get(self, url, postdata=None): 63 | """ Send an HTTP request, either GET (if no postdata) or POST 64 | Keeps session and other cookies. 65 | postdata is a dict with name/value pairs 66 | url can be absolute or relative to base_url 67 | """ 68 | url = urlparse.urljoin(self.base_url, url) 69 | if postdata: 70 | return self._opener.open(url, urllib.urlencode(postdata)) 71 | else: 72 | return self._opener.open(url) 73 | 74 | def download(self, url, path=None, md5sum=None, expected_size=0, 75 | progress=True, keep_partial=False, chunk_size=0): 76 | show = progress and progressbar 77 | chunk_size = chunk_size or 32*1024 # 32K is arbitrary 78 | 79 | download = self.get(url) 80 | 81 | # Set download path 82 | # If save name is not set, use the downloaded file name 83 | # "Not set" means either path is an existing dir or ends with a trailing '/' 84 | path = os.path.expanduser(path or ".") 85 | if os.path.isdir(path) or not os.path.basename(path): 86 | #TODO: Parse Content-Disposition header for filename 87 | basename = urllib.unquote(os.path.basename 88 | (urlparse.urlsplit(download.geturl()).path)) 89 | path = os.path.join(path, basename) 90 | log.info("Downloading to %s", path) 91 | 92 | # Handle dir 93 | dirname, _ = os.path.split(path) 94 | try: 95 | log.debug("Creating destination directory %s", dirname) 96 | os.makedirs(dirname) 97 | except OSError as e: 98 | # Ignore if destination directory exists, raise otherwise 99 | if not (e.errno == 17 and os.path.isdir(dirname)): 100 | raise 101 | 102 | size = expected_size or int(download.info().get('Content-Length', 0)) 103 | if md5sum and os.path.isfile(path) and os.path.getsize(path) == size: 104 | log.debug("File already exists, checking its MD5") 105 | if filehash(path, hashlib.md5()) == md5sum: 106 | log.debug("MD5 matches, skipping download and using cached file") 107 | return path 108 | else: 109 | log.debug("MD5 does not match, downloading") 110 | 111 | if show: 112 | pbar = progressbar.ProgressBar(widgets=[ 113 | ' ', progressbar.Percentage(), ' of %.1f MiB' % (size/1024.0**2), 114 | ' ', progressbar.Bar('.'), 115 | ' ', progressbar.FileTransferSpeed(), 116 | ' ', progressbar.ETA(), 117 | ' '], maxval=size).start() 118 | 119 | # TODO: Perhaps overkill, but network read and md5/sha1/disk write could be done async 120 | # Could save around 30s for a 1-GiB file 121 | completed = False 122 | try: 123 | with open(path, 'wb') as f: 124 | for data in iter(lambda: download.read(chunk_size), b''): 125 | f.write(data) 126 | if show: 127 | pbar.update(min([size, pbar.value + chunk_size])) 128 | completed = True 129 | except KeyboardInterrupt: 130 | pass 131 | finally: 132 | if show: 133 | pbar.finish() 134 | if not completed: 135 | log.warning("Download aborted") 136 | if not keep_partial: 137 | log.debug("Removing partial file") 138 | os.remove(path) 139 | 140 | if completed: 141 | if not md5sum: 142 | return path 143 | 144 | realhash = filehash(path, hashlib.md5()) 145 | if md5sum == realhash: 146 | log.debug("Download MD5 match: %s", md5sum) 147 | return path 148 | else: 149 | log.warning("Download MD5 does not match - file is likely corrupt.") 150 | log.debug("Expected and downloaded MD5:\n%s\n%s", md5sum, realhash) 151 | 152 | def quote(self, text): 153 | """ Quote a text for URL usage, similar to urllib.quote_plus. 154 | Handles unicode and also encodes "/" 155 | """ 156 | if isinstance(text, unicode): 157 | text = text.encode('utf-8') 158 | return urllib.quote_plus(text, safe=b'') 159 | 160 | def parse(self, url, postdata=None): 161 | """ Parse an URL and return an etree ElementRoot. 162 | Assumes UTF-8 encoding 163 | """ 164 | return html.parse(self.get(url, postdata), 165 | parser=html.HTMLParser(encoding='utf-8')) 166 | 167 | 168 | def filehash(path, hashobj=None, chunk_size=0): 169 | hashobj = hashobj or hashlib.md5() 170 | chunk = chunk_size or 32*1024 171 | with open(path, 'rb') as f: 172 | for data in iter(lambda: f.read(chunk), b''): 173 | hashobj.update(data) 174 | return hashobj.hexdigest() 175 | -------------------------------------------------------------------------------- /humblebundle.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # humblebundle - Manager for Humble Bundle games and bundles 5 | # 6 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. See 20 | 21 | # TODO: 22 | # - INI-format config file for non-auth settings like arch-pref, debug level 23 | # - Log to file, with debug or info level 24 | # - Add --clear-cache, --clear-credentials, --clear-data, and --purge 25 | 26 | HB_USERNAME = "" 27 | HB_PASSWORD = "" 28 | 29 | import os 30 | import os.path as osp 31 | import sys 32 | import re 33 | import json 34 | import logging 35 | import argparse 36 | import time 37 | import threading 38 | import subprocess 39 | import shlex 40 | import shutil 41 | 42 | try: 43 | import cookielib 44 | from urlparse import urljoin, urlsplit, parse_qs 45 | import Queue 46 | except ImportError: # Python 3 47 | import http.cookiejar as cookielib 48 | from urllib.parse import urljoin, urlsplit, parse_qs 49 | import queue as Queue 50 | 51 | # Debian/Ubuntu: python[3]-xdg 52 | # PyPI: pyxdg 53 | import xdg.BaseDirectory as xdg 54 | 55 | try: 56 | # Debian/Ubuntu: python[3]-keyring 57 | # PyPI: keyring 58 | import keyring 59 | except ImportError: 60 | keyring = None 61 | 62 | 63 | import httpbot 64 | 65 | 66 | log = logging.getLogger(__name__) 67 | 68 | 69 | # Defaults are suitable for usage as a library (imported module) 70 | # They're changed when used as a script to adjust for __name__ 71 | APPNAME = __name__ 72 | DATADIR = osp.dirname(osp.realpath(__file__)) 73 | CONFIGDIR = osp.join(xdg.xdg_config_home, APPNAME) 74 | CACHEDIR = osp.join(xdg.xdg_cache_home, APPNAME) 75 | AUTHFILE = osp.join(CONFIGDIR, "login.auth") 76 | COOKIEJAR = osp.join(CONFIGDIR, "cookies.txt") 77 | 78 | 79 | class HumbleBundleError(Exception): 80 | pass 81 | 82 | class HumbleBundle(httpbot.HttpBot): 83 | 84 | name = "Humble Bundle" 85 | url = "https://www.humblebundle.com" 86 | auth_urls = ("/login", "/user/humbleguard") 87 | 88 | def __init__(self, username=None, password=None, auth=None, code=None, 89 | datadir=None, configdir=None, cachedir=None, cookiejar=None, 90 | debug=False): 91 | self.username = username 92 | self.password = password 93 | 94 | self.datadir = datadir or DATADIR 95 | self.configdir = configdir or CONFIGDIR 96 | self.cachedir = cachedir or CACHEDIR 97 | 98 | if not os.path.isdir(self.configdir): 99 | # Create the config dir as xdg would. Let exceptions bubble up 100 | os.makedirs(self.configdir, 0o700) 101 | 102 | self.cookiejar = cookielib.MozillaCookieJar(filename=(cookiejar or 103 | COOKIEJAR)) 104 | try: 105 | self.cookiejar.load() 106 | except (IOError, cookielib.LoadError) as e: 107 | log.error('Error reading cookies: %s', e) 108 | 109 | if auth: 110 | log.info("Injecting authenticated cookie") 111 | expires = int(auth.split('|')[1]) + 730 * 24 * 60 * 60 112 | cookie = cookielib.Cookie(version = 0, 113 | name = '_simpleauth_sess', 114 | value = auth, 115 | port = None, 116 | port_specified = False, 117 | domain = urlsplit(self.url)[1], 118 | domain_specified = False, 119 | domain_initial_dot = False, 120 | path = '/', 121 | path_specified = False, 122 | secure = True, 123 | expires = expires, 124 | discard = False, 125 | comment = None, 126 | comment_url = None, 127 | rest={},) 128 | self.cookiejar.set_cookie(cookie) 129 | 130 | super(HumbleBundle, self).__init__(self.url, 131 | tag=APPNAME, 132 | cookiejar=self.cookiejar, 133 | debug=debug) 134 | 135 | if code: 136 | log.info("Validating browser code at '%s/user/humbleguard'", 137 | self.url) 138 | try: 139 | # Load coockies in unlikely case that cookies.txt was not present 140 | self.get("/") 141 | token = None 142 | for cookie in self.cookiejar: 143 | if cookie.name == 'csrf_cookie': 144 | token = cookie.value 145 | if token is None: 146 | raise HumbleBundleError("Missing CSRF token") 147 | self.get("/user/humbleguard", 148 | {'goto': "/home", 149 | 'qs' : "", 150 | '_le_csrf_token' : token, 151 | 'code': code.upper()}) 152 | except httpbot.HTTPError as e: 153 | raise HumbleBundleError("Incorrect browser verification code") 154 | 155 | # "purchases" in the website. May be non-bundle like Store Purchases 156 | self.bundles = {} 157 | # "subproducts" in json. May be not a game, like Soundtracks and eBooks 158 | self.games = {} 159 | 160 | # Load bundles and games 161 | try: 162 | with open(osp.join(self.configdir, "bundles.json")) as fp1: 163 | with open(osp.join(self.configdir, "games.json")) as fp2: 164 | self.bundles = json.load(fp1) 165 | self.games = json.load(fp2) 166 | log.info("Loaded %d games from %d bundles", 167 | len(self.games), 168 | len(self.bundles)) 169 | self._merge() 170 | except IOError: 171 | self.update() 172 | 173 | 174 | def _merge(self): 175 | # Merge extras 176 | extras = osp.join(self.datadir, "extras.json") 177 | log.debug("Merging extras from %s", extras) 178 | try: 179 | with open(extras) as fp: 180 | games = json.load(fp) 181 | self.games.update(games) 182 | except (IOError, ValueError) as e: 183 | log.warning("Error merging extras: %s", e) 184 | 185 | # Merge install instructions 186 | self.gamedata = osp.join(self.datadir, "gamedata.json") 187 | log.debug("Merging games install data from %s", self.gamedata) 188 | try: 189 | with open(self.gamedata) as fp: 190 | games = json.load(fp) 191 | for game in self.games: 192 | self.games[game].update(games.get(game, {})) 193 | except (IOError, ValueError) as e: 194 | log.warning("Error merging games install data: %s", e) 195 | 196 | 197 | def update(self): 198 | '''Fetch all bundles and games from the server, rebuilding the cache''' 199 | self.bundles = {} 200 | self.games = {} 201 | 202 | # Get the keys 203 | log.info("Retrieving keys from '%s/home/keys'", self.url) 204 | match = re.search(r'^.*[\'"]?gamekeys[\'"]?\s*[:=]\s*(\[.*\])', 205 | self.get('/home/keys').read().decode('utf-8'), 206 | re.MULTILINE) 207 | if not match: 208 | raise HumbleBundleError("GameKeys list not found") 209 | 210 | # Loop the bundles 211 | queue = Queue.Queue() 212 | keys = json.loads(match.groups()[0]) 213 | for key in keys: 214 | t = threading.Thread(target=self._load_key, args=(key, True, queue)) 215 | t.daemon = True 216 | t.start() 217 | 218 | for __ in range(len(keys)): 219 | bundle, games = queue.get() 220 | self.bundles.update(bundle) 221 | self.games.update(games) 222 | 223 | log.info("Updated %d games from %d bundles", 224 | len(self.games), 225 | len(self.bundles)) 226 | self._merge() 227 | self._save_data() 228 | 229 | 230 | def _save_data(self): 231 | for obj in ['bundles', 'games']: 232 | path = osp.join(self.configdir, "%s.json" % obj) 233 | try: 234 | with open(path, 'w') as f: 235 | json.dump(getattr(self, obj), f, 236 | indent=2, separators=(',', ': '), sort_keys=True) 237 | os.chmod(path, 0o600) 238 | except IOError as e: 239 | log.error("Error saving cache data: %s", e) 240 | 241 | 242 | def _load_key(self, key, batch=False, queue=None): 243 | 244 | url = "/api/v1/order/%s" % key 245 | log.info("Retrieving purchase info from '%s%s'", self.url, url) 246 | bundle = json.load(self.get(url)) 247 | bundle['games'] = [] # made-up field: list of games it contains 248 | bundlekey = bundle['product']['machine_name'] 249 | 250 | # Loop each game in the bundle 251 | games = {} 252 | for game in bundle['subproducts']: 253 | gamekey = game['machine_name'] 254 | 255 | # Add game name to its bundle game list 256 | bundle['games'].append(gamekey) 257 | 258 | # Add custom fields and insert game in games dict (overwriting) 259 | game['bundle'] = bundlekey # made-up field: bundle it was retrieved from 260 | games[gamekey] = game 261 | 262 | # remove the now redundant "subproducts" list 263 | del bundle['subproducts'] 264 | 265 | # Remove useless fields, that may not be present anyway 266 | bundle.pop('subscriptions', None) 267 | 268 | # Move 'products' sub-dict to root 269 | for k, v in bundle['product'].items(): 270 | bundle[k] = v 271 | del bundle['product'] 272 | 273 | # Sort games list 274 | bundle['games'].sort() 275 | 276 | # Batch-processing: do not update nor save bundles and games dict 277 | if batch: 278 | out = ({bundlekey:bundle}, games) 279 | if queue: 280 | queue.put(out) 281 | return 282 | else: 283 | return out 284 | 285 | # Add bundle to bundles list 286 | self.games.update(games) 287 | self.bundles[bundlekey] = bundle 288 | self._save_data() 289 | 290 | 291 | def download(self, name, path=None, bittorrent=False, 292 | dtype=None, arch=None, platform=None, serverfile=None, 293 | type_pref=".deb", arch_pref="64", 294 | retry=True): 295 | 296 | game = self.get_game(name) 297 | d = self._choose_download(name=name, dtype=dtype, arch=arch, 298 | platform=platform, serverfile=serverfile, 299 | type_pref=type_pref, arch_pref=arch_pref) 300 | if not d: 301 | return 302 | 303 | # MD5 sum matches direct download files, not .torrent ones. 304 | if bittorrent: 305 | md5 = None 306 | else: 307 | md5 = d.get('md5', '').lower() or None 308 | 309 | url = d['url'].get('bittorrent' if bittorrent else 'web','') 310 | if not url: 311 | log.error("Selected download has no URL") 312 | return 313 | 314 | # Check if URL has expired 315 | try: 316 | ttl = int(parse_qs(urlsplit(url).query)['ttl'][0]) 317 | except KeyError: 318 | ttl = 0 # No TTL 319 | except (IndexError, ValueError) as e: 320 | ttl = -1 # Invalid TTL 321 | if ttl and ttl < time.time(): 322 | if not retry: 323 | raise HumbleBundleError("Game data for '%s' expired %s." % 324 | (name, time.ctime(ttl))) 325 | 326 | log.debug("Game data for '%s' expired %s, will update and retry.", 327 | name, time.ctime(ttl)) 328 | self._load_key(self.bundles.get(game.get('bundle', ''), 329 | {}).get('gamekey', '')) 330 | return self.download(name=name, 331 | path=path, 332 | dtype=dtype, 333 | arch=arch, 334 | platform=platform, 335 | bittorrent=bittorrent, 336 | type_pref=type_pref, 337 | arch_pref=arch_pref, 338 | serverfile=serverfile, 339 | retry=False) 340 | 341 | print("Downloading '%s' [%s]\t%s" % ( 342 | game['human_name'], game['machine_name'], self._download_info(d))) 343 | try: 344 | return super(HumbleBundle, self).download(url, path, md5) 345 | except httpbot.HTTPError as e: 346 | # Handle Unauthorized/Not Found (most likely outdated download URL) 347 | if not e.code in (403, 404): 348 | raise 349 | raise HumbleBundleError( 350 | "Download error: %d %s. URL may be outdated, try --update." % 351 | (e.code, e.reason)) 352 | 353 | def _download_basename(self, d): 354 | basename = osp.basename(urlsplit(d.get('url', {}).get('web', "")).path) 355 | return basename 356 | 357 | def _download_info(self, d): 358 | a = "\t(%s-bit)" % d['arch'] if d.get('arch', None) else "" 359 | return "\t\t%-20s%s\t%8s\t%s" % (d['name'], a, d['human_size'], 360 | self._download_basename(d)) 361 | 362 | 363 | def _choose_download(self, name, dtype=None, arch=None, platform=None, 364 | serverfile=None, type_pref=None, arch_pref=None): 365 | 366 | game = self.get_game(name) 367 | candidates = [] 368 | finalists = [] 369 | 370 | # Eliminate the ones that do not match the explicit request 371 | for plat in game.get('downloads', []): 372 | if plat.get('platform', '') == platform: 373 | for download in plat.get('download_struct', []): 374 | if download in candidates: 375 | continue 376 | if not download.get('url', ''): 377 | continue 378 | if (serverfile and 379 | serverfile.lower() != 380 | self._download_basename(download).lower()): 381 | continue 382 | if (dtype and 383 | dtype.lower() not in download.get('name','').lower()): 384 | continue 385 | if not download.get('arch', ''): 386 | if re.search('(?:32|64)[- ]?bit|i386|x86_64', 387 | download.get('name','')): 388 | if '64' in download['name']: 389 | download['arch'] = "64" 390 | else: 391 | download['arch'] = "32" 392 | if (arch and 393 | download.get('arch', '') and 394 | download['arch'] != arch): 395 | continue 396 | 397 | candidates.append(download) 398 | 399 | if len(candidates) == 1: 400 | return candidates[0] 401 | 402 | if len(candidates) == 0: 403 | log.error("No valid downloads for game '%s' [%s]\n\t criteria %r", 404 | game['human_name'], game['machine_name'], 405 | {'dtype':dtype, 406 | 'arch':arch, 407 | 'serverfile':serverfile, 408 | 'platform':platform}) 409 | return 410 | 411 | log.debug("Many download candidates for '%s' [%s]\n\tcriteria %r:\n%s", 412 | game['human_name'], game['machine_name'], 413 | {'dtype':dtype, 414 | 'arch':arch, 415 | 'serverfile':serverfile, 416 | 'platform':platform}, 417 | json.dumps(candidates, indent=2)) 418 | 419 | # Try type (download name) preference 420 | if not dtype and type_pref: 421 | for download in candidates: 422 | if type_pref.lower() in download.get('name', '').lower(): 423 | finalists.append(download) 424 | 425 | if len(finalists) == 1: 426 | return finalists[0] 427 | 428 | # Multiple finalists. Set them as next candidates 429 | # If no finalists, candidates remain the same 430 | if len(finalists) > 1: 431 | candidates = finalists[:] 432 | finalists = [] 433 | 434 | # Try arch preference 435 | if not arch and arch_pref: 436 | for download in candidates: 437 | if download.get('arch', '') and download['arch'] == arch_pref: 438 | finalists.append(download) 439 | 440 | if len(finalists) == 1: 441 | return finalists[0] 442 | 443 | # Try type again, with more restrictive matching 444 | if dtype: 445 | for rule in ('starts', 'is'): 446 | if finalists: 447 | candidates = finalists[:] 448 | finalists = [] 449 | for download in candidates: 450 | name = download.get('name', '').lower() 451 | if ((rule == 'is' and name == dtype.lower()) or 452 | (rule == 'starts' and name.startswith(dtype.lower()))): 453 | finalists.append(download) 454 | if len(finalists) == 1: 455 | return finalists[0] 456 | 457 | # Give up 458 | log.error("Too many download candidates for '%s' [%s]." 459 | " Improve criteria to narrow it down.%s", 460 | game['human_name'], game['machine_name'], 461 | "".join(["\n%s" % self._download_info(x) 462 | for x in finalists or candidates])) 463 | #log.debug("\n%s", json.dumps(finalists or candidates, indent=2)) 464 | return 465 | 466 | 467 | def install(self, name, method=None): 468 | # References: 469 | # Steam: https://developer.valvesoftware.com/wiki/Steam_browser_protocol 470 | # USC: https://software-center.ubuntu.com/subscriptions/ 471 | # Mojo: scripts/mojosetup_mainline.lua 472 | 473 | game = self.get_game(name) 474 | method = method or game.get('install', "").lower() 475 | 476 | def execute(command, cwd=None): 477 | return executecmd(shlex.split(command), cwd) 478 | 479 | def executecmd(command, cwd=None): 480 | try: 481 | log.debug("Executing: %s", command) 482 | subprocess.check_call(command, cwd=cwd) 483 | except (subprocess.CalledProcessError, OSError) as e: 484 | if getattr(e, 'errno', 0) == 2: # OSError, No such file or directory 485 | log.error("Error installing '%s': %s: %s", 486 | name, e.strerror, shlex.split(command)[0]) 487 | else: 488 | log.error("Error installing '%s': %s", name, e) 489 | 490 | def download(specs): 491 | for spec in specs: 492 | specs[spec] = game.get(spec, specs[spec]) 493 | specs['dtype'] = specs.pop('download', None) 494 | # make sure cachedir ends with a trailing slash, see HttpBot.download() 495 | return self.download(name, path=osp.join(self.cachedir, ''), **specs) 496 | 497 | if not method: 498 | raise HumbleBundleError("No install data for '%s', please check '%s'" 499 | " or use --method" % 500 | (name, self.gamedata)) 501 | 502 | elif method == "deb": 503 | specs = dict(download=None, arch=None, platform="linux", 504 | type_pref=".deb", arch_pref="64") 505 | deb = download(specs) 506 | if deb: 507 | execute("sudo dpkg --force-depends --install '%s'" % deb) 508 | execute("sudo apt-get --yes --fix-broken install") 509 | 510 | elif method == "apt": 511 | package = game.get("package", name) 512 | execute('sudo apt-get install --yes "%s"' % package) 513 | 514 | elif method == "steam": 515 | try: 516 | execute("steam steam://install/%d" % game['steamid']) 517 | except KeyError: 518 | raise HumbleBundleError( 519 | "No steamid for steam-installable game '%s'" % name) 520 | 521 | elif method == "mojo": 522 | specs = dict(download=None, arch=None, platform="linux", 523 | type_pref="sh", arch_pref="64") 524 | installer = download(specs) 525 | if not installer: 526 | raise HumbleBundleError( 527 | "Could not download installer for game '%s'" % name) 528 | 529 | path = osp.join(osp.expanduser("~/.local/opt"), 530 | game.get('mojoname', name.split("_", 1)[0].title())) 531 | execute("chmod +x '%s'" % installer) 532 | execute("'%s' -- --destination '%s' --noreadme --noprompt" 533 | " --nooptions --i-agree-to-all-licenses" % 534 | (installer, path)) 535 | 536 | elif method == "air": 537 | specs = dict(download=None, arch=None, platform="linux", 538 | type_pref="air", arch_pref="64") 539 | installer = download(specs) 540 | if not installer: 541 | raise HumbleBundleError( 542 | "Could not download installer for game '%s'" % name) 543 | 544 | adobeair = "/usr/bin/Adobe AIR Application Installer" 545 | if not osp.isfile(adobeair): 546 | self.install('adobeair') 547 | execute("'%s' '%s'" % (adobeair, installer)) 548 | 549 | elif method == "custom": 550 | specs = dict(download=None, arch=None, platform="linux", 551 | type_pref=None, arch_pref="64") 552 | archive = download(specs) 553 | if not archive: 554 | raise HumbleBundleError( 555 | "Could not download installer for game '%s'" % name) 556 | 557 | hookdir = osp.join(self.datadir, "hooks", name) 558 | hookfile = osp.join(hookdir, "%s.install.hook" % name) 559 | basename = game.get('basename', name.split("_", 1)[0]) 560 | # FIXME: Make sure basename is valid: single word, no punc, etc 561 | installdir = osp.join(osp.expanduser("~"), '.local', 'opt', 562 | game.get('dirname', basename)) 563 | executecmd([hookfile, 564 | basename, 565 | installdir, 566 | osp.abspath(archive), 567 | name, 568 | game.get('human_name', ''), 569 | game.get('icon', '')], 570 | cwd=hookdir) 571 | 572 | else: 573 | log.error("Invalid install method for '%s': '%s'", name, method) 574 | 575 | 576 | def uninstall(self, name, method=None): 577 | game = self.get_game(name) 578 | method = method or game.get('install', "").lower() 579 | command = "" 580 | installdir = "" 581 | popenargs = {} 582 | 583 | if not method: 584 | raise HumbleBundleError("No install data for '%s'," 585 | " please check '%s'" % 586 | (name, self.gamedata)) 587 | 588 | elif method in ["deb", "apt", "air"]: 589 | package = game.get("package", name) 590 | command = 'sudo apt-get remove --auto-remove --yes "%s"' % package 591 | 592 | elif method == "steam": 593 | try: 594 | command = "steam steam://uninstall/%d" % game['steamid'] 595 | except KeyError: 596 | raise HumbleBundleError( 597 | "No steamid for steam-installable game '%s'" % name) 598 | 599 | elif method == "mojo": 600 | mojoname = game.get('mojoname', name.split("_", 1)[0].title()) 601 | installdir = osp.join(osp.expanduser("~"), '.local', 'opt', mojoname) 602 | uninstaller = osp.join(installdir, "uninstall-%s.sh" % mojoname) 603 | command = "'%s' --noprompt" % uninstaller 604 | # "Disable" install dir removal as user can cancel uninstall in GUI 605 | installdir = "" 606 | 607 | elif method == "custom": 608 | basename = game.get('basename', name.split("_", 1)[0]) 609 | uninstaller = osp.join(osp.expanduser("~"), '.local', 'opt', 610 | game.get('dirname', basename), "uninstall") 611 | if not osp.isfile(uninstaller): 612 | hookdir = osp.join(self.datadir, "hooks", name) 613 | uninstaller = osp.join(hookdir, "%s.uninstall.hook" % name) 614 | popenargs['cwd'] = hookdir 615 | command = "'%s'" % uninstaller 616 | 617 | else: 618 | log.error("Invalid uninstall method for '%s': '%s'", name, method) 619 | 620 | if not command: 621 | return 622 | 623 | try: 624 | log.debug("Executing: %s", command) 625 | subprocess.check_call(shlex.split(command), **popenargs) 626 | if installdir: 627 | log.debug("Removing '%s'", installdir) 628 | shutil.rmtree(installdir, ignore_errors=True) 629 | except (subprocess.CalledProcessError, OSError) as e: 630 | if getattr(e, 'errno', 0) == 2: # OSError, No such file or directory 631 | log.error("Error uninstalling '%s': %s: %s", 632 | name, e.strerror, shlex.split(command)[0]) 633 | else: 634 | log.error("Error uninstalling '%s': %s", name, e) 635 | 636 | 637 | def get_game(self, name): 638 | # Get game, if exists 639 | log.info("Retrieving game info for '%s'", name) 640 | try: 641 | return self.games[name] 642 | except KeyError: 643 | raise HumbleBundleError("Game not found: %s" % name) 644 | 645 | 646 | def get_bundle(self, name): 647 | # Get bundle, if exists 648 | log.info("Retrieving bundle info for '%s'", name) 649 | try: 650 | return self.bundles[name] 651 | except KeyError: 652 | raise HumbleBundleError("Bundle not found: %s" % name) 653 | 654 | 655 | def get(self, url, postdata=None): 656 | 657 | def urlabspath(url): 658 | return urlsplit(urljoin('/', url)).path.lower() 659 | 660 | def save_cookies(res, force=False): 661 | if force or 'Set-Cookie' in res.info(): 662 | log.debug("Saving cookies to '%s'", self.cookiejar.filename) 663 | try: 664 | self.cookiejar.save() 665 | os.chmod(self.cookiejar.filename, 0o600) 666 | except IOError as e: 667 | log.error("Error saving cookies: %s", e) 668 | 669 | requested_url = urlabspath(url) 670 | current_url = "" 671 | try: 672 | res = super(HumbleBundle, self).get(url, postdata) 673 | save_cookies(res) 674 | # Was it successful? That is, not redirected TO an authorization 675 | # page that requires special handling. 676 | current_url = urlabspath(res.geturl()) 677 | if (current_url == requested_url or 678 | current_url not in self.auth_urls): 679 | return res 680 | except httpbot.HTTPError as e: 681 | # Unauthorized (requires login) or something else? 682 | if not e.code == 401: 683 | raise 684 | 685 | # Humble Guard (Browser Verification Code sent via email) 686 | if current_url == "/user/humbleguard": 687 | raise HumbleBundleError( 688 | "Browser verification code required." 689 | " Check your email and retry with --code") 690 | 691 | # Login form 692 | if not (self.username and self.password): 693 | raise HumbleBundleError( 694 | "Username or password are blank. " 695 | "Set with --username and --password and try again") 696 | 697 | log.info("Authenticating at '%s/processlogin'", self.url) 698 | 699 | try: 700 | # Could also get the token from res.headers.get("Set-Cookie") 701 | token = re.search(r"\s+value=['\"]([^'\"]+)['\"]", 702 | re.search(r"(]*\s+name\s*=\s*" 703 | "['\"]_le_csrf_token['\"][^>]*>)", 704 | res.read()).groups()[0]).groups()[0] 705 | except Exception as e: 706 | raise HumbleBundleError("Could not retrieve token: %r", e) 707 | 708 | try: 709 | res = super(HumbleBundle, self).get("/processlogin", 710 | {'goto' : url, 711 | 'username': self.username, 712 | 'password': self.password, 713 | '_le_csrf_token': token}) 714 | save_cookies(res, force=True) 715 | 716 | except httpbot.HTTPError as e: 717 | # 'Bad Request', 'Unauthorized' or 'Forbidden' are expected 718 | # in case of wrong passwords 719 | if e.code in [400, 401, 403]: 720 | raise HumbleBundleError( 721 | "Could not log in. Either username/password are" 722 | " not correct, or a ReCaptcha validation is required." 723 | " Log in using a real browser, inspect the cookies created" 724 | " and provide the value of _simpleauth_sess with --auth") 725 | raise 726 | 727 | # Was it already redirected to the page requested? 728 | if requested_url == urlabspath(res.geturl()): 729 | return res 730 | 731 | return self.get(url, postdata) 732 | 733 | 734 | 735 | def main(argv=None): 736 | if argv == None: 737 | argv = sys.argv[1:] 738 | args, parser = parseargs(argv) 739 | logging.basicConfig(level=getattr(logging, args.loglevel.upper(), None), 740 | format='%(asctime)s\t%(levelname)-8s\t%(message)s') 741 | log.debug(args) 742 | config = read_config(args) 743 | 744 | username = args.username or config['username'] or HB_USERNAME 745 | password = args.password or config['password'] or HB_PASSWORD 746 | 747 | hb = HumbleBundle(username, password, 748 | args.auth, args.code, 749 | debug=args.debug) 750 | 751 | if args.update: 752 | hb.update() 753 | 754 | if args.clear: 755 | clear_auth() 756 | 757 | if args.list is not None: 758 | games = hb.games 759 | if isinstance(args.list, str): 760 | games = {k: v for k, v in hb.games.items() if re.search(args.list, k)} 761 | 762 | if args.platform is not None: 763 | hasPlatform = lambda v, p: any(__ for __ in v['downloads'] if __['platform'] == p) 764 | games = {k: v for k, v in games.items() if hasPlatform(v, args.platform)} 765 | 766 | for key in sorted(games.keys()): 767 | print("%s" % (hb.games[key]['human_name'] if args.human else key)) 768 | 769 | elif args.show: 770 | def print_key(key, alias=None, obj=None): 771 | print("%-10s: %s" % (alias or key, 772 | getattr(obj or game, 'get')(key.lower(), ''))) 773 | 774 | game = hb.get_game(args.show) 775 | if args.json: 776 | print(json.dumps(game, indent=2, separators=(',', ': '), 777 | sort_keys=True)) 778 | return 779 | print_key('machine_name', 'Game') 780 | print_key('human_name', 'Name') 781 | print_key('human_name', 'Developer', obj=game.get('payee',{})) 782 | print_key('URL') 783 | print_key('', 'Bundles') 784 | for bundle in hb.bundles.itervalues(): 785 | if game.get('machine_name', '') in bundle.get('games', []): 786 | print("\t%s [%s]" % (bundle['human_name'], 787 | bundle['machine_name'])) 788 | print_key('', 'Downloads') 789 | platform_prev = None 790 | for download in sorted(game.get('downloads', []), 791 | key=lambda k: k['platform']): 792 | platform = download.get('platform', '') 793 | if platform_prev != platform: 794 | print("\t%s" % platform) 795 | platform_prev = platform 796 | for d in download.get('download_struct', []): 797 | if 'url' not in d: 798 | continue 799 | print(hb._download_info(d)) 800 | 801 | elif args.show_bundle: 802 | def print_key(key, alias=None, obj=None): 803 | print("%-10s: %s" % (alias or key, 804 | getattr(obj or bundle, 'get')(key.lower(), ''))) 805 | 806 | bundle = hb.get_bundle(args.show_bundle) 807 | if args.json: 808 | print(json.dumps(bundle, indent=2, separators=(',', ': '), 809 | sort_keys=True)) 810 | return 811 | print_key('machine_name', 'Bundle') 812 | print_key('human_name', 'Name') 813 | print_key('Category') 814 | print_key('familyamount', 'Price US$') 815 | print_key('', 'Games') 816 | for name in sorted(bundle['games']): 817 | game = hb.get_game(name) 818 | print("\t%s\t[%s]" % (game['human_name'], game['machine_name'])) 819 | 820 | elif args.list_bundles: 821 | for bundle in sorted(hb.bundles.items()): 822 | if args.human: 823 | print(bundle[1]['human_name']) 824 | else: 825 | print("%s\t%s" % (bundle[1]['machine_name'], 826 | bundle[1]['human_name'])) 827 | 828 | elif args.download: 829 | if not hb.download(name=args.download, 830 | path=args.path, 831 | dtype=args.type, 832 | arch=args.arch, 833 | bittorrent=args.bittorrent, 834 | platform=args.platform, 835 | serverfile=args.serverfile): 836 | return 1 837 | 838 | elif args.install: 839 | hb.install(args.install, args.method) 840 | 841 | elif args.uninstall: 842 | hb.uninstall(args.uninstall, args.method) 843 | 844 | else: 845 | if not (args.update or args.clear): 846 | parser.print_usage() 847 | 848 | 849 | def clear_auth(appname=None, authfile=None, cookiejar=None): 850 | '''Clear all authentication data and delete related files''' 851 | 852 | appname = appname or APPNAME 853 | authfile = authfile or AUTHFILE 854 | cookiejar = cookiejar or COOKIEJAR 855 | 856 | authfiles = [cookiejar] 857 | 858 | log.info("Clearing all authentication data") 859 | 860 | if keyring: 861 | try: 862 | log.debug("Removing credentials from keyring") 863 | keyring.delete_password(appname, appname) 864 | except AttributeError as e: 865 | log.warning("Error removing keyring credentials. Outdated library? (%s)", e) 866 | else: 867 | authfiles.append(authfile) 868 | 869 | for auth in authfiles: 870 | try: 871 | log.debug("Deleting '%s'", auth) 872 | os.remove(auth) 873 | except OSError as e: 874 | log.debug(e) 875 | 876 | log.info("Finished clearing authentication") 877 | 878 | 879 | def read_config(args, appname=None, authfile=None): 880 | appname = appname or APPNAME 881 | authfile = authfile or AUTHFILE 882 | 883 | username = "" 884 | password = "" 885 | 886 | # read 887 | if keyring: 888 | log.debug("Reading credentials from keyring") 889 | try: 890 | username, password = ( 891 | keyring.get_password(appname, appname).split('\n') + 892 | ['\n'] 893 | )[:2] 894 | except AttributeError as e: 895 | # Check for old keyring format and migrate before throwing warning 896 | data = keyring.get_password(appname, '') 897 | if data: 898 | log.info("Migrating credentials to new keyring format") 899 | keyring.set_password(appname, appname, data) 900 | try: 901 | keyring.delete_password(appname, '') 902 | except AttributeError as e: 903 | log.warning("Error deleting old keyring. Outdated library? (%s)", e) 904 | else: 905 | log.warning("Credentials not found in keyring. First time usage?") 906 | except IOError as e: # keyring sometimes raises this 907 | log.error(e) 908 | else: 909 | log.debug("Reading credentials from '%s'" % authfile) 910 | try: 911 | with open(authfile, 'r') as fd: 912 | username, password = (fd.read().splitlines() + ['\n'])[:2] 913 | except IOError as e: 914 | if e.errno == 2: # No such file or directory 915 | log.warning("Credentials file not found. First time usage?") 916 | else: 917 | log.error(e) 918 | 919 | # save 920 | if args.username or args.password: 921 | log.info("Saving credentials") 922 | if keyring: 923 | keyring.set_password(appname, appname, 924 | '%s\n%s' % (args.username or username, 925 | args.password or password,)) 926 | else: 927 | try: 928 | with open(authfile, 'w') as fd: 929 | fd.write("%s\n%s\n" % (args.username or username, 930 | args.password or password,)) 931 | os.chmod(authfile, 0o600) 932 | except IOError as e: 933 | log.error(e) 934 | 935 | return dict(username=username, 936 | password=password,) 937 | 938 | 939 | def parseargs(argv=None): 940 | parser = argparse.ArgumentParser( 941 | description="Humble Bundle Manager",) 942 | 943 | parser.add_argument('-v', '--verbose', dest='loglevel', 944 | action="store_const", 945 | const="info", default="warn", 946 | help="Output informative messages") 947 | parser.add_argument('-D', '--debug', dest='loglevel', 948 | action="store_const", const="debug", 949 | help="Output debug information") 950 | parser.add_argument('-u', '--update', dest='update', 951 | default=False, action="store_true", 952 | help="Fetch all games and bundles data from the server," 953 | " rebuilding the cache") 954 | 955 | group = parser.add_argument_group("Authentication Options") 956 | group.add_argument('-U', '--username', dest='username', 957 | help="Account login, the user's email") 958 | group.add_argument('-P', '--password', dest='password', 959 | help="Account password") 960 | group.add_argument('-A', '--auth', dest='auth', 961 | help="Account _simpleauth_sess cookie value") 962 | group.add_argument('-c', '--code', 963 | help="Browser verification code sent by email") 964 | group.add_argument('-C', '--clear', 965 | default=False, action="store_true", 966 | help="Clear all authentication data, deleting related files") 967 | 968 | group = parser.add_argument_group("Commands") 969 | group.add_argument('-l', '--list', dest='list', 970 | const=True, nargs='?', metavar="REGEX", 971 | help="List all available Games (Products)," 972 | " including Soundtracks and eBooks," 973 | " optionally filtered by REGEX. If --platform is given," 974 | " filter by platform also.") 975 | group.add_argument('-L', '--list-bundles', dest='list_bundles', 976 | default=False, action="store_true", 977 | help="List all available Bundles (Purchases), " 978 | "including Store Front (single product) purchases") 979 | group.add_argument('-s', '--show', dest='show', metavar="GAME", 980 | help="Show all info about selected game") 981 | group.add_argument('-S', '--show-bundle', dest='show_bundle', 982 | metavar="BUNDLE", 983 | help="Show all info about selected bundle") 984 | group.add_argument('-d', '--download', dest='download', metavar="GAME", 985 | help="Download the selected game") 986 | group.add_argument('-i', '--install', dest='install', metavar="GAME", 987 | help="Install selected game") 988 | group.add_argument('-I', '--uninstall', dest='uninstall', metavar="GAME", 989 | help="Uninstall selected game") 990 | 991 | group = parser.add_argument_group("List Options") 992 | group.add_argument('-H', '--human', dest='human', 993 | default=False, action="store_true", 994 | help="Output human-friendly game names in --list/--list-bundles") 995 | 996 | group = parser.add_argument_group("Show Options") 997 | group.add_argument('-j', '--json', dest='json', 998 | default=False, action="store_true", 999 | help="Output --show/--show-bundle in machine-readable," 1000 | " JSON format") 1001 | 1002 | group = parser.add_argument_group("Download Options") 1003 | group.add_argument('-t', '--type', dest='type', metavar="NAME", 1004 | help="Type (name) of the download," 1005 | " for example '.deb', 'mojo', 'flash', etc") 1006 | group.add_argument('-a', '--arch', dest='arch', choices=['32', '64'], 1007 | help="Download architecture: 32-bit (also known as i386)" 1008 | " or 64-bit (amd64, x86_64, etc)") 1009 | default = "linux" 1010 | group.add_argument('-p', '--platform', dest='platform', 1011 | default=default, 1012 | choices=['windows', 'mac', 'linux', 'android', 'audio', 1013 | 'ebook', 'comedy', 'video'], 1014 | help="Download platform. Default is '%s'" % default) 1015 | group.add_argument('-F', '--server-file', dest='serverfile', metavar="FILE", 1016 | help="Basename of the server file to download." 1017 | " Useful when no combination of --type, --arch" 1018 | " and --platform is enough to narrow down choices" 1019 | " to a single download.") 1020 | group.add_argument('-b', '--bittorrent', dest='bittorrent', 1021 | default=False, action="store_true", 1022 | help="Download bittorrent file instead of direct download") 1023 | group.add_argument('-f', '--path', dest='path', 1024 | help="Path to download. If PATH is a directory," 1025 | " default download basename will be used." 1026 | " If omitted, download to current directory.") 1027 | 1028 | group = parser.add_argument_group("Install Options") 1029 | group.add_argument('-m', '--method', dest='method', 1030 | choices=['custom', 'deb', 'apt', 'mojo', 'air', 'steam'], 1031 | help="Use this method instead of the default" 1032 | " for (un-)installing a game") 1033 | 1034 | args = parser.parse_args(argv) 1035 | args.debug = args.loglevel=='debug' 1036 | return args, parser 1037 | 1038 | 1039 | def cli(): 1040 | global APPNAME, CONFIGDIR, CACHEDIR, AUTHFILE, COOKIEJAR 1041 | 1042 | APPNAME = osp.basename(osp.splitext(__file__)[0]) 1043 | CONFIGDIR = xdg.save_config_path(APPNAME) # creates the dir 1044 | CACHEDIR = osp.join(xdg.xdg_cache_home, APPNAME) 1045 | AUTHFILE = osp.join(CONFIGDIR, "login.conf") 1046 | COOKIEJAR = osp.join(CONFIGDIR, "cookies.txt") 1047 | # No changes in DATADIR 1048 | 1049 | try: 1050 | sys.exit(main()) 1051 | 1052 | except KeyboardInterrupt: 1053 | pass 1054 | except HumbleBundleError as e: 1055 | log.critical(e) 1056 | sys.exit(1) 1057 | except Exception as e: 1058 | log.critical(e, exc_info=True) 1059 | sys.exit(1) 1060 | 1061 | 1062 | if __name__ == '__main__': 1063 | cli() 1064 | -------------------------------------------------------------------------------- /installers/adobeair.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "adobeair" 3 | -------------------------------------------------------------------------------- /installers/adobeair.uninstall: -------------------------------------------------------------------------------- 1 | adobeair.install -------------------------------------------------------------------------------- /installers/basementcollection.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "basementcollection" 3 | -------------------------------------------------------------------------------- /installers/basementcollection.uninstall: -------------------------------------------------------------------------------- 1 | basementcollection.install -------------------------------------------------------------------------------- /installers/bindingofisaac.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "bindingofisaac_dlc" 3 | -------------------------------------------------------------------------------- /installers/bindingofisaac.uninstall: -------------------------------------------------------------------------------- 1 | bindingofisaac.install -------------------------------------------------------------------------------- /installers/bit_trip_beat.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "bittripbeat" 3 | -------------------------------------------------------------------------------- /installers/bit_trip_beat.uninstall: -------------------------------------------------------------------------------- 1 | bit_trip_beat.install -------------------------------------------------------------------------------- /installers/bit_trip_runner.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "bittriprunner" 3 | -------------------------------------------------------------------------------- /installers/bit_trip_runner.uninstall: -------------------------------------------------------------------------------- 1 | bit_trip_runner.install -------------------------------------------------------------------------------- /installers/blastem.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "blastem" 3 | -------------------------------------------------------------------------------- /installers/blastem.uninstall: -------------------------------------------------------------------------------- 1 | blastem.install -------------------------------------------------------------------------------- /installers/canabalt.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "canabalt_android_and_pc" 3 | -------------------------------------------------------------------------------- /installers/canabalt.uninstall: -------------------------------------------------------------------------------- 1 | canabalt.install -------------------------------------------------------------------------------- /installers/crayonphysicsdeluxe.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "crayonphysicsdeluxe_android_pc_soundtrack" 3 | -------------------------------------------------------------------------------- /installers/crayonphysicsdeluxe.uninstall: -------------------------------------------------------------------------------- 1 | crayonphysicsdeluxe.install -------------------------------------------------------------------------------- /installers/dearesther.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "dearesther" 3 | -------------------------------------------------------------------------------- /installers/dearesther.uninstall: -------------------------------------------------------------------------------- 1 | dearesther.install -------------------------------------------------------------------------------- /installers/dontmove.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "dontmove" 3 | -------------------------------------------------------------------------------- /installers/dontmove.uninstall: -------------------------------------------------------------------------------- 1 | dontmove.install -------------------------------------------------------------------------------- /installers/drawastickman.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "drawastickmanepic_bundle" 3 | -------------------------------------------------------------------------------- /installers/drawastickman.uninstall: -------------------------------------------------------------------------------- 1 | drawastickman.install -------------------------------------------------------------------------------- /installers/fieldrunners.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "fieldrunners_android_pc_soundtrack" 3 | -------------------------------------------------------------------------------- /installers/fieldrunners.uninstall: -------------------------------------------------------------------------------- 1 | fieldrunners.install -------------------------------------------------------------------------------- /installers/fieldrunners2.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "fieldrunners2" 3 | -------------------------------------------------------------------------------- /installers/fieldrunners2.uninstall: -------------------------------------------------------------------------------- 1 | fieldrunners2.install -------------------------------------------------------------------------------- /installers/fractal.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "fractal" 3 | -------------------------------------------------------------------------------- /installers/fractal.uninstall: -------------------------------------------------------------------------------- 1 | fractal.install -------------------------------------------------------------------------------- /installers/greedcorp.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "greedcorp" 3 | -------------------------------------------------------------------------------- /installers/greedcorp.uninstall: -------------------------------------------------------------------------------- 1 | greedcorp.install -------------------------------------------------------------------------------- /installers/incredipede.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "incredipede" 3 | -------------------------------------------------------------------------------- /installers/incredipede.uninstall: -------------------------------------------------------------------------------- 1 | incredipede.install -------------------------------------------------------------------------------- /installers/lonesurvivor.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "lonesurvivor_linux" 3 | -------------------------------------------------------------------------------- /installers/lonesurvivor.uninstall: -------------------------------------------------------------------------------- 1 | lonesurvivor.install -------------------------------------------------------------------------------- /installers/machinarium.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "machinarium" 3 | -------------------------------------------------------------------------------- /installers/machinarium.uninstall: -------------------------------------------------------------------------------- 1 | machinarium.install -------------------------------------------------------------------------------- /installers/mcpixel.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "mcpixel_android_pc" 3 | -------------------------------------------------------------------------------- /installers/mcpixel.uninstall: -------------------------------------------------------------------------------- 1 | mcpixel.install -------------------------------------------------------------------------------- /installers/metalslug3.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "metalslug3" 3 | -------------------------------------------------------------------------------- /installers/metalslug3.uninstall: -------------------------------------------------------------------------------- 1 | metalslug3.install -------------------------------------------------------------------------------- /installers/monsterlosvesyou.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "monsterlovesyou" 3 | -------------------------------------------------------------------------------- /installers/monsterlosvesyou.uninstall: -------------------------------------------------------------------------------- 1 | monsterlosvesyou.install -------------------------------------------------------------------------------- /installers/nightsky.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "nightsky_android_pc" 3 | -------------------------------------------------------------------------------- /installers/nightsky.uninstall: -------------------------------------------------------------------------------- 1 | nightsky.install -------------------------------------------------------------------------------- /installers/offspringfling.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "offspringfling" 3 | -------------------------------------------------------------------------------- /installers/offspringfling.uninstall: -------------------------------------------------------------------------------- 1 | offspringfling.install -------------------------------------------------------------------------------- /installers/papoandyo.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "papoandyo" 3 | -------------------------------------------------------------------------------- /installers/papoandyo.uninstall: -------------------------------------------------------------------------------- 1 | papoandyo.install -------------------------------------------------------------------------------- /installers/regencysolitaire.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "regencysolitaire" 3 | -------------------------------------------------------------------------------- /installers/regencysolitaire.uninstall: -------------------------------------------------------------------------------- 1 | regencysolitaire.install -------------------------------------------------------------------------------- /installers/starseedpilgrim.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "starseedpilgrim" 3 | -------------------------------------------------------------------------------- /installers/starseedpilgrim.uninstall: -------------------------------------------------------------------------------- 1 | starseedpilgrim.install -------------------------------------------------------------------------------- /installers/swordsandsoldiers.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "swordsandsoldiers_android_and_pc" 3 | -------------------------------------------------------------------------------- /installers/swordsandsoldiers.uninstall: -------------------------------------------------------------------------------- 1 | swordsandsoldiers.install -------------------------------------------------------------------------------- /installers/torchlight.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "torchlight" 3 | -------------------------------------------------------------------------------- /installers/torchlight.uninstall: -------------------------------------------------------------------------------- 1 | torchlight.install -------------------------------------------------------------------------------- /installers/vessel.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "$(dirname "$0")"/../humblebundle.py --"${0##*.}" "vessel" 3 | -------------------------------------------------------------------------------- /installers/vessel.uninstall: -------------------------------------------------------------------------------- 1 | vessel.install -------------------------------------------------------------------------------- /makeinstall: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # makeinstall - Helper to create new game install scripts 4 | # 5 | # Copyright (C) 2014 Rodrigo Silva (MestreLion) 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | mydir=$(dirname "$(readlink -f "$0")") 21 | 22 | if ! [[ "$1" ]]; then 23 | echo "Usage: ${0##*/} [install script name]" 24 | exit 1 25 | fi 26 | 27 | humble=$1 28 | script=${2:-$humble} 29 | 30 | cd "$mydir"/installers 31 | 32 | cat > "$script".install <<-EOF 33 | #!/bin/sh 34 | "\$(dirname "\$0")"/../humblebundle.py --"\${0##*.}" "$humble" 35 | EOF 36 | 37 | ln -s "$script".{,un}install 38 | 39 | chmod +x "$script".install 40 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = humblebundle-manager 3 | version = 0.0.1 4 | description = Manages Humble Bundle games and bundles 5 | long_description = file: README.md 6 | long_description_content_type = text/markdown 7 | classifiers = 8 | Development Status :: 4 - Beta 9 | License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) 10 | Operating System :: OS Independent 11 | Programming Language :: Python 12 | Programming Language :: Python :: 2.7 13 | keywords = humblebundle 14 | author = Rodrigo Silva 15 | author_email = linux@rodrigosilva.com 16 | url = https://github.com/MestreLion/humblebundle 17 | license = GPLv3+ 18 | license_files = LICENSE.txt 19 | project_urls = 20 | Source Code = https://github.com/MestreLion/humblebundle 21 | 22 | [options] 23 | zip_safe = True 24 | include_package_data = True 25 | install_requires = 26 | lxml 27 | progressbar 28 | keyring 29 | pyxdg 30 | dbus-python; platform_system=='Linux' 31 | secretstorage; platform_system=='Linux' 32 | setup_requires = 33 | setuptools >=38.3.0 34 | py_modules = 35 | httpbot 36 | humblebundle 37 | 38 | [options.entry_points] 39 | console_scripts = 40 | humblebundle = humblebundle:cli 41 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup() 4 | -------------------------------------------------------------------------------- /todo.txt: -------------------------------------------------------------------------------- 1 | CODE IDEAS: 2 | self._data = { keys: [], bundles: {}, games: {} }, @property for self.games, self.bundles 3 | update _data as: for key self_data['games'].update( returned from _load_key() ) 4 | --machine|-m output json 5 | --method|-m, package, mojoname, etc for customizing install 6 | user gamedata.json: to customize 7 | user gamedata.uninstall.json: save installed game info, prevent future changes to global to affect uninstall 8 | def json_save(obj, file, *args, **kwargs): open(file, 'w') as f:, json.dump(obj, f, *args, **kwargs), write(warning header), os.chmod(600) 9 | auto-detect pref arch 10 | notification bubbles for install and uninstall (controlled by -g/--gui or -G/--no-gui) 11 | decent config file for preferences! 12 | 13 | 14 | Content-disposition 15 | http://stackoverflow.com/questions/8035900 16 | 17 | http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa.i386.tar.gz 18 | --------------------------------------------------------------------------------