Removed unwanted code and files
This commit is contained in:
parent
9ac24be7ac
commit
cbfe8ec580
69 changed files with 72 additions and 2603 deletions
|
@ -1,89 +0,0 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.rest;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import code.name.monkey.retromusic.App;
|
||||
import code.name.monkey.retromusic.rest.service.KuGouApiService;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
import static code.name.monkey.retromusic.Constants.BASE_API_URL_KUGOU;
|
||||
|
||||
/**
|
||||
* Created by hemanths on 23/08/17.
|
||||
*/
|
||||
|
||||
public class KogouClient {
|
||||
|
||||
private static final String BASE_URL = BASE_API_URL_KUGOU;
|
||||
|
||||
private KuGouApiService apiService;
|
||||
|
||||
public KogouClient() {
|
||||
this(createDefaultOkHttpClientBuilder().build());
|
||||
}
|
||||
|
||||
private KogouClient(@NonNull Call.Factory client) {
|
||||
Retrofit restAdapter = new Retrofit.Builder()
|
||||
.baseUrl(BASE_URL)
|
||||
.callFactory(client)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
|
||||
apiService = restAdapter.create(KuGouApiService.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Cache createDefaultCache(Context context) {
|
||||
File cacheDir = new File(context.getCacheDir().getAbsolutePath(), "/okhttp-lastfm/");
|
||||
if (cacheDir.mkdirs() || cacheDir.isDirectory()) {
|
||||
return new Cache(cacheDir, 1024 * 1024 * 10);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Interceptor createCacheControlInterceptor() {
|
||||
return chain -> {
|
||||
Request modifiedRequest = chain.request().newBuilder()
|
||||
.addHeader("Cache-Control", String.format("max-age=%d, max-stale=%d", 31536000, 31536000))
|
||||
.build();
|
||||
return chain.proceed(modifiedRequest);
|
||||
};
|
||||
}
|
||||
|
||||
private static OkHttpClient.Builder createDefaultOkHttpClientBuilder() {
|
||||
return new OkHttpClient.Builder()
|
||||
.cache(createDefaultCache(App.Companion.getInstance()))
|
||||
.addInterceptor(createCacheControlInterceptor());
|
||||
}
|
||||
|
||||
public KuGouApiService getApiService() {
|
||||
return apiService;
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.rest.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by hefuyi on 2017/1/20.
|
||||
*/
|
||||
|
||||
public class KuGouRawLyric {
|
||||
|
||||
private static final String CHARSET = "charset";
|
||||
private static final String CONTENT = "content";
|
||||
private static final String FMT = "fmt";
|
||||
private static final String INFO = "info";
|
||||
private static final String STATUS = "status";
|
||||
|
||||
@SerializedName(CHARSET)
|
||||
public String charset;
|
||||
|
||||
@SerializedName(CONTENT)
|
||||
public String content;
|
||||
|
||||
@SerializedName(FMT)
|
||||
public String fmt;
|
||||
@SerializedName(INFO)
|
||||
public String info;
|
||||
@SerializedName(STATUS)
|
||||
public int status;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KuGouRawLyric{" +
|
||||
"charset='" + charset + '\'' +
|
||||
", content='" + content + '\'' +
|
||||
", fmt='" + fmt + '\'' +
|
||||
", info='" + info + '\'' +
|
||||
", status=" + status +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.rest.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Created by hefuyi on 2017/1/20.
|
||||
*/
|
||||
|
||||
public class KuGouSearchLyricResult {
|
||||
|
||||
private static final String INFO = "info";
|
||||
private static final String STATUS = "status";
|
||||
private static final String PROPOSAL = "proposal";
|
||||
private static final String KEYWORD = "keyword";
|
||||
private static final String CANDIDATES = "candidates";
|
||||
|
||||
@NonNull
|
||||
@SerializedName(INFO)
|
||||
public String info;
|
||||
|
||||
@SerializedName(STATUS)
|
||||
public int status;
|
||||
|
||||
@NonNull
|
||||
@SerializedName(PROPOSAL)
|
||||
public String proposal;
|
||||
|
||||
@NonNull
|
||||
@SerializedName(KEYWORD)
|
||||
public String keyword;
|
||||
|
||||
@NonNull
|
||||
@SerializedName(CANDIDATES)
|
||||
public List<Candidates> candidates;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KuGouSearchLyricResult{" +
|
||||
"info='" + info + '\'' +
|
||||
", status=" + status +
|
||||
", proposal='" + proposal + '\'' +
|
||||
", keyword='" + keyword + '\'' +
|
||||
", candidates=" + candidates +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class Candidates {
|
||||
private static final String NICKNAME = "nickname";
|
||||
private static final String ACCESSKEY = "accesskey";
|
||||
private static final String SCORE = "score";
|
||||
private static final String DURATION = "duration";
|
||||
private static final String UID = "uid";
|
||||
private static final String SONG = "song";
|
||||
private static final String ID = "id";
|
||||
private static final String SINGER = "singer";
|
||||
private static final String LANGUAGE = "language";
|
||||
@SerializedName(NICKNAME)
|
||||
public String nickname;
|
||||
@SerializedName(ACCESSKEY)
|
||||
public String accesskey;
|
||||
@SerializedName(SCORE)
|
||||
public int score;
|
||||
@SerializedName(DURATION)
|
||||
public long duration;
|
||||
@SerializedName(UID)
|
||||
public String uid;
|
||||
@SerializedName(SONG)
|
||||
public String songName;
|
||||
@SerializedName(ID)
|
||||
public String id;
|
||||
@SerializedName(SINGER)
|
||||
public String singer;
|
||||
@SerializedName(LANGUAGE)
|
||||
public String language;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Candidates{" +
|
||||
"nickname='" + nickname + '\'' +
|
||||
", accesskey='" + accesskey + '\'' +
|
||||
", score=" + score +
|
||||
", duration=" + duration +
|
||||
", uid='" + uid + '\'' +
|
||||
", songName='" + songName + '\'' +
|
||||
", id='" + id + '\'' +
|
||||
", singer='" + singer + '\'' +
|
||||
", language='" + language + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.rest.service;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import code.name.monkey.retromusic.rest.model.KuGouRawLyric;
|
||||
import code.name.monkey.retromusic.rest.model.KuGouSearchLyricResult;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* Created by hemanths on 28/07/17.
|
||||
*/
|
||||
|
||||
public interface KuGouApiService {
|
||||
|
||||
@NonNull
|
||||
@GET("search?ver=1&man=yes&client=pc")
|
||||
Observable<KuGouSearchLyricResult> searchLyric(@Query("keyword") @NonNull String songName, @Query("duration") @NonNull String duration);
|
||||
|
||||
@NonNull
|
||||
@GET("download?ver=1&client=pc&fmt=lrc&charset=utf8")
|
||||
Observable<KuGouRawLyric> getRawLyric(@Query("id") @NonNull String id, @Query("accesskey") @NonNull String accesskey);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue