From 030df2cde321d09a1b18fb6a30754c114e31b836 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 19 Jan 2021 16:31:13 -0500 Subject: [PATCH] livestream changes --- dist/bundle.es.js | 32 +++++++++++++++++++++++++++++++- src/redux/actions/publish.js | 30 +++++++++++++++++++++++++++++- src/redux/selectors/publish.js | 1 + 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 91a6b64..09c7c98 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -4347,6 +4347,7 @@ const selectPublishFormValues = reselect.createSelector(selectState$3, state => } else { actualLanguage = language || languageSet || 'en'; } + return _extends$6({}, formValues, { language: actualLanguage }); }); const makeSelectPublishFormValue = item => reselect.createSelector(selectState$3, state => state[item]); @@ -4624,8 +4625,10 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => { uri, tags, locations, - optimize + optimize, + isLivestreamPublish } = publishData; + // 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; @@ -4705,6 +4708,33 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => { // The sdk will figure it out 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) { publishPayload.preview = true; publishPayload.optimize_file = false; diff --git a/src/redux/actions/publish.js b/src/redux/actions/publish.js index 2467438..50aca07 100644 --- a/src/redux/actions/publish.js +++ b/src/redux/actions/publish.js @@ -266,7 +266,9 @@ export const doPublish = (success: Function, fail: Function, preview: Function) tags, locations, optimize, + isLivestreamPublish, } = publishData; + // 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; @@ -292,7 +294,6 @@ export const doPublish = (success: Function, fail: Function, preview: Function) description?: string, channel_id?: string, file_path?: string, - license_url?: string, license?: string, thumbnail_url?: string, @@ -367,6 +368,33 @@ export const doPublish = (success: Function, fail: Function, preview: Function) // The sdk will figure it out 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) { publishPayload.preview = true; publishPayload.optimize_file = false; diff --git a/src/redux/selectors/publish.js b/src/redux/selectors/publish.js index 9ed5c92..90c1c8d 100644 --- a/src/redux/selectors/publish.js +++ b/src/redux/selectors/publish.js @@ -54,6 +54,7 @@ export const selectPublishFormValues = createSelector( } else { actualLanguage = language || languageSet || 'en'; } + return { ...formValues, language: actualLanguage }; } ); -- 2.45.2