Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into themes

Conflicts:
	README.markdown
  • Loading branch information...
commit 34fa14e87c42e2f501bec36528edee0d96c98472 2 parents 52fd940 + 4b34a84
@inky authored
Showing with 38 additions and 6 deletions.
  1. +3 −6 README.markdown
  2. +35 −0 scripts/taglist.py
View
9 README.markdown
@@ -1,10 +1,7 @@
-Tumblr themes by inky
-=====================
+Tumblr stuff
+============
-## Branches
-
-* **themes** (this branch): public Tumblr themes
-* [master](http://github.com/inky/tumblr/tree/master): miscellaneous code
+Tumblr themes and other stuff.
## Links
View
35 scripts/taglist.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import simplejson
+import sys
+
+from tumblr import Api
+
+
+def taglist(username):
+ api = Api(username)
+ posts = api.read()
+ alltags = {}
+ for post in posts:
+ tags = post.get('tags', [])
+ for tag in tags:
+ try:
+ alltags[tag][0] += 1
+ except KeyError:
+ alltags[tag] = [1, post.get('date-gmt', '')]
+
+ taglist = [tuple(val+[tag]) for tag,val in alltags.items()]
+ return sorted(taglist, reverse=True)
+
+def main():
+ prog, args = sys.argv[0], sys.argv[1:]
+ if not args:
+ print 'usage: %s username' % prog
+ return
+ tags = taglist(args[0])
+ print simplejson.dumps(tags)
+
+if __name__ == '__main__':
+ main()
Please sign in to comment.
Something went wrong with that request. Please try again.