Xbmc Database Path - objective-c

I am working with XBMC. I have installed XBMC in my system(Windows 7, 32 bit). Xbmc is working fine in my system. I have developed an application in order to control the Xbmc remotely from Ipad. In order to retrieve the music files or video files from Xbmc, I am unable to. By searching the forums of xbmc, I found that we can write an sql query to get them out. But, the thing is I am unable to make out where the database is located in my system. Someone help me out where I can find it.
Regards,
Sushma.

The database itself
By default the location of the database is that described on the wiki page XBMC databases
but the actual location can be changed by the user, or a different database technology can be used entirely.
The settings that would affect this are located in advancedsettings.xml.
But in general it is advised by the XBMC developers to never access the database directly.
JSONRPC
In order to help with interacting with the database XBMC has supported the JSONRPC queries, the one downside of these is that XBMC needs to be running at the time to respond to these queries. The major advantage is that it XBMC will find the database for you and expose access to it with a common interface.
JSONRPC support was first added to XBMC in "Darhma" (v10), became really useful in "Eden" (v11) and will support almost everything possible in "Frodo" (v12). Information about the use of JSONRPC can be found in the wiki.
An example
In this example I'm assuming that you are targeting "Eden", the current stable release of XBMC. Also I have formatted the following with new lines, these are not required and are not present in the response from XBMC.
Request
If you were to use JSONRPC the request you would need to send would look something like:
{
"jsonrpc": "2.0",
"method": "VideoLibrary.GetMovies",
"params": {
"properties": [
"title",
"year",
"file"
],
"limits": {
"start": 0,
"end": 2
}
},
"id": 1
}
Note: If you wanted different information about each movie you could use other properties listed here.
*Note: You probably want to omit the "limits" part to get all movies.*
Responce
The response to this would be something like:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"limits": {
"end": 2,
"start": 0,
"total": 47
},
"movies": [
{
"label": "Label for movie",
"movieid": 1,
"title": "Title of movie",
"year": 2012
},
{
"label": "Label for another movie",
"movieid": 2,
"title": "Title of another movie",
"year": 2010
},
{
"label": "Label for a third movie",
"movieid": 3,
"title": "Title of a third movie",
"year": 2012
}
]
}
}
What to do now?
You have a choice at this point, you can either:
Add "file" to the list of properties, this will return the "file" property, the location of the video file.
Use JSONRPC to tell xbmc to play a movie.
Using this method is best when you don't want to play the file locally (on the iPad) but instead on XBMC.
Playing a movie on XBMC via JSONRPC
This is quite simple, use the "movieid" you received earlier in the following request:
{
"jsonrpc": "2.0",
"method": "Player.Open",
"params": {
"item": {
"movieid": 2
}
},
"id": 1
}
Lastly I would note that there are equivalent commands for TV episodes as shown for movies.

Related

Duplicated content with json:api related links

In the Resource Linkage section of json:api specification I found that you can fetch a related resource object with a url like this, http://example.com/articles/1/author, making reference to "the author of the article with id 1".
In the site complete example we can see that the author has id 9.
// ...
{
"type": "articles",
"id": "1",
"attributes": {
"title": "Rails is Omakase"
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
},
"data": { "type": "people", "id": "9" }
}
},
"links": {
"self": "http://example.com/articles/1"
}
}
// ...
So, if I understood it, I would be able to request the same resource with two different urls:
http://example.com/articles/1/author
http://example.com/authors/9
Is this ok?
Wouldn't this be considerated duplicate content?
The article you have linked talks about duplicated content in the context of a website. JSON:API specification is about an API. A website is typically meant to be read and consumed by humans. An API is meant for programs to be consumed. The SEO concerns raised by that article are not applyable to an API cause search engines like Google does not care about API responses. They may care about the website build based on the data fetch of that API. That website should have a unique URL or a rel="canonical" attribute.

Latest one video uploaded in youtube channel

