Skip to content

Commit

Permalink
update omeka_upload.py to only upload images
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel committed Apr 4, 2019
1 parent 576001c commit 7f9d610
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
This is a set of one-off python scripts to move students' creative projects
from BOX (box.berkeley.edu) to Zotero and Omeka S
(http://communitiesandlandscapes.org)

Main files to run are each of the `fa16_2.py` files to upload to zotero
and the `omeka_upload.py` file to upload from zotero to omeka.
8 changes: 5 additions & 3 deletions omeka_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from zotero import *
import omeka

IMG_EXTENSIONS = [ '.png', '.jpg', '.jpeg', '.gif' ]

ITEM_SET_TITLE = 'ESPM 50 Creative Projects'

Expand Down Expand Up @@ -52,9 +53,10 @@ def upload_zotero_item(item):
files = [
(child['data']['filename'], get_zotero_file_url(child['key']))
for child in children
if not child['data']['filename'].endswith('docx') # TODO allow DOCX
# application/vnd.openxmlformats-officedocument.wordprocessingml.document
# https://omeka.org/forums-legacy/topic/xlsx-file-types-not-viewing-correctly/#post-100559
if any(child['data']['filename'].endswith(ie) for ie in IMG_EXTENSIONS)
# if not child['data']['filename'].endswith('docx') # TODO allow DOCX
# # application/vnd.openxmlformats-officedocument.wordprocessingml.document
# # https://omeka.org/forums-legacy/topic/xlsx-file-types-not-viewing-correctly/#post-100559
]
print('\tChild files:')
for x in files:
Expand Down

0 comments on commit 7f9d610

Please sign in to comment.