arT2's TumblrTools

Simple and quickly made Python2 app to enhance my Tumblr blog with features Tumblr itself doesn't provide. The main thing this app does is to bake useful data files (JSON for now) for a Tumblr blog. It does this by fetching the data from the Tumblr API and then doing all sorts of magic things.

It's made to be run as a cronjob and it can handle multiple blogs through multiple configuration files.


TOC

  1. Requirements
  2. Configuration
  3. Run
  4. Examples

Requirements


Configuration

Open a text-editor and copy + paste the following example configuration. Alternatively you can also get this from the example.json file inside the conf directory.

{
    "blog_id": "myblog.tumblr.com",
    "consumer_key": "your_consumer_key",
    "secret_key": "your_secret_key",
 
    "output_dir": "/path/to/output/directory",
 
    "sort_tags": true,
    "sort_tags_rev": false,
    "random_tags": false,
    "exclude_tags": [
        "hideme1",
        "hideme2"
    ],
    "hilite_tags": [
        "hiliteme1",
        "hiliteme2"
    ]
}

Now edit it so it fits your needs. When done, save it in the conf directory or any other directory you want with any name you like. Lets save it in conf/myconf.json for now. See these descriptions below if your unsure when adjusting the values:

blog_id = Basically your blog domain. Could also be just myblog.com if you've routed Tumblr to your domain.

consumer_key + secret_key = Your API keys. Register an application on https://www.tumblr.com/oauth/apps if you don't have these two keys already. Once you did that, you can copy + paste your keys from the same page.

output_dir = Where the app will save the baked files. Must exist. On Windows, don't use back-slashes, use forward-slashes... e.g. C:/Users/You/Desktop instead of C:\Users\You\Desktop.

sort_tags = true to sort tags alphabethically or false for unsorted.

sort_tags_rev = true to sort tags in descending order or false for ascending. Only applied if sort_tags is set to true.

random_tags = true to sort tags in random order or false for whatever defined with sort_tags and sort_tags_rev. Only applied if sort_tags is set to false.

exclude_tags = list of tags to exclude in the output.

hilite_tags = tags in this list will have their hilite attribute set to true.


Run rabbit, run

Open a terminal and enter the tumblrtools directory. Then...

There is also a help command --help if you forget the above.

Give it a few seconds. The more posts you have, the longer it takes.

If you don't see any errors, it should have created the file in the output_dir you've configured.


Examples

Example files can be found in the doc/examples directory. *.json files are the ones created by this app. *.html files are simple demonstrations of how you could use those *.json files. jquery.js is just needed for the *.html files, but I guess most people would use this too.


That's all folks!

That's all folks!