KODI JSONRPC Player.GetItem method provide empty details - json-rpc

I start a new video with JSON-RPC call:
{"jsonrpc": "2.0",
"method": "Player.Open",
"params":
{"item":
{"file": "c:\\MyCodes\\samples\\sample-6s.mp4" }},
"id": 1
}
Video started and I want to get the video details and use the following Player.GetItem method:
{
"jsonrpc": "2.0",
"method": "Player.GetItem",
"params": {
"properties": [
"title",
"album",
"artist",
"season",
"episode",
"duration",
"showtitle",
"tvshowid",
"thumbnail",
"file",
"fanart",
"streamdetails"
],
"playerid": 1
},
"id": "VideoGetItem"
}
The problem I got back this:
{
"id": "VideoGetItem",
"jsonrpc": "2.0",
"result": {
"item": {
"album": "",
"artist": [],
"episode": -1,
"fanart": "",
"file": "c:\\MyCodes\\samples\\sample-6s.mp4",
"label": "sample-6s.mp4",
"season": -1,
"showtitle": "",
"streamdetails": {
"audio": [],
"subtitle": [],
"video": []
},
"thumbnail": "",
"title": "",
"tvshowid": -1,
"type": "unknown"
}
}
}
but if I start the same video from KODI GUI I got back this:
{
"id": "VideoGetItem",
"jsonrpc": "2.0",
"result": {
"item": {
"album": "",
"artist": [],
"episode": -1,
"fanart": "",
"file": "C:\\MyCodes\\samples\\sample-6s.mp4",
"label": "sample-6s.mp4",
"season": -1,
"showtitle": "",
"streamdetails": {
"audio": [
{
"channels": 2,
"codec": "mp3",
"language": ""
}
],
"subtitle": [],
"video": [
{
"aspect": 1.3333330154418946,
"codec": "mpeg4",
"duration": 2701,
"hdrtype": "",
"height": 384,
"language": "",
"stereomode": "",
"width": 512
}
]
},
"thumbnail": "image://video#C%3a%5cMyCodes%5csamples%5csample-6s.mp4/",
"title": "",
"tvshowid": -1,
"type": "unknown"
}
}
}
Any idea, or experience? Maybe I should use a different method to get the currently running video details?

Related

How to update a part of an array sub document in MongoDB

I have this document in my mongodb collection:
{
"_id": "YLRM9Wi7f6tp6qNbS",
"sessionId": "hLDkkJKR4Muik6tbe",
"userId": "ZYoG4cH8HcCDPMDGr",
"shopId": "J8Bhq3uTtdgwZx3rz",
"workflow": {
"status": "",
"workflow": ["String"]
},
"billing": [Object],
"discount": 0,
"tax": 0,
"items": [
{
"_id": "JwR233jD2c4HKeYKq",
"shopId": "J8Bhq3uTtdgwZx3rz",
"productId": "BCTMZ6HTxFSppJESk",
"quantity": 1,
"product": {
"_id": "BCTMZ6HTxFSppJESk",
"title": "Product",
"shopId": "J8Bhq3uTtdgwZx3rz",
"ancestors": [],
"createdAt": "2018-01-12T10:22:18.853Z",
"description": "",
"handle": "product",
"hashtags": [
"rpjCvTBGjhBi2xdro",
"cseCBSSrJ3t8HQSNP"
],
"price": {
"range": "12.99 - 19.99",
"min": 12.99,
"max": 19.99
},
"isVisible": true,
"isLowQuantity": false,
"isSoldOut": false,
"isBackorder": false,
"metafields": [
{
"key": "Material",
"value": "Cotton"
},
{
"key": "Quality",
"value": "Excellent"
}
],
"pageTitle": "",
"type": "simple",
"updatedAt": "2018-01-12T10:22:18.854Z",
"vendor": "Vendor_Name",
"originCountry": "country",
"requiresShipping": true,
"isDeleted": false,
"template": "productDetailSimple",
"workflow": {
"status": "new"
}
},
"variants": {},
"title": "Product",
"type": "simple",
"parcel": {
"weight": 25,
"height": 3,
"width": 10,
"length": 10
},
"shippingMethod": {
"shopId": "J8Bhq3uTtdgwZx3rz",
"shipmentQuotes": [Object],
"shipmentQuotesQueryStatus": {
"requestStatus": "success",
"numOfShippingMethodsFound": 11
},
"_id": "s3EJXrLsZe73RbLiD",
"address": {},
"shipmentMethod": {},
"paymentId": "nyybR5BNvDDrJrtwe",
"items": [
{
"_id": "JwR233jD2c4HKeYKq",
"productId": "BCTMZ6HTxFSppJESk",
"shopId": "J8Bhq3uTtdgwZx3rz",
"variantId": "CJoRBm9vRrorc9mxZ"
}
],
"workflow": {
"status": "new",
"workflow": ["String"]
}
},
"workflow": {
"status": "new",
"workflow": ["String"]
}
}
],
"shipping": [Object],
"email": "johndoe#mail.com",
"cartId": "L6sSGv4NR9rpbDbsd",
"createdAt": "2018-01-12T10:22:18.850Z"
}
The field items is an array of objects, I would like to update just a part of the object specifically the workflow field without touching other part of the objects in items array.
I was able to do this using a loop, but it caused some tests to fail. Is there a better of doing this with using a loop?
Thank you.
You can try findAndModify method.
Traverse to the workflow key ad try to set the value.
Hope this would help.

