Permalink
Browse files

updated to exiv2 0.3

  • Loading branch information...
1 parent 11b4393 commit 5ac5a5181204e810b8359235d110c52548cc9663 @padenot padenot committed Sep 28, 2011
Showing with 118 additions and 268 deletions.
  1. +53 −211 README.md
  2. +24 −8 build.sh
  3. +13 −0 css/style.css
  4. +1 −1 { → html}/yadfig.html
  5. +14 −11 js/script.js
  6. 0 { → py}/rep.py
  7. +13 −37 { → py}/yadfig.py
View
264 README.md

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,22 +1,38 @@
#!/bin/sh
-# Pack CSS in out.css
+fail() {
+ echo $1;
+ exit 1
+}
+
+# Dependancies check
+sed 's///' /dev/null 2> /dev/null|| fail "Missing sed"
+jsmin < /dev/null 2> /dev/null || fail "Missing a jsmin in PATH"
+python --version 2> /dev/null || fail "Missing python"
+python -c "import Image" 2> /dev/null || fail "Missing PIL (Python Imaging Library)"
+python -c "import pyexiv2" 2> /dev/null || fail "Missing pyexiv2 (python EXIF library)"
+
+chmod +x comments.sed
+# remove comments from css
./comments.sed < css/style.css > out.css
+# remove space
sed ':a;N;$!ba;s/\n/ /g' out.css | tr -s ' ' > out2.css
mv out2.css out.css
-# Put it in index.html
-echo "css"
-python rep.py out.css yadfig.html __CSS__ > index.html
+# insert CSS
+python py/rep.py out.css html/yadfig.html __CSS__ > index.html
-echo "js"
+# minify js
jsmin < js/script.js > out.js
-python rep.py out.js index.html __SCRIPT__> index2.html
+# insert js
+python py/rep.py out.js index.html __SCRIPT__ > index2.html
mv index2.html index.html
-echo "py"
-python rep.py index.html yadfig.py __TEMPLATE__ > yadfig
+# insert full template
+python py/rep.py index.html py/yadfig.py __TEMPLATE__ > yadfig
+
+echo "OK, yadfig generated"
rm index.html
rm out.js
View
@@ -259,6 +259,8 @@ hgroup > p {
-moz-transform-origin: left top;
-webkit-transform: rotate(90deg);
-webkit-transform-origin: left top;
+ -o-transform: rotate(90deg);
+ -o-transform-origin: left top;
font-size: 15em;
font-variant: small-caps;
font-weight: 700;
@@ -294,13 +296,17 @@ hgroup > p {
-moz-transform: scale(3);
-webkit-transition: -webkit-transform 1s ease-in-out;
-webkit-transform: scale(3);
+ -o-transition: -o-transform 1s ease-in-out;
+ -o-transform: scale(3);
}
.cell[hires=true] {
-moz-transition: -moz-transform 0s ease-in-out;
-moz-transform: scale(1);
-webkit-transition: -webkit-transform 0s ease-in-out;
-webkit-transform: scale(1);
+ -o-transition: -o-transform 0s ease-in-out;
+ -o-transform: scale(1);
position: absolute;
top: 10%;
left: 10%;
@@ -311,6 +317,8 @@ hgroup > p {
-moz-transition-property: opacity;
-webkit-transition-duration: 1s, 1s;
-webkit-transition-property: opacity;
+ -o-transition-duration: 1s, 1s;
+ -o-transition-property: opacity;
background: black;
background-color:#404040;
background-image: -moz-radial-gradient(50% 50%, circle farthest-side, #222222, #000000 100%);
@@ -349,16 +357,21 @@ hgroup > p {
-moz-transition-property: opacity scale;
-webkit-transition-duration: 0.5s, 0.5s;
-webkit-transition-property: opacity scale;
+ -o-transition-duration: 0.5s, 0.5s;
+ -o-transition-property: opacity scale;
transition-duration: 0.5s, 0.5s;
transition-property: opacity, scale;
-moz-transform: scale(1);
+ -webkit-transform: scale(1);
+ -o-transform: scale(1);
}
.diaporama[hide=true] {
opacity: 0;
z-index: -1;
-moz-transform: scale(0.1);
-webkit-transform: scale(0.1);
+ -o-transform: scale(0.1);
}
.diaporama > .wrapper {
@@ -25,7 +25,7 @@
<header>
<hgroup>
<h1>__TITLE__</h1>
- <p>__DATE__, __PLACE__</p>
+ <p>__DATE__ __PLACE__</p>
</hgroup>
</header>
<span class="rotated"></span>
View
@@ -2,6 +2,8 @@
* Paul
*/
+"use strict";
+
function $(e) {
return document.querySelector(e);
}
@@ -16,8 +18,9 @@ function $$(e) {
function indexOf(array, element) {
var i = array.length;
while(i--) {
- if (array[i] == element)
+ if (array[i] === element) {
return i;
+ }
}
return -1;
}
@@ -46,6 +49,16 @@ function log(msg) {
}
}
+function onClickImage(e) {
+ e.stopPropagation();
+ var image = e.target.parentNode;
+ if(!image.getAttribute("zoomed")) {
+ diaporamaIn(image);
+ } else {
+ diaporamaOut();
+ }
+}
+
function init() {
var title = $("hgroup h1").innerHTML;
$(".rotated").innerHTML = title;
@@ -66,16 +79,6 @@ function init() {
$("#next").addEventListener("click", next, false);
}
-function onClickImage(e) {
- e.stopPropagation();
- var image = e.target.parentNode;
- if(!image.getAttribute("zoomed")) {
- diaporamaIn(image);
- } else {
- diaporamaOut();
- }
-}
-
function next(e) {
if (mode == "diaporama") {
currentImage = (currentImage + 1) % images.length;
View
File renamed without changes.
View
@@ -16,26 +16,6 @@
template='''__TEMPLATE__'''
images = list()
-exif_keys = ['Exif.Image.Make',
-'Exif.Image.Model',
-'Exif.Image.Orientation',
-'Exif.Image.XResolution',
-'Exif.Image.YResolution',
-'Exif.Image.ResolutionUnit',
-'Exif.Image.Software',
-'Exif.Image.DateTime',
-'Exif.Image.ExifTag',
-'Exif.Photo.ExposureTime',
-'Exif.Photo.FNumber',
-'Exif.Photo.ExposureProgram',
-'Exif.Photo.ISOSpeedRatings',
-'Exif.Photo.ExifVersion',
-'Exif.Photo.ExposureBiasValue',
-'Exif.Photo.MaxApertureValue',
-'Exif.Photo.MeteringMode',
-'Exif.Photo.LightSource',
-'Exif.Photo.Flash',
-'Exif.Photo.FocalLength']
def is_image(mime):
if mime.find("image") == 0:
@@ -47,14 +27,11 @@ def list_files():
os.makedirs(".c")
filenames = os.listdir(os.curdir)
- for i in filenames:
- if is_image(str(mimetypes.guess_type(i)[0])):
- try:
- image = pyexiv2.Image(i)
- image.readMetadata()
- images.append([i, image])
- except:
- continue
+ for name in filenames:
+ if is_image(str(mimetypes.guess_type(name)[0])):
+ metadata = pyexiv2.ImageMetadata(name)
+ metadata.read()
+ images.append([name, metadata])
def get_pictures():
i = 0
@@ -77,11 +54,10 @@ def get_date_interval():
dates = list()
for i in images:
try:
- dates.append(i[1]['Exif.Image.DateTime'])
- except:
+ dates.append(i[1]['Exif.Image.DateTime'].value)
+ except KeyError:
continue
dates.sort()
- print len(dates)
formatdate = "%d %B %Y"
formattime = "%H:%M"
formatfull = formatdate + " at " + formattime
@@ -96,10 +72,12 @@ def output_html():
global template
template = template.replace('__TITLE__', TITLE)
template = template.replace('__PLACE__', PLACE)
- template = template.replace('__DATE__', get_date_interval())
+ if not PLACE:
+ template = template.replace('__DATE__', get_date_interval())
+ else:
+ template = template.replace('__DATE__', get_date_interval()+',')
pics = get_pictures()
template = template.replace('__GALLERY__', pics);
- #print template
f = open("index.html", "w")
f.write(template)
f.close()
@@ -108,7 +86,7 @@ def create_thumbs():
for i in images:
im = Image.open(i[0])
im.thumbnail([im.size[0]/4, im.size[0]/4], Image.ANTIALIAS)
- im.save(".c/"+i[0], "JPEG")
+ im.save(".c/"+i[0])
def usage():
@@ -122,27 +100,25 @@ def main():
global PLACE
try:
arg, opts = getopt.getopt(sys.argv[1:], "hp:t:", ["help", "place", "title"])
- print arg, opts
except getopt.GetoptError, err:
print str(err)
usage()
sys.exit(2)
for o, a in arg:
if o in ("-p", "--place"):
- print "got a place"
PLACE=a
elif o in ("-h", "--help"):
usage()
sys.exit()
elif o in ("-t", "--title"):
- print "got a title"
TITLE=a
else:
assert False, "unhandled option"
list_files()
images.sort()
create_thumbs()
output_html()
+ print "generated index.html & .c/"
if __name__ == "__main__":
main()

0 comments on commit 5ac5a51

Please sign in to comment.