deezer android sdk, add tracks to playlists - deezer

Is it possible to add tracks to playlists with the Deezer Android SDK?
When creating the DeezerRequest, there doesn't seem to be any way to set the method to 'POST' instead of 'GET'.

The DeezerRequest object has three constructor methods, illustrated below :
// Creates a GET request with the given path
DeezerRequest request = new DeezerRequest("artist/27");
// Creates a GET request with the given path and query parameters
Bundle params = new Bundle(1);
params.putString("q", "Daft Punk");
DeezerRequest request = new DeezerRequest("search/artist", params);
// Creates a POST request with the given path and parameters
Bundle params = new Bundle(1);
params.putString("songs", "1234567,4567891,7891234");
DeezerRequest request = new DeezerRequest("search/artist", params, "POST");

This facility is available in the latest version of the application. Try to upgrade to the latest version. I have downloaded from apk mean, and it solved my issue.

Related

How to post grade on an assignment using canvas LMS API and UnityWeb Request or similar?

I am working on a gamification project whose goal is to build a WebGL game with Unity and post the final score as a grade on an assignment using the canvas LMS API. I need to know two things: how to authenticate using a bearer token for now (I know how to create the token already and I will need to use auth 2.0 later) and how to post a grade on an assignment using UnityWeb Request or similar. I have tried using restsharp, the vs code recognized it, but Unity did not. Also tried making a connection with node.js, Unity and node.js connected successfully, but the node wrappers I was using did not work.
In the worst cenario I would like to be able to post a comment on the assignment (I would pass the final grade as a string).
This is what I've tried with httpWebRequest:
string api_token = "bearer token here";
//initializing HttpWebRequest object
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("domain here");
IWebProxy theProxy = request.Proxy;
if (theProxy != null)
{
theProxy.Credentials = CredentialCache.DefaultCredentials;
}
CookieContainer cookies = new CookieContainer();
request.UseDefaultCredentials = true;
request.CookieContainer = cookies;
request.ContentType = "application/json";
request.CookieContainer = cookies;
// write the "Authorization" header
request.Headers.Add("Authorization", "Basic " + api_token);
request.Method = "POST";
// get the response
//WebResponse response = request.GetResponse();
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
Debug.Log(reader.ReadToEnd());
}
I need the node wrappers to do authentication and the post request.
The node wrappers: c10. I've tried with this one a lot and
node-canvas-api
I can access the api and post using postman.
I found out I can use code snippets on postman to retrieve the request in a certain language. With this, I didn't need the python APIs anymore as I was able to get the code directly. I still don't know why Unity did not recognize restSharp, but python solved my problem.
As it was hard for me to find how to post grades and comments on Canvas lms I will leave the PATH here for anyone who has the same problem:
PUT /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id
the query params are:
comment[text_comment] and submission[posted_grade].

HttpWebRequest.GetRequestStream() is not working in MS Dynamics CRM Plugin

I have written a plugin wherein I am trying to get an XML response.
This is my code :
// Set the Method property of the request to POST.
string strXMLServer = "xxx";
var request = (HttpWebRequest)WebRequest.Create(strXMLServer);
request.Method = "POST";
// Set the ContentType property of the WebRequest.
request.ContentType = "xyz";
// Assuming XML is stored in strXML
byte[] byteArray = Encoding.UTF8.GetBytes(strXML);
// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
//(LINE 5) Get the request stream
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
This code works fine when its written in a console application. But when I copy the same code to a class library(plugin) and tries to debug it using plugin profiler, the application gets stopped abruptly when it reaches (LINE 5)
i.e. At Stream dataStream = request.GetRequestStream();
request.GetRequestStream() function is not working with plugin, but works fine within a console.
Any help would be appreciated :)
Thanks in advance
Note: I am using Dynamics 365 online trial version
There are a couple of things to take into consideration when building a plugin with web requests. Firstly, you need to use WebClient as it's widely supported by Microsoft products.
Secondly, your URL needs to be a DNS name and not an IP address, as this is a hosted plugin in sandbox mode.
Example from Microsoft's website: https://msdn.microsoft.com/en-us/library/gg509030.aspx
Reading material: https://crmbusiness.wordpress.com/2015/02/05/understanding-plugin-sandbox-mode/