I need receive the messages created in response texts in some intentions of the API.AI

My issue:
I have two responses, but my chat return only one specified "the speech", but i need that return the two, like do the console of api
example of response JSON from API:
{
"id": "XXXXXXXXXXX",
"timestamp": "2017-07-12T20:08:48.101Z",
"lang": "es",
"result": {
"source": "agent",
"resolvedQuery": "Hello how are you?",
"action": "",
"actionIncomplete": false,
"parameters": {},
"contexts": [
{
"name": "intent",
"parameters": {},
"lifespan": 1
}
],
"metadata": {
"intentId": "XXXXXXXXXXXXXXXXXXXXXXXX",
"webhookUsed": "false",
"webhookForSlotFillingUsed": "false",
"intentName": "welcome"
},
"fulfillment": {
"speech": "Hello!",
"messages": [
{
"type": 0,
"speech": "Hello!"
},
{
"type": 0,
"speech": "Bye!"
}
]
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": ""
}
I need show the black messages.

what is the date format from stash api?

In the below json response, what is the date format for createdDate and updatedDate? I am not sure how to work in reverse to find what format the api is using for date. I couldn't find this any where in the documentation.
{
"size": 1,
"limit": 25,
"isLastPage": true,
"values": [
{
"id": 101,
"version": 1,
"title": "Talking Nerdy",
"description": "It’s a kludge, but put the tuple from the database in the cache.",
"state": "OPEN",
"open": true,
"closed": false,
"createdDate": 1359075920,
"updatedDate": 1359085920,
"fromRef": {
"id": "refs/heads/feature-ABC-123",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"toRef": {
"id": "refs/heads/master",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"locked": false,
"author": {
"user": {
"name": "tom",
"emailAddress": "tom#example.com",
"id": 115026,
"displayName": "Tom",
"active": true,
"slug": "tom",
"type": "NORMAL"
},
"role": "AUTHOR",
"approved": true
},
"reviewers": [
{
"user": {
"name": "jcitizen",
"emailAddress": "jane#example.com",
"id": 101,
"displayName": "Jane Citizen",
"active": true,
"slug": "jcitizen",
"type": "NORMAL"
},
"role": "REVIEWER",
"approved": true
}
],
"participants": [
{
"user": {
"name": "dick",
"emailAddress": "dick#example.com",
"id": 3083181,
"displayName": "Dick",
"active": true,
"slug": "dick",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": false
},
{
"user": {
"name": "harry",
"emailAddress": "harry#example.com",
"id": 99049120,
"displayName": "Harry",
"active": true,
"slug": "harry",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": true
}
],
"link": {
"url": "http://link/to/pullrequest",
"rel": "self"
},
"links": {
"self": [
{
"href": "http://link/to/pullrequest"
}
]
}
}
],
"start": 0
}
Just making a note that in my case, it is a UNIX timestamp, but I have to remove three trailing zeroes. E.g. the data looks like this:
"createdDate":1555621993000
If interpreted as a UNIX timestamp, that would be 09/12/51265 # 4:16am (UTC).
By removing the three trailing zeroes I get 1555621993, which is the correct time 04/18/2019 # 9:13pm (UTC)
Your mileage may vary but that was a key discovery for me :)
It looks like a UNIX timestamp.
https://en.wikipedia.org/wiki/Unix_time

Search in mongodb nested arrays

Here i have this database
{
"products": [
[
{
"title": "CS:GO:0",
"description": "500 x 6MM CARBON STEEL BALL BEARINGS",
"moreInfo": "SMK.",
"oldPrice": "269.99",
"newPrice": "109.99",
"offPrice": "59%",
"image": "",
"z-index": 0,
"shown": true,
"type": "product",
"category": "0",
"id": "0"
},
{
"title": "Grid autosport",
"description": "G&P G&P Tokyo Marui M870 Gas Charging...",
"moreInfo": "",
"oldPrice": "",
"newPrice": "129.99",
"offPrice": "",
"image": "",
"z-index": 1,
"shown": true,
"type": "product",
"category": "0",
"id": "1"
}
],
[
{
"title": "CS:GO:0",
"description": "500 x 6MM CARBON STEEL BALL BEARINGS",
"moreInfo": "SMK.",
"oldPrice": "269.99",
"newPrice": "109.99",
"offPrice": "59%",
"image": "",
"z-index": 0,
"shown": true,
"type": "product",
"category": "1",
"id": "0"
},
{
"title": "Grid autosport",
"description": "G&P G&P Tokyo Marui M870 Gas Charging...",
"moreInfo": "",
"oldPrice": "",
"newPrice": "129.99",
"offPrice": "",
"image": "",
"z-index": 1,
"shown": true,
"type": "product",
"category": "1",
"id": "1"
}
].........
I use this as a query to get the object i want
var query = {
"products": {
"$elemMatch": {
"category": '0',
"id": '0'
}
}
};
var secondaryQuery = {
'products.$': 1
};
collection.find(query, secondaryQuery)
The database returns null array [].
Does someone have idea why and how to get the object I want from it?

Not receiving some messages with status_type "shared_story" using FQL

I've been searching about this many hours since I saw I'm not receiving some of my friends posts in my app. I looked at the FQL documentation, searched through the Internet, but nothing.
I now that I can get them with the Graph API, asking for "feed" but I receive a lot of types of posts I don't need because of that I began to use FQL asking for "stream" where I can specify a few types (46 - Status update, 80 - Link posted, etc).
This type of posts are made in a wall of a person when he/she shares the status, photo or link another person posted in his wall, this is the "status_type": "shared_story".
Someone knows if it is possible to get them with FQL?
Thank you.
P.S.: Ok, this is crazy, I saw one post of this type that I get with FQL and I asked for feed using the Graph API and the type is the same "shared_story". But for some reason I don't understand I don't get all of them. Is there another parameter that could make the difference between them? Because I don't see it.
I'm not receiving this:
{
"id": "",
"from": {
"name": "",
"id": ""
},
"story": "",
"story_tags": {
"0": [
{
"id": "",
"name": "",
"offset": 0,
"length": 24,
"type": "user"
}
],
"32": [
{
"id": "",
"name": "",
"offset": 32,
"length": 18,
"type": "page"
}
]
},
"picture": "",
"link": "",
"name": "s",
"caption": "",
"properties": [
{
"name": "",
"text": "",
"href": ""
}
],
"icon": "",
"actions": [
{
"name": "Comment",
"link": ""
},
{
"name": "Like",
"link": "4"
}
],
"privacy": {
"value": ""
},
"type": "photo",
"status_type": "shared_story",
"object_id": "",
"application": {
"name": "Links",
"id": "2309869772"
},
"created_time": "",
"updated_time": "",
"likes": {
"data": [
{
"name": "",
"id": ""
}
],
"count": 1
},
"comments": {
"count": 0
}
}
But, I'm receiving this:
{
"id": "",
"from": {
"name": "",
"id": ""
},
"message": "",
"picture": "",
"link": "",
"source": "",
"name": "",
"caption": "",
"description": "",
"icon": "",
"actions": [
{
"name": "Comment",
"link": ""
},
{
"name": "Like",
"link": ""
}
],
"privacy": {
"value": ""
},
"type": "video",
"status_type": "shared_story",
"application": {
"name": "Links",
"id": "2309869772"
},
"created_time": "",
"updated_time": "",
"comments": {
"count": 0
}
}