Skip to content

Instantly share code, notes, and snippets.

View eckardm's full-sized avatar

Max Eckard eckardm

  • Bentley Historical Library
  • Ann Arbor, MI
View GitHub Profile
from bhlaspaceapiclient import ASpaceClient
from dappr import DAPPr
import sys
print("initializing ASpaceAPIClient and DAPPr")
archivesspace = ASpaceClient(instance_name="PROD")
resource_id = 9345
collection_id = ''
@eckardm
eckardm / more_title_context_example.py
Created October 8, 2019 15:16
More title context in DeepBlue
from dappr import DAPPr
handles = [
'2027.42/151244',
'2027.42/151243',
'2027.42/151242',
...
]
deepblue = DAPPr(instance_name="PROD")
import csv
from dappr.dappr import DAPPr
from dappr.config import prod
from datetime import datetime
import os
import requests
accession_id = 170864 # 168861
csv_metadata = []
import configparser
import os
import subprocess
import shutil
config = configparser.ConfigParser()
config.read('config.ini')
accession_id = 170864
@eckardm
eckardm / makeDirectories.sh
Created July 17, 2018 15:28
Generated for bloggERS post entitled "Restructuring and Uploading ZIP Files to the Internet Archive with Bash."
#! /bin/bash
# Move into the directory "BC-100" (the name of our quarto scanner), then move into the subdirectory named after whichever project we're scanning, then move into a staging subdirectory.
cd BC-100/$1/$2
# Takes the plain text "list.txt," which is saved inside the staging subdirectory, and makes a new subdirectory for each identifier on the list.
cat list.txt | xargs mkdir
# For each identifier subdirectory,
for d in */; do
# Terminal moves into that directory and
@eckardm
eckardm / smtd.py
Created April 18, 2018 19:31
JACKIE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
r_drive_barcodes_from_jackie = [
"39015071744309",
"39015071744317",
"39015071744325",
...
]
r_drive_barcodes_from_rmw = [
"39015071744788",
"39015071744804",
#!/usr/bin/env python
from __future__ import print_function
import sys
def main(dirname):
try:
print('"171317"')
except Exception:
print('None')
def _archive_zip(self, src, dst):
"""Return the command that creates the ZIP archive file."""
if not dst.endswith('.zip'):
dst += '.zip'
return (dst, [
'7z', 'a', # Add
'-bd', # Disable percentage indicator
'-tzip', # Type of archive
'-y', # Assume Yes on all queries
import requests
from tqdm import *
import json
from auth import archivesspace_url, archivesspace_username, archivesspace_password
def get_eligible_digital_objects():
url = archivesspace_url + "/users/" + archivesspace_username + "/login?password=" + archivesspace_password
response = requests.post(url)
def _set_permissions(self, package):
try:
handle = package.misc_attributes['handle']
except KeyError:
LOGGER.warning('Cannot update permissions - package handle unknown')
return
# Only set if policy exists
if not self.metadata_policy:
LOGGER.info('Restricted metadata policy is empty (%s), not setting', self.metadata_policy)