updating scripts to use python3.4 specifically
This commit is contained in:
parent
54c9745866
commit
041b490e7f
4 changed files with 11 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3.4
|
||||||
|
|
||||||
import os, re
|
import os, re
|
||||||
from flask.ext.mongoengine import MongoEngine
|
from flask.ext.mongoengine import MongoEngine
|
||||||
|
@ -21,10 +21,10 @@ ArchivedText.objects.all().delete()
|
||||||
ArchivedImage.objects.all().delete()
|
ArchivedImage.objects.all().delete()
|
||||||
|
|
||||||
###
|
###
|
||||||
# Fixed field order:
|
# Fixed field order:
|
||||||
# URL, TITLE, NOTE, DATE, TAGS, UNREAD, SOURCE
|
# URL, TITLE, NOTE, DATE, TAGS, UNREAD, SOURCE
|
||||||
###
|
###
|
||||||
# Notes on processing assumptions:
|
# Notes on processing assumptions:
|
||||||
# UNREAD field is 1/0 integer compare
|
# UNREAD field is 1/0 integer compare
|
||||||
# Escape commas with ^comma^ in raw fields before CSV export
|
# Escape commas with ^comma^ in raw fields before CSV export
|
||||||
# Watch for NEWLINE/CRLF issues
|
# Watch for NEWLINE/CRLF issues
|
||||||
|
@ -39,7 +39,7 @@ for line in file.readlines():
|
||||||
if Bookmark.objects(url=filtered_url).count() == 0:
|
if Bookmark.objects(url=filtered_url).count() == 0:
|
||||||
print("URL: " + URL)
|
print("URL: " + URL)
|
||||||
b.url = filtered_url
|
b.url = filtered_url
|
||||||
else:
|
else:
|
||||||
print("Duplicate URL: " + URL)
|
print("Duplicate URL: " + URL)
|
||||||
continue
|
continue
|
||||||
print("Title: " + TITLE)
|
print("Title: " + TITLE)
|
||||||
|
@ -50,7 +50,7 @@ for line in file.readlines():
|
||||||
b.created_at = datetime.datetime(*map(int, re.split('[^\d]', DATE)[:-1]))
|
b.created_at = datetime.datetime(*map(int, re.split('[^\d]', DATE)[:-1]))
|
||||||
if b.created_at < date_marker:
|
if b.created_at < date_marker:
|
||||||
date_marker = b.created_at
|
date_marker = b.created_at
|
||||||
else:
|
else:
|
||||||
b.created_at = date_marker
|
b.created_at = date_marker
|
||||||
|
|
||||||
print("Date: " + b.created_at.strftime("%Y/%m/%d"))
|
print("Date: " + b.created_at.strftime("%Y/%m/%d"))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3.4
|
||||||
|
|
||||||
import os, re
|
import os, re
|
||||||
from flask.ext.mongoengine import MongoEngine
|
from flask.ext.mongoengine import MongoEngine
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3.4
|
||||||
|
|
||||||
import os, re
|
import os, re
|
||||||
from flask.ext.mongoengine import MongoEngine
|
from flask.ext.mongoengine import MongoEngine
|
||||||
|
@ -18,10 +18,10 @@ for b in Bookmark.objects(archived_text_needed = True):
|
||||||
except:
|
except:
|
||||||
print("Text archive failed.")
|
print("Text archive failed.")
|
||||||
|
|
||||||
for b in Bookmark.objects(archived_image_needed = True):
|
for b in Bookmark.objects(archived_image_needed = True):
|
||||||
print("Archiving image for " + b.short)
|
print("Archiving image for " + b.short)
|
||||||
try:
|
try:
|
||||||
update_archived_image(b)
|
update_archived_image(b)
|
||||||
print("image archived.")
|
print("image archived.")
|
||||||
except:
|
except:
|
||||||
print("image archive failed.")
|
print("image archive failed.")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3.4
|
||||||
|
|
||||||
import os, re
|
import os, re
|
||||||
from flask.ext.mongoengine import MongoEngine
|
from flask.ext.mongoengine import MongoEngine
|
||||||
|
@ -45,5 +45,4 @@ for i in soup(["bookmark"]):
|
||||||
print(str(count)+" - "+b.short)
|
print(str(count)+" - "+b.short)
|
||||||
print(b.title)
|
print(b.title)
|
||||||
print(b.url)
|
print(b.url)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue