Publish changes for livestreaming on odysee #378

Merged
neb-b merged 1 commit from livestream into master 2021-01-26 22:39:31 +01:00
3 changed files with 61 additions and 2 deletions

32
dist/bundle.es.js vendored
View file

@ -4347,6 +4347,7 @@ const selectPublishFormValues = reselect.createSelector(selectState$3, state =>
} else { } else {
actualLanguage = language || languageSet || 'en'; actualLanguage = language || languageSet || 'en';
} }
return _extends$6({}, formValues, { language: actualLanguage }); return _extends$6({}, formValues, { language: actualLanguage });
}); });
const makeSelectPublishFormValue = item => reselect.createSelector(selectState$3, state => state[item]); const makeSelectPublishFormValue = item => reselect.createSelector(selectState$3, state => state[item]);
@ -4624,8 +4625,10 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => {
uri, uri,
tags, tags,
locations, locations,
optimize optimize,
isLivestreamPublish
} = publishData; } = publishData;
// Handle scenario where we have a claim that has the same name as a channel we are publishing with. // Handle scenario where we have a claim that has the same name as a channel we are publishing with.
const myClaimForUriEditing = myClaimForUri && myClaimForUri.name === name ? myClaimForUri : null; const myClaimForUriEditing = myClaimForUri && myClaimForUri.name === name ? myClaimForUri : null;
@ -4705,6 +4708,33 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => {
// The sdk will figure it out // The sdk will figure it out
if (filePath) publishPayload.file_path = filePath; if (filePath) publishPayload.file_path = filePath;
if (isLivestreamPublish) {
var d = new Date();
// Set it to one month in future so it's hidden in apps
d.setFullYear(d.getFullYear() - 10);
d.setHours(0, 0, 0);
d.setMilliseconds(0);
const releaseTimeInSeconds = d / 1000;
publishPayload.release_time = releaseTimeInSeconds;
if (publishPayload.tags) {
if (!publishPayload.tags.includes('odysee-livestream')) {
publishPayload.tags.push('odysee-livestream');
}
} else {
publishPayload.tags = ['odysee-livestream'];
}
} else if (publishPayload.tags && publishPayload.tags.includes('odysee-livestream')) {
let newReleaseTime = new Date();
newReleaseTime.setMilliseconds(0);
publishPayload.release_time = newReleaseTime / 1000;
publishPayload.tags = publishPayload.tags.filter(tag => tag !== 'odysee-livestream');
}
if (preview) { if (preview) {
publishPayload.preview = true; publishPayload.preview = true;
publishPayload.optimize_file = false; publishPayload.optimize_file = false;

View file

@ -266,7 +266,9 @@ export const doPublish = (success: Function, fail: Function, preview: Function)
tags, tags,
locations, locations,
optimize, optimize,
isLivestreamPublish,
} = publishData; } = publishData;
// Handle scenario where we have a claim that has the same name as a channel we are publishing with. // Handle scenario where we have a claim that has the same name as a channel we are publishing with.
const myClaimForUriEditing = myClaimForUri && myClaimForUri.name === name ? myClaimForUri : null; const myClaimForUriEditing = myClaimForUri && myClaimForUri.name === name ? myClaimForUri : null;
@ -292,7 +294,6 @@ export const doPublish = (success: Function, fail: Function, preview: Function)
description?: string, description?: string,
channel_id?: string, channel_id?: string,
file_path?: string, file_path?: string,
license_url?: string, license_url?: string,
license?: string, license?: string,
thumbnail_url?: string, thumbnail_url?: string,
@ -367,6 +368,33 @@ export const doPublish = (success: Function, fail: Function, preview: Function)
// The sdk will figure it out // The sdk will figure it out
if (filePath) publishPayload.file_path = filePath; if (filePath) publishPayload.file_path = filePath;
if (isLivestreamPublish) {
var d = new Date();
// Set it to one month in future so it's hidden in apps
d.setFullYear(d.getFullYear() - 10);
d.setHours(0, 0, 0);
d.setMilliseconds(0);
const releaseTimeInSeconds = d / 1000;
publishPayload.release_time = releaseTimeInSeconds;
if (publishPayload.tags) {
if (!publishPayload.tags.includes('odysee-livestream')) {
publishPayload.tags.push('odysee-livestream');
}
} else {
publishPayload.tags = ['odysee-livestream'];
}
} else if (publishPayload.tags && publishPayload.tags.includes('odysee-livestream')) {
let newReleaseTime = new Date();
newReleaseTime.setMilliseconds(0);
publishPayload.release_time = newReleaseTime / 1000;
publishPayload.tags = publishPayload.tags.filter(tag => tag !== 'odysee-livestream');
}
if (preview) { if (preview) {
publishPayload.preview = true; publishPayload.preview = true;
publishPayload.optimize_file = false; publishPayload.optimize_file = false;

View file

@ -54,6 +54,7 @@ export const selectPublishFormValues = createSelector(
} else { } else {
actualLanguage = language || languageSet || 'en'; actualLanguage = language || languageSet || 'en';
} }
return { ...formValues, language: actualLanguage }; return { ...formValues, language: actualLanguage };
} }
); );