예제 #1
0
    def getFolderContents(self, folder, sendResponse):
        if folder == '/':
            sendResponse({
                'folderContents':
                externalDriveManager().getRemovableDrives()
            })

        else:
            folderSearchStr = "%s/*" % folder
            sendResponse({
                'folderContents':
                externalDriveManager().getFolderContents(
                    folderSearchStr.replace('//', '/'))
            })
예제 #2
0
    def eject(self, data, sendResponse):
        ejection = externalDriveManager().eject(data['drive'])

        if ejection['result']:
            sendResponse({'success': 'no error'})
        else:

            sendResponse(ejection['error'], True)
예제 #3
0
    def copyFileToLocal(self, data, sendResponse):

        copiedFilename = externalDriveManager().copyFileToLocal(
            data['origin'], data['destination'], data['observerId'])
        if copiedFilename:
            sendResponse({'target_filename': copiedFilename})
        else:
            sendResponse({'error': 'copy print file to local folder failed'},
                         True)
예제 #4
0
def folderContents():
	location = request.args.get('location')
	externalDriveMgr = externalDriveManager()

	if location == '/':
		return jsonify(externalDriveMgr.getRemovableDrives())

	else:
		return jsonify(externalDriveMgr.getFolderContents("%s/*" % location))
예제 #5
0
 def localFileExists(self, data, sendResponse):
     if not externalDriveManager().localFileExists(data['filename']):
         sendResponse({'success': 'no_error'})
     else:
         sendResponse({'error': 'local file already exists'}, True)
예제 #6
0
 def getBaseFolder(self, key, sendResponse):
     sendResponse({'baseFolder': externalDriveManager().getBaseFolder(key)})
예제 #7
0
 def getFileBrowsingExtensions(self, sendResponse):
     sendResponse({
         'fileBrowsingExtensions':
         externalDriveManager().getFileBrowsingExtensions()
     })
예제 #8
0
def copyFileToLocal():
	externalDriveMgr = externalDriveManager()
	return jsonify({'filename': externalDriveMgr.copyFileToLocal(request.values.get('file'),externalDriveMgr.getBaseFolder('uploads'),request.values.get('observerId'))})
예제 #9
0
def localFileExists(filename):
	return jsonify({'response': externalDriveManager().localFileExists(filename)})
예제 #10
0
def eject():
	return jsonify(externalDriveManager().eject(request.values.get('drive')))
예제 #11
0
def getRemovableDrives():
	return jsonify([d["name"] for d in externalDriveManager().getRemovableDrives()])
예제 #12
0
def getFileBrowsingExtensions():
	return jsonify(externalDriveManager().getFileBrowsingExtensions())