mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-12-22 21:16:57 +00:00
Fix some story and mediaretriever bug
This commit is contained in:
parent
63dc69e13c
commit
3bbafc654c
@ -2,7 +2,6 @@ package awais.instagrabber.utils;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@ -1042,7 +1041,7 @@ public final class ResponseBodyUtils {
|
||||
tappableObject.getString("question"),
|
||||
tappableObject.getString("emoji"),
|
||||
tappableObject.getBoolean("viewer_can_vote"),
|
||||
tappableObject.getDouble("slider_vote_average"),
|
||||
tappableObject.optDouble("slider_vote_average"),
|
||||
tappableObject.getInt("slider_vote_count"),
|
||||
tappableObject.optDouble("viewer_vote")
|
||||
));
|
||||
|
@ -193,8 +193,7 @@ public class StoriesService extends BaseService {
|
||||
node.getInt("media_count"),
|
||||
false,
|
||||
node.optBoolean("has_besties_media")));
|
||||
}
|
||||
catch (Exception e) {} // to cover promotional reels with non-long user pk's
|
||||
} catch (Exception e) {} // to cover promotional reels with non-long user pk's
|
||||
}
|
||||
final JSONArray broadcasts = new JSONObject(body).getJSONArray("broadcasts");
|
||||
for (int i = 0; i < broadcasts.length(); ++i) {
|
||||
@ -371,7 +370,8 @@ public class StoriesService extends BaseService {
|
||||
final String url = buildUrl(options);
|
||||
final Call<String> userStoryCall = repository.getUserStory(url);
|
||||
final boolean isLocOrHashtag = options.getType() == StoryViewerOptions.Type.LOCATION || options.getType() == StoryViewerOptions.Type.HASHTAG;
|
||||
final boolean isHighlight = options.getType() == StoryViewerOptions.Type.HIGHLIGHT || options.getType() == StoryViewerOptions.Type.STORY_ARCHIVE;
|
||||
final boolean isHighlight = options.getType() == StoryViewerOptions.Type.HIGHLIGHT || options
|
||||
.getType() == StoryViewerOptions.Type.STORY_ARCHIVE;
|
||||
userStoryCall.enqueue(new Callback<String>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull final Call<String> call, @NonNull final Response<String> response) {
|
||||
@ -412,7 +412,7 @@ public class StoriesService extends BaseService {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "Error parsing string");
|
||||
Log.e(TAG, "Error parsing string", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,6 @@ import static awais.instagrabber.utils.BitmapUtils.THUMBNAIL_SIZE;
|
||||
import static awais.instagrabber.utils.Constants.DOWNLOAD_CHANNEL_ID;
|
||||
import static awais.instagrabber.utils.Constants.NOTIF_GROUP_NAME;
|
||||
|
||||
//import awaisomereport.LogCollector;
|
||||
//import static awais.instagrabber.utils.Utils.logCollector;
|
||||
|
||||
public class DownloadWorker extends Worker {
|
||||
private static final String TAG = "DownloadWorker";
|
||||
private static final String DOWNLOAD_GROUP = "DOWNLOAD_GROUP";
|
||||
@ -340,13 +337,22 @@ public class DownloadWorker extends Worker {
|
||||
return bitmap;
|
||||
}
|
||||
if (mimeType.startsWith("video")) {
|
||||
try (MediaMetadataRetriever retriever = new MediaMetadataRetriever()) {
|
||||
try {
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
try {
|
||||
retriever.setDataSource(context, uri);
|
||||
} catch (final Exception e) {
|
||||
retriever.setDataSource(file.getAbsolutePath());
|
||||
try {
|
||||
retriever.setDataSource(context, uri);
|
||||
} catch (final Exception e) {
|
||||
retriever.setDataSource(file.getAbsolutePath());
|
||||
}
|
||||
bitmap = retriever.getFrameAtTime();
|
||||
} finally {
|
||||
try {
|
||||
retriever.release();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "getThumbnail: ", e);
|
||||
}
|
||||
}
|
||||
bitmap = retriever.getFrameAtTime();
|
||||
} catch (final Exception e) {
|
||||
Log.e(TAG, "", e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user