Skip to content
Browse files

Bug fixes

  • Loading branch information...
1 parent 8dfd810 commit 39f93666dde3290e6a2154d000c6c9c3dca15c6c @theopolisme committed Jul 15, 2013
Showing with 7 additions and 5 deletions.
  1. +7 −5 selfimages.py
View
12 selfimages.py
@@ -5,6 +5,7 @@
import time
import os
import cStringIO
+import re
import mwclient
import requests
@@ -52,9 +53,10 @@ def get_exif_date(image):
decoded = TAGS.get(tag, tag)
if decoded == "DateTime":
result = time.strptime(value, "%Y:%m:%d %H:%M:%S")
+ result = time.strftime("%d %B %Y",result)
break
- except AttributeError:
- pass #This means that the image didn't have an EXIF data
+ except:
+ pass #This means that the image didn't have any EXIF data
return result
@@ -75,16 +77,16 @@ def process_page(page):
contents = page.edit()
if contents != "":
- description = re.sub(r"==(.*?)==","",contents,flags=re.U|re.DOTALL)
- description = re.sub(r"{{(.*?)}}","",contents,flags=re.U|re.DOTALL)
+ description = re.sub(r"={1,5}[^=]*={1,5}","",contents,flags=re.U|re.DOTALL) # remove all headers
+ description = re.sub(r"{{.*?}}","",description,flags=re.U|re.DOTALL) # remove all templates
description = description.replace('\n',' ').strip()
else:
description = ""
contents = u"""{{Information
| description = """+description+"""
| source = {{own}}
-| date = """ + date + """
+| date = """ + unicode(date) + """
| author = {{subst:usernameexpand|""" + user.replace(" ","_") + """}}
}}\n""" + contents

0 comments on commit 39f9366

Please sign in to comment.
Something went wrong with that request. Please try again.