Permalink
Browse files

Merge pull request #5 from kmike/master

cleanup
  • Loading branch information...
2 parents a54eff8 + 3094fd8 commit 35307c5df6dd07000be8669a63281deca26695bd @jerem committed Oct 12, 2012
Showing with 316 additions and 166 deletions.
  1. +2 −0 .gitignore
  2. 0 gpl-2.0.txt → LICENSE.txt
  3. +49 −0 bin/psdparser.py
  4. 0 { → psdparse}/__init__.py
  5. +232 −166 { → psdparse}/psdparser.py
  6. +33 −0 setup.py
View
@@ -0,0 +1,2 @@
+*.pyc
+build/
File renamed without changes.
View
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import
+import sys
+import logging
+from psdparse import psdparser
+
+if __name__ == '__main__':
+ """
+ Let's get started!
+ """
+
+ from optparse import OptionParser
+ parser = OptionParser(usage = "usage: %prog [OPTS] PSDFILE.psd")
+ po = parser.add_option
+
+ # Verbosity
+ po('-v', '--verbose', default=False, action='store_true')
+ po('-q', '--quiet', default=False, action='store_true')
+
+ (OPTS, args) = parser.parse_args()
+
+ # The global holder for all the information we really care about
+ info = {}
+
+ # Set the logger
+ level = logging.INFO
+ if OPTS.verbose:
+ level = logging.DEBUG
+ if OPTS.quiet:
+ level = logging.WARNING
+
+ handler = logging.StreamHandler()
+ handler.setFormatter(logging.Formatter('[DEBUG] %(message)s'))
+ psdparser.logger.addHandler(handler)
+ psdparser.logger.setLevel(level)
+
+ # Run
+ if len(args) == 1:
+ psd = psdparser.PSDParser(args[0])
+ psd.parse()
+
+ import yaml
+ print "# YAML automatically generated by psdparser\n"
+ print yaml.dump({'header': psd.header, 'ressources': psd.ressources, 'layers': psd.layers}, indent=2)
+
+ else:
+ parser.print_help()
+ sys.exit(1)
File renamed without changes.
Oops, something went wrong.

0 comments on commit 35307c5

Please sign in to comment.