PythonSlideShow

Changeset

4:1ba92b565b21
2010-08-26 ink raw files shortlog changelog graph Changed walkfs-writemarkup.py; added fullpath and metadata.
walkfs-writemarkup.py (file)
     1.1 --- a/walkfs-writemarkup.py	Thu Aug 26 10:06:53 2010 +0300
     1.2 +++ b/walkfs-writemarkup.py	Thu Aug 26 10:19:48 2010 +0300
     1.3 @@ -1,8 +1,9 @@
     1.4  #!/usr/bin/env python
     1.5  # -*- coding: utf-8 -*-
     1.6  
     1.7 -from os import walk, path
     1.8 +from os import walk, path, stat
     1.9  from sha import new
    1.10 +from time import 
    1.11  
    1.12  # Bug: Class attributes end up with white space (if filenames have them): this might be a bug or a feature, I suppose.
    1.13  
    1.14 @@ -14,8 +15,9 @@
    1.15        if directories != []:
    1.16           for directory in directories:
    1.17              try:
    1.18 -               uid = new(path.join(current, directory)).hexdigest()
    1.19 -               metaInfo = path.join(current, directory)
    1.20 +               fullpath = path.join(current, directory)
    1.21 +               uid = new(fullpath).hexdigest()
    1.22 +               metaInfo = stat(fullpath) # see http://wiki.forum.nokia.com/index.php/How_to_handle_file_metadata
    1.23                 slideData += '\n<!-- directory --><DIV class="%s" id="%s">%s</DIV>' % (classes, uid, metaInfo)
    1.24                 defaultOrder += " " + uid
    1.25              except:
    1.26 @@ -25,8 +27,9 @@
    1.27           for filename in files:
    1.28              #classes stay the same for file slides as for directory slides for each path given.
    1.29              try:
    1.30 -               uid = new(path.join(current, filename)).hexdigest()
    1.31 -               metaInfo = path.join(current, filename)
    1.32 +               fullpath = path.join(current, filename) 
    1.33 +               uid = new(fullpath).hexdigest()
    1.34 +               metaInfo = stat(fullpath)
    1.35                 slideData += '\n<!-- filename --><DIV class="%s" id="%s">%s</DIV>' % (classes, uid, metaInfo)
    1.36                 defaultOrder += " " + uid
    1.37              except: