Merge pull request #170 from lbryio/use-get-availability

Use get_availability to determine stream availability
This commit is contained in:
alexliebowitz 2017-02-17 17:56:54 -05:00 committed by GitHub
commit d0a730f29f
2 changed files with 6 additions and 2 deletions

View file

@ -248,13 +248,13 @@ export let FileActions = React.createClass({
componentDidMount: function() {
this._isMounted = true;
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.sdHash, this.onFileInfoUpdate);
lbry.getPeersForBlobHash(this.props.sdHash, (peers) => {
lbry.getStreamAvailability(this.props.streamName, (availability) => {
if (!this._isMounted) {
return;
}
this.setState({
available: peers.length > 0,
available: availability > 0,
});
});
},

View file

@ -207,6 +207,10 @@ lbry.getPeersForBlobHash = function(blobHash, callback) {
});
}
lbry.getStreamAvailability = function(name, callback) {
lbry.call('get_availability', {name: name}, callback);
}
lbry.getCostInfoForName = function(name, callback, errorCallback) {
/**
* Takes a LBRY name; will first try and calculate a total cost using