Fix playlist

This commit is contained in:
Thomas 2020-06-30 13:45:32 +02:00
parent 46cd597c0f
commit 3b02cfb367
3 changed files with 7 additions and 3 deletions

View File

@ -228,8 +228,9 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee
initFullscreenDialog();
initFullscreenButton();
}
if( Helper.isLoggedIn(PeertubeActivity.this)) {
new ManagePlaylistsAsyncTask(PeertubeActivity.this, GET_PLAYLIST, null, null, null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
new RetrievePeertubeSingleAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

View File

@ -45,6 +45,9 @@ public class ManagePlaylistsAsyncTask extends AsyncTask<Void, Void, Void> {
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(contextReference.get()));
SQLiteDatabase db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
Account account = new AccountDAO(contextReference.get(), db).getUniqAccount(userId, instance);
if( account == null) {
account = new AccountDAO(contextReference.get(), db).getUniqAccount(userId, Helper.getPeertubeUrl(instance));
}
if (account == null) {
statusCode = 403;
apiResponse = new APIResponse();

View File

@ -1472,7 +1472,6 @@ public class PeertubeAPI {
List<String> ids = new ArrayList<>();
try {
String response = new HttpsConnection(context).get(getAbsoluteUrl("/users/me/video-playlists/videos-exist"), 60, params, prefKeyOauthTokenT);
JSONArray jsonArray = new JSONObject(response).getJSONArray(videoId);
try {
int i = 0;
@ -1509,6 +1508,7 @@ public class PeertubeAPI {
playlists = parsePlaylists(context, new JSONObject(response).getJSONArray("data"));
} catch (HttpsConnection.HttpsConnectionException e) {
setError(e.getStatusCode(), e);
e.printStackTrace();
} catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) {
e.printStackTrace();
}