Created
March 13, 2020 23:08
-
-
Save kieranjol/cff0b7f47a5aac529b940510a34c71e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
Tests our ingest process with fake testfiles. | |
''' | |
import sys | |
import os | |
import time | |
import sipcreator | |
import ififuncs | |
import testfiles | |
import batchaccession | |
def make_oe(): | |
''' | |
Makes a fake OE register with a single entry | |
''' | |
oe_register = sipcreator.make_oe_register() | |
ififuncs.append_csv(oe_register, ( | |
'OE-1234', | |
'01/02/1934', | |
'1', | |
'FFV1/PCM/MKV', | |
'Fake title', | |
'n/a', | |
'Reproduction', | |
'', | |
'Representation of AF5678', | |
'', | |
'' | |
)) | |
return oe_register | |
def make_filmographic(): | |
''' | |
Makes a fake filmographic with a single entry | |
''' | |
desktop_logs_dir = ififuncs.make_desktop_logs_dir() | |
filmographic_register = os.path.join( | |
desktop_logs_dir, | |
'fake_filmographic_' + time.strftime("%Y-%m-%dT%H_%M_%S.csv") | |
) | |
headings = ["Unique Record Number", "Filmographic URN", "Title/Name", "C of O Note", "Cast", "Catalogued/Created By", "Censor Certificate", "Note on Censor Certificate", "Comments", "Contents Summary", "Country of Origin", "Date", "Notes on Date", "Date Created", "Date Last Modified", "Date/Time Created", "Date/Time Modified", "Director", "Duration", "Edited By", "Edited New", "Episode No", "Fiction", "Genre", "Language", "Location", "No of Prints", "People", "Period", "Producer", "Production Company", "Production Credits", "Production Credit Notes", "Production Type", "Professional or Non-Professional", "Rec Update By", "Remarks", "Rights", "Series Title", "Shooting Location Fiction", "Shot List", "Subject", "Title Holdings", "Title Notes", "Type Description", "Viewing Copy", "Year", "Technical URN(s)", "User Created", "User Modified"] | |
ififuncs.create_csv(filmographic_register, headings) | |
ififuncs.append_csv(filmographic_register, ["02151", "AF5678", "", "", "", "", "", "", "", "Amazing summary of a film", "Ireland", "", "", "05/12/2012", "05/12/2012", "28/05/2019 10:45:45", "28/05/2019 13:04:07", "Bilbo Bogginz", "7 min", "", "Anja Mahler", "EPISODE 18; BUBBLEs", "Fiction", "Children's", "English", "", "", "", "", "Carl Eugen", "Double glasses Productions", "Written By:kieran", "", "Animation", "Professional", "", "", "", "anto and sam", "", "", "", "", "", "", "", "2012", "37942, 39548, 39479, 37981", "Administrator", "Administrator"]) | |
return filmographic_register | |
def main(): | |
''' | |
Tests our ingest process with fake testfiles. | |
''' | |
output_dir = sys.argv[1] | |
#oe_register = make_oe() | |
oe_register = make_oe() | |
filmographic_register = make_filmographic() | |
testfiles.main(['-onlyvideo', '-o', output_dir]) | |
test_files_dir = os.path.join(output_dir, 'test_files') | |
mov_audio = os.path.join(test_files_dir, 'bars_v210_pcm24le_stereo_20sec.mov') | |
sipcreator_cmd = ['-i', mov_audio, '-user', 'kierantestingest', '-oe', 'oe1234', '-o', output_dir] | |
sipcreator.main(sipcreator_cmd) | |
batchaccession_cmd = ['-filmo_csv', filmographic_register, '-oe_csv', oe_register, '-start_number', 'aaa1234', output_dir] | |
batchaccession.main(batchaccession_cmd) | |
if __name__ == '__main__': | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment