imageMediaMetadata date missing when jpg upload via web drive - google-drive-api

Using the web client of Google Drive, I added a file image called "image.jpg." This was done by dragging the image from the file system (Mac OS.x 10.9.5) to Chrome where I have my drive folder ready to receive the file.
"image.jpg" has EXIF data such "Date Time Digitized" and "Date Time Original, as confirmed by using Preview on the Mac, and the Inspector tool. For sake of discussion, this date is: "Dec 6, 2014, 3:52:45 PM".
Upon making a call to the API such as:
https://www.googleapis.com/drive/v2/files/{fileId}
where fileId is the id of the file "image.jpg" in Drive, the resulting imageMediaMetadata does not contain date properties. Below is the imageMediaMetadata.
"imageMediaMetadata": {
"exposureTime": 0.053308000000000001,
"flashUsed": true,
"cameraMake": "Nokia",
"isoSpeed": 100,
"exposureMode": "Auto",
"colorSpace": "sRGB",
"height": 918,
"width": 1632,
"meteringMode": "Average",
"location": {
"latitude": 47.676632499999997,
"altitude": 0.0,
"longitude": -122.12224833333333
},
"aperture": 2.0,
"exposureBias": 0.0,
"rotation": 0,
"whiteBalance": "Auto",
"cameraModel": "Lumia 920"
}
"date" (imageMediaMetadata.date) is not there.
Why is "date" not in the imageMediaMetadata? How to resolve?

If possible, check your image file to see if it includes the Exif field: Exif/Image/DateTime. If it does not and you are able to add it, that would be a worthwhile test to see if it then produces a date in the metadata.

Related

Autodesk Forge Design Automation - Error Opening a model - How to bypass Dialog Box "Model has been transmitted from remote location"

I'm trying to use the Design Automation api to open a Revit model from our BIM360 account, eg. to upgrade it from a previous version of Revit
When I test locally, some rvt files display a dialog box during opening:
Transmitted File - this file has been transmitted from a remote location - see image attached (this is a side effect from being downloaded from BIM360)
dialog box on file open Transmitted file
my question is - how can I bypass this dialog box so that the addin can work with Design Aurtomation (in which no UI, dialogs or warnings are supported)
I did some research on Jeremy T's posts on this issue, and found some information, about how to use the DialogBoxShowing event to catch and respond to dialog boxes before they appear..
https://thebuildingcoder.typepad.com/blog/2009/06/autoconfirm-save-using-dialogboxshowing-event.html
However, the problem is that this event is part of the UIApplication namespace, so is likely not available in the Design Automation cloud Revit engine
https://www.revitapidocs.com/2017/cb46ea4c-2b80-0ec2-063f-dda6f662948a.htm
Also in any case it appears that this particular event is not fired when a model is opened
https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/td-p/5578594
Any ideas about how I can open transmitted models for processing with Design Automation?
Thanks!
Ed G
The file from BIM 360 is a eTransmitted workshared files. To open such a file in DesignAutomation for Revit, you will need to use OpenOptions (DetachAndPreserveWorksets or DetachAndDiscardWorksets). If you preserve the worksets and would like to save the file, remember to use the correct SaveAsOptions.
Explicitly specify a local name to your input file in your activity:
{
"alias": "prod",
"activity": {
"id": "YourActivity",
"commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /al $(appbundles[YourBundle].path)" ],
"parameters": {
"rvtFile": {
"zip": false,
"ondemand": false,
"verb": "get",
"description": "Input Revit model",
"required": true,
"localName": "input.rvt",
}
},
"engine": "Autodesk.Revit+2020",
"appbundles": [ "YourName.YourBundle+label" ],
"description": "Bundle description."
}
}
In your app bundle open the file input file "input.rvt" using OpenOptions DetachAndPreserveWorksets or DetachAndDiscardWorksets.
ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("input.rvt");
var opts = new OpenOptions
{
DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets
};
var document = application.OpenDocumentFile(path, opts);
This was covered in the my AU class (see video at 37 min mark).

Permanent shared url in box api

My requirement
One user uploads the file to box from my application using API and other users should be able to see that file as a link in my application.
Im not getting the shared url at the time of upload. And from the document, I understood that the shared url expires soon. Is it possible to get a permanent url to access file by other users (without login to box) ?
Shared links aren't automatically created when you upload a file. You need to make a request to the API to create one. You can find the documentation for how to do that here - https://developers.box.com/docs/#files-create-a-shared-link-for-a-file.
If you set the access field to open and leave the unshared_at time empty, then you'll get a link that anyone can access and that won't expire.
For example, your request might look like:
PUT https://api.box.com/2.0/files/FILE_ID
{ "shared_link": { "access": "open" } }
and then you'll get a response containing the created link:
{
...
"shared_link": {
"url": "https://www.box.com/s/rh935iit6ewrmw0unyul",
"download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg",
"vanity_url": null,
"is_password_enabled": false,
"unshared_at": null,
"download_count": 0,
"preview_count": 0,
"access": "open",
"permissions": {
"can_download": true,
"can_preview": true
}
}
}

cocos2d-js: How to set viewport orientation (landscape / portrait)?

How can I set the viewport orientation in cocos2d-js 3.0?
I found the variables
cc.UIInterfaceOrientationPortrait
cc.UIInterfaceOrientationLandscapeLeft
cc.UIInterfaceOrientationLandscapeRight
cc.UIInterfaceOrientationPortraitUpsideDown
in CCInputManager.js but no function to actually set them.
And I found this description:
http://www.cocos2d-x.org/wiki/Device_Orientation
but it is different for Android and iOS and that contradicts the cocos run command.
In Android just edit the file
frameworks/runtime-src/proj.android/AndroidManifest.xml
in the project directory. Change
android:screenOrientation="landscape"
to
android:screenOrientation="portrait"
you can change in your project config.json
{
"init_cfg":{
"isLandscape": false,
"isPotrait":true,
"isWindowTop": false,
"name": "untitled",
"width": 960,
"height": 640,
"entry": "main.js",
"consolePort": 6050,
"uploadPort": 6060,
"debugPort": 5086
},

Chrome omnibox events without specific keywords?

I do want to check the content written in Chrome omnibox and redirect to the proper page.
Still, I cannot use specific keywords because I do want to redirect things like BUG-1234 to http://bugs.example.com/BUG-1234
I do have a regexp for this (as the BUG part can have lots of values).
How can I do this?
A chrome extension can help you, with help of Omnibox.
If i understood correctly when you enter BUG-1234 and hit Enter in Omnibox, your webpage URL Should be http://bugs.example.com/BUG-1234
Demonstration
I have used keyword as
"keyword": "BUG"
BUG, you can change it as per functionality. So when you enter B+U+G in chrome Omnibox , the search provider adds a custom layer as shown here
Image 1)
and when you enter 1234 and hit Enter or Select the suggested URL Open Bug %s ? in Omnibox, as shown here
Image 2)
It opens a web page with URL as shown here, where i used http://bugs.example.com as a test URL, which can be extended further.
Image 3)
manifest.json
Registered background Page and Omnibox with Chrome Extension, and added related permissions.
{
"name": "Bug Tracker",
"description": "This integrates chrome omnibox with bug search",
"version": "1",
"manifest_version": 2,
"background": {
"scripts": [
"background.js"
]
},
"omnibox": {
"keyword": "BUG"
},
"permissions": [
"<all_urls>"
]
}
background.js
Script for Custom Suggestions
//Set Text to show for custom suggested URL(s)
chrome.omnibox.setDefaultSuggestion({
"description": "Open Bug %s ?"
});
//Fired when Enter or a suggested Link is selected
chrome.omnibox.onInputEntered.addListener(function (bugId) {
//Use your custom URL
chrome.tabs.update({
"url": "http://bugs.example.com/BUG-" + bugId
}, function () {
console.log("Bug Page is open");
});
console.log("Input Entered is " + bugId);
});
References
Background Pages
Omnibox API
Manifest File

box api direct link for music file

dropbox has /media api that provides a direct link to be used for audio steaming with html5 audio tag. I do not see similar thing with box.
the real problem is that I cant use "GET /files/{file id}/content" for music streaming because it requires BoxAuth in header.
How do I do it?
Direct download link is only available for paid box users not for the free user. So if you are free user then you have to upgrade your account to paid user and then after you will get the direct download link. See the box support answer here
Or else you can use the download api. See the documentation
This link is only valid for 15 minutes so after 15 minutes you have to again call the download api and you will get the fresh direct download link valid for next 15 minutes.
When you create a shared link for the file, a direct download link is also returned i.e. the download_url field in the following JSON:
{
"type":"file",
"id":"2192049121",
"sequence_id":"1",
"name":"brand_new_name.psd",
"description":"",
"size":1266400,
"path":"\/brand_new_name.psd",
"path_id":"\/0\/2192049121",
"created_at":"2012-06-04T21:32:20-07:00",
"modified_at":"2012-06-04T21:32:21-07:00",
"shared_link": {
"url": "https://www.box.com/s/0bb6907e48920c98d484",
"download_url": "https://dl.boxcloud.com/shared/static/0bb6907e48920c98d484.webdoc",
"password_enabled": false,
"unshared_at": null,
"download_count": 0,
"preview_count": 0,
"access": "Open",
"permissions": {
"download": true,
"preview": true
}
}
"etag":"72e96dad26aa67a5f7435548c86b7a8a331f0ae9",
"created_by":
{
"type":"user",
"id":"13344957",
"name":"Sean Rose",
"login":"sean+test#box.com"
},
"modified_by":
{
"type":"user",
"id":"13344957",
"name":"Sean Rose",
"login":"seanrose#stanford.edu"
},
"owned_by":
{
"type":"user",
"id":"13344957",
"name":"Sean Rose",
"login":"seanrose#stanford.edu"
},
"parent":
{
"type":"folder",
"id":"0",
"sequence_id":null,
"name":"All Files"
}
}