コード例 #1
0
  public GetStreamKeyStreamServer getGetStreamKeyStreamServer(
      String songID, GetCountry country, String sesionID) {
    GetStreamKeyStreamServer res = null;
    String post =
        "{\"method\":\"getStreamKeyStreamServer\",\"header\":{\"wsKey\":\""
            + KEY
            + "\",\"sessionID\":\""
            + sesionID
            + "\"},\"parameters\":{\"songID\":\""
            + songID
            + "\",\"country\":"
            + country.getResult()
            + ",\"lowBitrate\":\"\"}}";
    ClientResource cr = new ClientResource(uri + getSignatures(post));
    try {
      res = gson.fromJson(cr.post(post).getText(), GetStreamKeyStreamServer.class);
    } catch (JsonSyntaxException e) {
      e.printStackTrace();
    } catch (ResourceException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

    return res;
  }
コード例 #2
0
  public GetSongSearchResults getSongSearchResults(
      String query, Integer limit, Integer offset, GetCountry country) {

    GetSongSearchResults res = null;
    ClientResource cr = null;
    String post =
        "{\"method\":\"getSongSearchResults\",\"header\":{\"wsKey\":\""
            + KEY
            + "\"},\"parameters\":{\"query\":\""
            + query
            + "\",\"country\":"
            + country.getResult()
            + ",\"limit\":\""
            + limit
            + "\",\"offset\":\""
            + offset
            + "\"}}";
    //		String post = "{\"method\":\"getSongSearchResults\",\"header\":{\"wsKey\":\""+ KEY
    //						+ "\"},\"parameters\":{\"query\":\""+query
    //						+"\",\"country\":\"\",\"limit\":\""+limit
    //						+"\",\"offset\":\""+offset+"\"}}";
    String sig = getSignatures(post);

    cr = new ClientResource(uri + sig);
    try {

      res = gson.fromJson(cr.post(post).getText(), GetSongSearchResults.class);
    } catch (JsonSyntaxException e) {
      e.printStackTrace();
    } catch (ResourceException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return res;
  }