Downloading from google cloud storage with php

Is there a way to achieve downloading via. the google-php-api? I have tried the following:
using the medialink and trying to curl the object (Returns "Login Required")
reading the guzzle response stream (comes back empty even though all the headers have the correct data)
I am able to see everything but the body of the file via. the API.
Edit:
I am of course able to download the file via the medialink, taken it is set to public - however that will not work for this situation.
The solution is as follows...
You must make an authorized HTTP request, to do this you must:
$object = $service->objects->listObjects(BUCKET, OBJECT);
$http = $client->authorize();
$request = new GuzzleHttp\Psr7\Request('GET', $object->getMediaLink());
$response = $http->send($request);
$body = $response->getBody()->read($object->getSize());
The above is a small snippet but the jist of what you need to get the contents of a file.

Chromecast send metadata to receiver

I need help, in my custome receiver Chromecast app, I can not fetch media metadata with which the app was initialized.
I loaded media like this, after sucesful session request:
var mediaInfo = new chrome.cast.media.MediaInfo('https://wse-wowaza01.playne.tv:443/webdrmorigin/1042a2W.smil/manifest.mpd');
mediaInfo.customData = {
"userId": "mislav",
"sessionId": "39BE906248F9F5C4A93C7",
"merchant": "playnr"
};
mediaInfo.metadata = new chrome.cast.media.MovieMediaMetadata();
mediaInfo.metadata.metadataType = chrome.cast.media.MetadataType.MOVIE;
var img = new chrome.cast.Image('https://ottservice.playnr.tv/OTTranscoderHttps/get?url=http%asd9.168%2f20664_5b8df65c-67ff-4f13-b90d-b28c37f2310c.jpg&w=224&h=126');
mediaInfo.metadata.images = [img];
mediaInfo.contentType = 'video/mp4';
var request = new chrome.cast.media.LoadRequest(mediaInfo);
//this.playerState = this.PLAYER_STATE.LOADING;
this.session.loadMedia(request,
this.onLoadMediaSuccess.bind(this, 'loadMedia'),
this.onLoadMediaFailure.bind(this)
);
How can i access that metadata in receiver app? I tried with
cast.receiver.MediaManager.getInstance()
but no luck. Are there any steps before need to code on receiver to make data available?
Thank you for help, pointed me in right direction.
Got it working, this was the problem. I am using 3rd party DMR javascript plugin for content protection. It encapsulates cast_receiver and had already instantiated MediaManager & ReceiverManager, i didnt noticed that. Then i instantiated new mediaManager, but it wasn bound to any data. Pause/play event were all handled by plugins mediamanager instance, so my instance was useless. As soon i referenced allready instantiated mediamanager, data is there and his events are working. Same with receiver manager, i started instance that was already started and problems....SO conclusion, i dont need to instantiate any, DRM plugin takes care of everything, just need to override his event handlers
Depends on where on the receiver you want t access that info. For example, in a number of callbacks, you have an "event" of type cast.receiver.MediaManager.Event, from which you can get, for example, a cast.receiver.MediaManager.LoadRequestData object via event.data. Then this data object has your customData (data.customData)

How to clear all the current params of a current request (not to create a new request) in GWTP?

I am using GWT for my web app.
Here is the problem.
I have a currentRequest=new PlaceRequest(NameTokens.cust).with("ID", custID).with("name",name);
now I want to clear all the existing params of currentRequest, ie I want to remove "ID" & "name" params in currentRequest.
If I don't remove them, then if i do request=placeManager.getCurrentPlaceRequest().with("otherID", otherID); then the currentRequest will have 3 params as it still remember the other 2 params.
There is a solution, we can create a complete new Request
Request newRequest==new PlaceRequest(NameTokens.cust).with("otherID", otherID);
But i don't want that, I want to keep the currentRequest
There is no clearParam in Request object
How to fix it?
Did you try to set the paramters to null: currentRequest.with('ID',null).with('name',null)
Also be aware that PlaceRequest instances are immutable (so a call to with will always create a new PlaceRequest instance).