I need to show the thumbnail of the latest video on my youtube channel on my website and add a link to that video. While using the API parameter date it's showing the first video in that channel. Instead of that, I need the last published video details how to solve this
This is what I used as I require only one last video
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&order=relevance&maxResults=1
(option 1)
You could try replacing order=relevance with order=date
try:
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&order=date&maxResults=1
(option 2)
You could also try using publishedAfter command (which takes a year-month-day format).
Example: publishedAfter=2019-03-25T00:00:00Z (because yesterday was March 25th).
try:
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&publishedAfter=2019-03-25T00:00:00Z&order=date&maxResults=1
(option 3)
Use your programming language to fetch / read the HTML source-code of the channel's uploads page. The first thumbnail listed after gridVideoRenderer is the latest, along with relevant URL.
Example steps:
1) Go to user's uploads page and use "view source" option to see the HTML text (source code).
This text is what your programming language should show you when you http request the link of the channel's uploads.
https://www.youtube.com/user/MARVEL/videos
2) After acquiring (or viewing) the source code
From there find position of the word gridVideoRenderer.
Then starting after position, now find the first occurence of word "url":".
That is the URL. Extract manually by hand or write code to do it automatically.
PS: Replace any unicode in the link, like \u0026 with &.
https://i.ytimg.com/vi/QuP7V2gKgPI/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDBeSfAIiCdLDKtA8h2G-AZqk-xhQ
I tried "option 1" with my own Key, and got the correct response as far as which "video" from the "Channel" - NO THUMBNAILs, just references to it/them, code follows:
{
"kind": "youtube#searchListResponse",
"etag": "EymHvUd1w4o13UcSUT0C9YINu3o",
"nextPageToken": "CAEQAA",
"regionCode": "US",
"pageInfo": {
"totalResults": 181,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "23QGL4Y9Du8EXMntX5ZNdr1F7_k",
"id": {
"kind": "youtube#video",
"videoId": "RRQjUvoSuKU"
},
"snippet": {
"publishedAt": "2022-11-13T15:09:07Z",
"channelId": "UCbhMYK2QQXgHjgnMN3zegRQ",
"title": "All Things Closely",
"description": "Luke 1:1-4.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Restoration Church Homestead",
"liveBroadcastContent": "none",
"publishTime": "2022-11-13T15:09:07Z"
}
}
]
}
THAT's all that showed on a browser page, no Thumbnails-just code, but could not figure out how to get any code in the string to PLAY that video ...
any ideas?
I would love to just have it as a LINK rather than any other scripts loaded on the server. I'm missing something, probably simple I bet, to get the returned video related to the data to play.

Accessing a Word(.docx) file's content with Microsoft Graph REST API?

Is there a way to obtain the content of a Word document stored in the cloud through the Microsoft Graph API without having to download the file locally?
The goal is to build an app that analyzes a Word document's inner content and produce some interesting data from it. However after searching through Microsoft's Dev Center, Graph Explorer, and their API's documentation repository, I can't find any API endpoints that can serve me that data.
I can find some endpoints that deal with manipulating Excel's contents, but not one that deals with Word. Does Microsoft Graph not support retrieving a Word document's content?
EDIT: For example, I know I can read the contents of a "message" and even apply a search on it through query parameters, as demonstrated by one of Microsoft's samples. But I can't seem to find how to do this with Word documents.
Well, it's possible to download the content of the document.
See: Download the contents of a DriveItem.
For example:
GET /v1.0/me/drive/root:/some-folder/document.docx:/content
But you'll get the entire docx, with embedded images and all. Don't know if this is what you are looking for.
As an example, see the helix-word2md project that fetches a docx and converts it to markdown.
I'm afraid you can't direly access word content. What you can do is use web URL property of a DriveItem opening a document the associated Word Online or native world if it is installed.
You can use this below to show specific item or all items:
GET /users/{userId}/drive/items/{itemId}
GET me/drive/root/children/
This is the result below:
{
"#microsoft.graph.downloadUrl": "",
"createdDateTime": "2018-08-10T01:43:00Z",
"eTag": "\"{00000000-3E94-4161-9B82-0000000},2\"",
"id": "00000000IOJA4ONFB6MFAZXARX7L7RU4NV",
"lastModifiedDateTime": "2018-08-10T01:43:00Z",
"name": "daily check.docx",
"webUrl": "https://xxxxxxx",
"cTag": "\"c:{00000000-3E94-4161-9B82-37FAFF1A71B5},2\"",
"size": 26330,
"createdBy": {
"user": {
"email": "000000.onmicrosoft.com",
"id": "000000-93dc-41b7-b89b-760c4128455a",
"displayName": "Chris"
}
},
"lastModifiedBy": {
"user": {
"email": "0000#0000.onmicrosoft.com",
"id": "00000000-93dc-41b7-b89b-00000000",
"displayName": "Chris"
}
},
"parentReference": {
"driveId":
"b!000000000gdQMtns72t31yqWMhnFCjmCqO3tR5ypOf17NKl2USqo1bNqhOzrZ",
"driveType": "business",
"id": "00000VN6Y2GOVW7725BZO354PWSELRRZ",
"path": "/drive/root:"
},
"file": {
"mimeType": "application/vnd.openxmlformats-
officedocument.wordprocessingml.document",
"hashes": {
"quickXorHash": "OSOK7r2hIVSeY1+FjaCnlOxn2p8="
}
},
"fileSystemInfo": {
"createdDateTime": "2018-08-10T01:43:00Z",
"lastModifiedDateTime": "2018-08-10T01:43:00Z"
}
}

How to get recent folders via microsoft graph REST API

I want to fetch my recent folders via the Microsoft Graph REST API.
This API contains the following:
GET https://graph.microsoft.com/v1.0/me/drive/recent
According to the references the result should look like this:
{
"value": [
{
"id": "1312abc!1231",
"remoteItem":
{
"id": "1991210caf!192",
"name": "March Proposal.docx",
"file": { },
"size": 19121,
"parentReference": {
"driveId": "1991210caf",
"id": "1991210caf!104"
}
}
},
{
"id": "1312def!9943",
"name": "Vacation.jpg",
"file": { },
"size": 37810,
"parentReference": {
"driveId": "1312def",
"id": "1312def!123"
}
}
]
}
If the results was like this I could get the parent folder by using the driveId and id of the parentReference but in my results I only get the driveId. This causes the need to do one extra call to graph to fetch the folder.
This means I need 3 calls to the graph API to fetch a recent folder.
My question is if there is a way to also fetch the id or the parentReference so I only need two calls or if there even is an easier way for fetching recent folders?
Thanks in advance!
Sadly the answer is no. 'Recents' feature is pretty bare. They could extend it and provide more flexibility.
If this is critical for you, you can always create a request at:
https://officespdev.uservoice.com/

