use has_no_source to check if claim is a livestream
This commit is contained in:
parent
e5fc28821a
commit
0f24f3fdfd
9 changed files with 14 additions and 36 deletions
|
@ -1,9 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectMediaTypeForUri } from 'lbry-redux';
|
import { makeSelectMediaTypeForUri, makeSelectClaimHasSource } from 'lbry-redux';
|
||||||
import FileType from './view';
|
import FileType from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
mediaType: makeSelectMediaTypeForUri(props.uri)(state),
|
mediaType: makeSelectMediaTypeForUri(props.uri)(state),
|
||||||
|
isLivestream: !makeSelectClaimHasSource(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select)(FileType);
|
export default connect(select)(FileType);
|
||||||
|
|
|
@ -6,16 +6,17 @@ import Icon from 'component/common/icon';
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
mediaType: string,
|
mediaType: string,
|
||||||
|
isLivestream: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function FileType(props: Props) {
|
function FileType(props: Props) {
|
||||||
const { mediaType } = props;
|
const { mediaType, isLivestream } = props;
|
||||||
|
|
||||||
if (mediaType === 'image') {
|
if (mediaType === 'image') {
|
||||||
return <Icon icon={ICONS.IMAGE} />;
|
return <Icon icon={ICONS.IMAGE} />;
|
||||||
} else if (mediaType === 'audio') {
|
} else if (mediaType === 'audio') {
|
||||||
return <Icon icon={ICONS.AUDIO} />;
|
return <Icon icon={ICONS.AUDIO} />;
|
||||||
} else if (mediaType === 'video') {
|
} else if (mediaType === 'video' || isLivestream) {
|
||||||
return <Icon icon={ICONS.VIDEO} />;
|
return <Icon icon={ICONS.VIDEO} />;
|
||||||
} else if (mediaType === 'text') {
|
} else if (mediaType === 'text') {
|
||||||
return <Icon icon={ICONS.TEXT} />;
|
return <Icon icon={ICONS.TEXT} />;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { LIVE_STREAM_TAG } from 'constants/livestream';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Card from 'component/common/card';
|
import Card from 'component/common/card';
|
||||||
import ClaimPreview from 'component/claimPreview';
|
import ClaimPreview from 'component/claimPreview';
|
||||||
|
@ -18,7 +17,7 @@ export default function LivestreamLink(props: Props) {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
Lbry.claim_search({
|
Lbry.claim_search({
|
||||||
channel_ids: [livestreamChannelId],
|
channel_ids: [livestreamChannelId],
|
||||||
any_tags: [LIVE_STREAM_TAG],
|
has_no_source: true,
|
||||||
claim_type: ['stream'],
|
claim_type: ['stream'],
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
|
@ -328,7 +328,6 @@ function PublishFile(props: Props) {
|
||||||
|
|
||||||
const isPublishFile = mode === PUBLISH_MODES.FILE;
|
const isPublishFile = mode === PUBLISH_MODES.FILE;
|
||||||
const isPublishPost = mode === PUBLISH_MODES.POST;
|
const isPublishPost = mode === PUBLISH_MODES.POST;
|
||||||
const isPublishLivestream = mode === PUBLISH_MODES.LIVESTREAM;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
|
@ -357,7 +356,7 @@ function PublishFile(props: Props) {
|
||||||
value={title}
|
value={title}
|
||||||
onChange={handleTitleChange}
|
onChange={handleTitleChange}
|
||||||
/>
|
/>
|
||||||
{(isPublishFile || isPublishLivestream) && (
|
{isPublishFile && (
|
||||||
<FileSelector
|
<FileSelector
|
||||||
label={__('File')}
|
label={__('File')}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
@ -366,13 +365,6 @@ function PublishFile(props: Props) {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isPublishLivestream && (
|
|
||||||
<div className="help--warning">
|
|
||||||
While livestreaming is in beta, you still need to choose a file to upload. Please choose a small file. No
|
|
||||||
one will see this file.
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{isPublishPost && (
|
{isPublishPost && (
|
||||||
<PostEditor
|
<PostEditor
|
||||||
label={__('Post --[noun, markdown post tab button]--')}
|
label={__('Post --[noun, markdown post tab button]--')}
|
||||||
|
|
|
@ -135,7 +135,7 @@ function PublishForm(props: Props) {
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const TAGS_LIMIT = 5;
|
const TAGS_LIMIT = 5;
|
||||||
const fileFormDisabled = (mode === PUBLISH_MODES.FILE || mode === PUBLISH_MODES.LIVESTREAM) && !filePath;
|
const fileFormDisabled = mode === PUBLISH_MODES.FILE && !filePath;
|
||||||
const emptyPostError = mode === PUBLISH_MODES.POST && (!fileText || fileText.trim() === '');
|
const emptyPostError = mode === PUBLISH_MODES.POST && (!fileText || fileText.trim() === '');
|
||||||
const formDisabled = (fileFormDisabled && !editingURI) || emptyPostError || publishing;
|
const formDisabled = (fileFormDisabled && !editingURI) || emptyPostError || publishing;
|
||||||
const isInProgress = filePath || editingURI || name || title;
|
const isInProgress = filePath || editingURI || name || title;
|
||||||
|
@ -357,11 +357,6 @@ function PublishForm(props: Props) {
|
||||||
runPublish = true;
|
runPublish = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (Try to) Prevent an anon livestream claim
|
|
||||||
if (mode === PUBLISH_MODES.LIVESTREAM) {
|
|
||||||
updatePublishForm({ channel: activeChannelName });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (runPublish) {
|
if (runPublish) {
|
||||||
if (enablePublishPreview) {
|
if (enablePublishPreview) {
|
||||||
setPreviewing(true);
|
setPreviewing(true);
|
||||||
|
@ -387,10 +382,7 @@ function PublishForm(props: Props) {
|
||||||
// Editing claim uri
|
// Editing claim uri
|
||||||
return (
|
return (
|
||||||
<div className="card-stack">
|
<div className="card-stack">
|
||||||
<ChannelSelect
|
<ChannelSelect hideAnon={mode === PUBLISH_MODES.LIVESTREAM} disabled={disabled} />
|
||||||
hideAnon={mode === PUBLISH_MODES.LIVESTREAM}
|
|
||||||
disabled={disabled}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PublishFile
|
<PublishFile
|
||||||
uri={uri}
|
uri={uri}
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
export const LIVE_STREAM_TAG = 'odysee-livestream';
|
|
||||||
|
|
||||||
export const BITWAVE_EMBED_URL = 'https://bitwave.tv/embed';
|
export const BITWAVE_EMBED_URL = 'https://bitwave.tv/embed';
|
||||||
export const BITWAVE_API = 'https://api.bitwave.tv/v1/channels';
|
export const BITWAVE_API = 'https://api.bitwave.tv/v1/channels';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
// import { LIVE_STREAM_TAG, BITWAVE_API } from 'constants/livestream';
|
// import { BITWAVE_API } from 'constants/livestream';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
import LivestreamLayout from 'component/livestreamLayout';
|
import LivestreamLayout from 'component/livestreamLayout';
|
||||||
|
|
|
@ -60,10 +60,6 @@ export default function LivestreamSetupPage(props: Props) {
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******/
|
|
||||||
|
|
||||||
const LIVE_STREAM_TAG = 'odysee-livestream';
|
|
||||||
|
|
||||||
const [isFetching, setIsFetching] = React.useState(true);
|
const [isFetching, setIsFetching] = React.useState(true);
|
||||||
const [isLive, setIsLive] = React.useState(false);
|
const [isLive, setIsLive] = React.useState(false);
|
||||||
const [livestreamClaims, setLivestreamClaims] = React.useState([]);
|
const [livestreamClaims, setLivestreamClaims] = React.useState([]);
|
||||||
|
@ -75,7 +71,7 @@ export default function LivestreamSetupPage(props: Props) {
|
||||||
|
|
||||||
Lbry.claim_search({
|
Lbry.claim_search({
|
||||||
channel_ids: [channelClaim.claim_id],
|
channel_ids: [channelClaim.claim_id],
|
||||||
any_tags: [LIVE_STREAM_TAG],
|
has_no_source: true,
|
||||||
claim_type: ['stream'],
|
claim_type: ['stream'],
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { DOMAIN } from 'config';
|
import { DOMAIN } from 'config';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { PAGE_SIZE } from 'constants/claim';
|
import { PAGE_SIZE } from 'constants/claim';
|
||||||
import { LIVE_STREAM_TAG } from 'constants/livestream';
|
|
||||||
import {
|
import {
|
||||||
doResolveUri,
|
doResolveUri,
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
|
@ -12,6 +11,7 @@ import {
|
||||||
makeSelectClaimIsMine,
|
makeSelectClaimIsMine,
|
||||||
makeSelectClaimIsPending,
|
makeSelectClaimIsPending,
|
||||||
makeSelectTagInClaimOrChannelForUri,
|
makeSelectTagInClaimOrChannelForUri,
|
||||||
|
makeSelectClaimHasSource,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { makeSelectChannelInSubscriptions } from 'redux/selectors/subscriptions';
|
import { makeSelectChannelInSubscriptions } from 'redux/selectors/subscriptions';
|
||||||
import { selectBlackListedOutpoints } from 'lbryinc';
|
import { selectBlackListedOutpoints } from 'lbryinc';
|
||||||
|
@ -62,8 +62,7 @@ const select = (state, props) => {
|
||||||
title: makeSelectTitleForUri(uri)(state),
|
title: makeSelectTitleForUri(uri)(state),
|
||||||
claimIsMine: makeSelectClaimIsMine(uri)(state),
|
claimIsMine: makeSelectClaimIsMine(uri)(state),
|
||||||
claimIsPending: makeSelectClaimIsPending(uri)(state),
|
claimIsPending: makeSelectClaimIsPending(uri)(state),
|
||||||
// Change to !makeSelectClaimHasSource()
|
isLivestream: !makeSelectClaimHasSource(uri)(state),
|
||||||
isLivestream: makeSelectTagInClaimOrChannelForUri(uri, LIVE_STREAM_TAG)(state),
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue