mirror of
				https://framagit.org/tom79/fedilab-tube
				synced 2025-06-05 21:09:11 +02:00 
			
		
		
		
	Fix playlist
This commit is contained in:
		| @@ -228,8 +228,9 @@ public class PeertubeActivity extends AppCompatActivity implements OnRetrievePee | |||||||
|             initFullscreenDialog(); |             initFullscreenDialog(); | ||||||
|             initFullscreenButton(); |             initFullscreenButton(); | ||||||
|         } |         } | ||||||
|  |         if( Helper.isLoggedIn(PeertubeActivity.this)) { | ||||||
|         new ManagePlaylistsAsyncTask(PeertubeActivity.this, GET_PLAYLIST, null, null, null, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); |             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); |         new RetrievePeertubeSingleAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -45,6 +45,9 @@ public class ManagePlaylistsAsyncTask extends AsyncTask<Void, Void, Void> { | |||||||
|         String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(contextReference.get())); |         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(); |         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); |         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) { |         if (account == null) { | ||||||
|             statusCode = 403; |             statusCode = 403; | ||||||
|             apiResponse = new APIResponse(); |             apiResponse = new APIResponse(); | ||||||
|   | |||||||
| @@ -1472,7 +1472,6 @@ public class PeertubeAPI { | |||||||
|         List<String> ids = new ArrayList<>(); |         List<String> ids = new ArrayList<>(); | ||||||
|         try { |         try { | ||||||
|             String response = new HttpsConnection(context).get(getAbsoluteUrl("/users/me/video-playlists/videos-exist"), 60, params, prefKeyOauthTokenT); |             String response = new HttpsConnection(context).get(getAbsoluteUrl("/users/me/video-playlists/videos-exist"), 60, params, prefKeyOauthTokenT); | ||||||
|  |  | ||||||
|             JSONArray jsonArray = new JSONObject(response).getJSONArray(videoId); |             JSONArray jsonArray = new JSONObject(response).getJSONArray(videoId); | ||||||
|             try { |             try { | ||||||
|                 int i = 0; |                 int i = 0; | ||||||
| @@ -1509,6 +1508,7 @@ public class PeertubeAPI { | |||||||
|             playlists = parsePlaylists(context, new JSONObject(response).getJSONArray("data")); |             playlists = parsePlaylists(context, new JSONObject(response).getJSONArray("data")); | ||||||
|         } catch (HttpsConnection.HttpsConnectionException e) { |         } catch (HttpsConnection.HttpsConnectionException e) { | ||||||
|             setError(e.getStatusCode(), e); |             setError(e.getStatusCode(), e); | ||||||
|  |             e.printStackTrace(); | ||||||
|         } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { |         } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user