Upload videos
This commit is contained in:
parent
05e3f5b001
commit
3d47531c79
|
@ -99,6 +99,9 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
||||||
if(b != null) {
|
if(b != null) {
|
||||||
videoId = b.getString("video_id", null);
|
videoId = b.getString("video_id", null);
|
||||||
}
|
}
|
||||||
|
if( videoId == null){
|
||||||
|
videoId = sharedpreferences.getString(Helper.VIDEO_ID, null);
|
||||||
|
}
|
||||||
|
|
||||||
if( getSupportActionBar() != null)
|
if( getSupportActionBar() != null)
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
@ -156,7 +159,6 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
|
||||||
LinkedHashMap<String, String> translations = null;
|
LinkedHashMap<String, String> translations = null;
|
||||||
if( peertubeInformation.getTranslations() != null)
|
if( peertubeInformation.getTranslations() != null)
|
||||||
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
||||||
|
|
||||||
//Populate catgories
|
//Populate catgories
|
||||||
String[] categoriesA = new String[categories.size()];
|
String[] categoriesA = new String[categories.size()];
|
||||||
Iterator it = categories.entrySet().iterator();
|
Iterator it = categories.entrySet().iterator();
|
||||||
|
|
|
@ -47,6 +47,7 @@ import com.jaredrummler.materialspinner.MaterialSpinner;
|
||||||
import net.gotev.uploadservice.MultipartUploadRequest;
|
import net.gotev.uploadservice.MultipartUploadRequest;
|
||||||
import net.gotev.uploadservice.ServerResponse;
|
import net.gotev.uploadservice.ServerResponse;
|
||||||
import net.gotev.uploadservice.UploadInfo;
|
import net.gotev.uploadservice.UploadInfo;
|
||||||
|
import net.gotev.uploadservice.UploadNotificationAction;
|
||||||
import net.gotev.uploadservice.UploadNotificationConfig;
|
import net.gotev.uploadservice.UploadNotificationConfig;
|
||||||
import net.gotev.uploadservice.UploadStatusDelegate;
|
import net.gotev.uploadservice.UploadStatusDelegate;
|
||||||
|
|
||||||
|
@ -197,7 +198,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
@Override
|
@Override
|
||||||
public void onRetrievePeertubeChannels(APIResponse apiResponse) {
|
public void onRetrievePeertubeChannels(APIResponse apiResponse) {
|
||||||
if( apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0){
|
if( apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0){
|
||||||
if ( apiResponse.getError().getError() != null)
|
if ( apiResponse.getError() != null && apiResponse.getError().getError() != null)
|
||||||
Toasty.error(PeertubeUploadActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
Toasty.error(PeertubeUploadActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
else
|
else
|
||||||
Toasty.error(PeertubeUploadActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
Toasty.error(PeertubeUploadActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
|
@ -335,12 +336,17 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||||
UploadNotificationConfig uploadConfig = new UploadNotificationConfig();
|
UploadNotificationConfig uploadConfig = new UploadNotificationConfig();
|
||||||
Intent in = new Intent(getApplicationContext(), PeertubeEditUploadActivity.class );
|
Intent in = new Intent(getApplicationContext(), PeertubeEditUploadActivity.class );
|
||||||
in.putExtra("video_id", videoID);
|
|
||||||
PendingIntent clickIntent = PendingIntent.getActivity(getApplicationContext(), 1, in, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent clickIntent = PendingIntent.getActivity(getApplicationContext(), 1, in, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
uploadConfig
|
uploadConfig
|
||||||
.setClickIntentForAllStatuses(clickIntent)
|
|
||||||
.setClearOnActionForAllStatuses(true);
|
.setClearOnActionForAllStatuses(true);
|
||||||
|
|
||||||
|
|
||||||
|
uploadConfig.getProgress().message = getString(R.string.uploading);
|
||||||
|
uploadConfig.getCompleted().message = getString(R.string.upload_video_success);
|
||||||
|
uploadConfig.getError().message = getString(R.string.toast_error);
|
||||||
|
uploadConfig.getCancelled().message = getString(R.string.toast_cancelled);
|
||||||
|
uploadConfig.getCompleted().actions.add(new UploadNotificationAction(R.drawable.ic_check, getString(R.string.video_uploaded_action), clickIntent));
|
||||||
|
|
||||||
String uploadId =
|
String uploadId =
|
||||||
new MultipartUploadRequest(PeertubeUploadActivity.this, "https://" + Helper.getLiveInstance(PeertubeUploadActivity.this) + "/api/v1/videos/upload")
|
new MultipartUploadRequest(PeertubeUploadActivity.this, "https://" + Helper.getLiveInstance(PeertubeUploadActivity.this) + "/api/v1/videos/upload")
|
||||||
.addFileToUpload(uri.toString(), "videofile")
|
.addFileToUpload(uri.toString(), "videofile")
|
||||||
|
@ -368,6 +374,9 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
|
||||||
try {
|
try {
|
||||||
JSONObject response = new JSONObject(serverResponse.getBodyAsString());
|
JSONObject response = new JSONObject(serverResponse.getBodyAsString());
|
||||||
videoID = response.getJSONObject("video").get("id").toString();
|
videoID = response.getJSONObject("video").get("id").toString();
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putString(Helper.VIDEO_ID, videoID);
|
||||||
|
editor.apply();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,6 +394,7 @@ public class Helper {
|
||||||
|
|
||||||
public static final String SET_YANDEX_API_KEY = "set_yandex_api_key";
|
public static final String SET_YANDEX_API_KEY = "set_yandex_api_key";
|
||||||
public static final String SET_DEEPL_API_KEY = "set_deepl_api_key";
|
public static final String SET_DEEPL_API_KEY = "set_deepl_api_key";
|
||||||
|
public static final String VIDEO_ID = "video_id_update";
|
||||||
|
|
||||||
private static boolean menuAccountsOpened = false;
|
private static boolean menuAccountsOpened = false;
|
||||||
|
|
||||||
|
|
|
@ -810,6 +810,10 @@
|
||||||
<string name="update_video">Update video</string>
|
<string name="update_video">Update video</string>
|
||||||
<string name="description">Description</string>
|
<string name="description">Description</string>
|
||||||
<string name="toast_peertube_video_updated">The video has been updated!</string>
|
<string name="toast_peertube_video_updated">The video has been updated!</string>
|
||||||
|
<string name="toast_cancelled">Upload cancelled!</string>
|
||||||
|
<string name="upload_video_success">The video has been uploaded!</string>
|
||||||
|
<string name="uploading">Uploading, please wait…</string>
|
||||||
|
<string name="video_uploaded_action">Click here to edit the video data.</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue