Closed wolfgangkarall closed 9 years ago
BTW, of course it would be nice to actually make the output configurable and not limited to
<basename> <md5> <url>
but before investing any more here I figured I rather see how you like the idea.
I'm not sure this is a good approach. --show
as it is may be grep
and cut
friendly, but its primary use is for humans. --formatted-list
would severely cripple that, and still require another program to actually do something. And it would never be as complete as JSON data can be.
Better to either (A) add the options you need to make humblebundle
itself do what you want (a --download-all
perhaps, it would even share most download args like platform, arch, etc), or (B) make a program that can parse JSON (it's like 3 lines in Python), or (C) make a Python program that imports humblebundle
as a module and use the HumbleBundle
class and its methods to directly manipulate game data as lists and dict objects.
I'd vote for (C), but (A) is also very interesting.
(C) would also be the first real test of humblebundle
as a library instead of a script. Would be a great time to test if its API is flexible and robust enough to accommodate anyone's needs.
As a side note, please use git branches for such features. It's much easier for you to pull and push commits (and get my updates) if our master
branches are always synchronized.
I've recently wrote a lengthy comment to another contributor about git branches, you could check it out:
https://github.com/MestreLion/legendastv/pull/5#issuecomment-71133616
Unfortunately it's in Portuguese, but it seems Google Translator can do a decent job:
Also take a look at the URLs I posted in the end, some great tutorials from Github itself
You're quite right in all respects, especially the branching (I simply forgot). Basically I was just quickly scratching my own itch, so never mind the pull request. :)
I've posted this in another pull request, but this one is more appropriate for it:
This one-liner might whet your appetite:
for game in $(humblebundle --list); do humblebundle --show "$game" --json | grep '"web":' | cut -d'"' -f4; done
;)
... to output only the basename, md5 and web URL of an item (in that order).
The shell snippet was fine for getting the download locations, but at least md5 and basename would be nice as well. I tried, but sed only gets you so far:
But there's a download_struct with an "external_link" but no md5/web entry, and that kind of got me off the tracks. ;)
And I guess it's cleaner to get the data out of the script in a well-formatted way than trying to get it out of the json output.