How to get revision history of a file using OneDrive for business API

I am integrating OneDrive for business (REST API) with our Platform. I can upload a file and update the files contents using the upload API. But how do I get the revision history of a file. The API which I am using is listed below.
Upload a file
You can't use OneDrive for business API to get file revisions (versions), but you can use SharePoint API to get them.
Use this link to get file versions:
GET
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)/Versions?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
where:
"email_tenant_onmicrosoft_com" - is email of your drive
"tenant-my.sharepoint.com" - EndPoint of your drive
Response of this link looks like this JSON:
{
"odata.metadata": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/$metadata#SP.ApiData.FileVersions",
"value": [
{
"odata.type": "SP.FileVersion",
"odata.id": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/SP.FileVersionf1111111-aaaa-1234-5678-90abcdef1234",
"odata.editLink": "SP.FileVersionf1111111-aaaa-1234-5678-90abcdef1234",
"CheckInComment": "",
"Created": "2013-04-27T15:57:57Z",
"ID": 512,
"IsCurrentVersion": false,
"Length": "5716",
"Size": 5716,
"Url": "_vti_history/512/Documents/TEST_005.xlsx",
"VersionLabel": "1.0"
},
{
"odata.type": "SP.FileVersion",
"odata.id": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/SP.FileVersion2ab46e3e-9614-43ff-ad03-252b1f4d0d90",
"odata.editLink": "SP.FileVersion2ab46e3e-9614-43ff-ad03-252b1f4d0d90",
"CheckInComment": "",
"Created": "2013-04-27T15:58:39Z",
"ID": 1024,
"IsCurrentVersion": false,
"Length": "7868",
"Size": 7868,
"Url": "_vti_history/1024/Documents/TEST_005.xlsx",
"VersionLabel": "2.0"
},
{
"odata.type": "SP.FileVersion",
"odata.id": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/SP.FileVersion42f5f367-05ca-4131-84bf-79e7a6c0f77d",
"odata.editLink": "SP.FileVersion42f5f367-05ca-4131-84bf-79e7a6c0f77d",
"CheckInComment": "",
"Created": "2013-04-27T15:58:43Z",
"ID": 1536,
"IsCurrentVersion": false,
"Length": "7868",
"Size": 7868,
"Url": "_vti_history/1536/Documents/TEST_005.xlsx",
"VersionLabel": "3.0"
}
]
}
important parameters for you is:
"odata.editLink" after "SP.FileVersion" - it's unique Id of file version.
"ID" - it's version id of current file.
To download file version you can use this link:
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)/Versions(1024)/$value?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
where "1024" - field "ID" from JSON.
To get info about last version of item you can use this link:
GET
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
Response of this link looks like this JSON:
{
"odata.metadata": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/$metadata#SP.ApiData.Files12/#Element",
"odata.type": "SP.File",
"odata.id": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/Web/GetFileByServerRelativeUrl('/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx')",
"odata.editLink": "Web/GetFileByServerRelativeUrl('/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx')",
"CheckInComment": "",
"CheckOutType": 2,
"ContentTag": "{C4B73433-8AED-44C2-862A-746EBA4599EB},11,7",
"CustomizedPageStatus": 0,
"ETag": "\"{C4B73433-8AED-44C2-862A-746EBA4599EB},11\"",
"Exists": true,
"IrmEnabled": false,
"Length": "7923",
"Level": 1,
"LinkingUri": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx?d=wc4b734338aed44c2862a746eba4599eb",
"LinkingUrl": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx?d=wc4b734338aed44c2862a746eba4599eb",
"MajorVersion": 4,
"MinorVersion": 0,
"Name": "TEST_005.xlsx",
"ServerRelativeUrl": "/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx",
"TimeCreated": "2013-04-27T15:57:55Z",
"TimeLastModified": "2013-04-27T15:59:28Z",
"Title": null,
"UIVersion": 2048,
"UIVersionLabel": "4.0",
"UniqueId": "c4b73433-8aed-44c2-862a-746eba4599eb"
}
you can use this info, when you add a new revision of file.
"UniqueId" - it's right part of "odata.editLink" in versions JSON.
"UIVersion" - it's "ID" in version JSON.
To download last version of file - use this link:
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)/$value?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
link:
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)/Versions(2048)/$value?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
doesn't work. It will work if you add a new version of this file.
You can download last revision of item by using OneDrive API link:
"https://tenant-my.sharepoint.com/_api/v2.0/drives/driveId/items/driveItemId/content"
but this link doesn't work if you use Service Account authentication
Till date there is no api resource for getting version or revision history of a file. Follow the link to know about available operations on items in one drive for business.