Open marksandford opened 6 years ago
Great and thankful!! A) will bring this into main documentation B) will add this to future improvements, for sure we can plan for automatic decoration of the URLs needed. Give me a few days to think about the “where”
El El mar, 16 de oct. de 2018 a las 17:07, Mark Sandford < notifications@github.com> escribió:
IMI can pull objects directly from a Google Drive with the following caveats/notes:
- The URI must be constructed using an API key to provide a direct download link, since shareable link points to a viewer, not the object.
- Files must be shared correctly.
- Google Team Drive does not allow sharing on folder level, only on a file by file basis.
If it's useful, below is a Google Code snippet intended to be run in a Google Sheet that will search through a GDrive folder and generate download links which the IMI can use to grab the objects. Commented out is also a line that will change permissions one at a time, only necessary for Team Drive (Insert obvious scary language about allowing that level of access to a script). Changing permissions, even via the API, can take a long time especially on a directory with a large number of files in it. It's better to change permissions on the folder level when possible (eg not in Team Drive).
function listFilesInFolder(folderName) {
var ui = SpreadsheetApp.getUi(); var response = ui.prompt('Required', 'Enter Folder ID', ui.ButtonSet.OK_CANCEL); var sheet = SpreadsheetApp.getActiveSheet(); sheet.appendRow(["Name", "File-Id"]); var folder = DriveApp.getFolderById(response.getResponseText()); var contents = folder.getFiles();
var cnt = 0; var file; while (contents.hasNext()) { var file = contents.next(); cnt++; // file.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW); // Replace {GOOGLEAPIKEY} in the following line with your api key. // Instructions for getting API key: https://support.google.com/googleapi/answer/6158862?hl=en var fileURL = "https://www.googleapis.com/drive/v3/files/" + file.getId() + "/?key={GOOGLEAPIKEY}&alt=media"; data = [ file.getName(), fileURL, ]; sheet.appendRow(data); };
}; '''
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mnylc/islandora_multi_importer/issues/92, or mute the thread https://github.com/notifications/unsubscribe-auth/AGn853zhCcDY-jGcLPGoj862Qrwb_9SOks5ulnS2gaJpZM4Xio5h .
-- Diego Pino Navarro Digital Repositories Developer Metropolitan New York Library Council (METRO)
@marksandford where do you feel this script/option should live in? Docs? Its own chapter? maybe a cookbook folder?
IMI can pull objects directly from a Google Drive with the following caveats/notes:
If it's useful, below is a Google Code snippet intended to be run in a Google Sheet that will search through a GDrive folder and generate download links which the IMI can use to grab the objects. Commented out is also a line that will change permissions one at a time, only necessary for Team Drive (Insert obvious scary language about allowing that level of access to a script). Changing permissions, even via the API, can take a long time especially on a directory with a large number of files in it. It's better to change permissions on the folder level when possible (eg not in Team Drive).