public virtual bool IsChannelPlayable(Channel channel)
{
int channel_bitrate = channel.ChannelInfo.Bitrate;
var total_upstream_rate = PeerCast.Channels.Sum(c => c.OutputStreams.Sum(o => o.IsLocal ? 0 : o.UpstreamRate));
var channel_upstream_rate = channel.OutputStreams.Sum(o => o.IsLocal ? 0 : o.UpstreamRate);
return
(this.MaxPlays<=0 || this.MaxPlays>PeerCast.Channels.Sum(c => c.LocalDirects)) &&
(this.MaxPlaysPerChannel<=0 || this.MaxPlaysPerChannel>channel.LocalDirects) &&
(this.MaxUpstreamRate<0 || this.MaxUpstreamRate>=total_upstream_rate+channel_bitrate) &&
(this.MaxUpstreamRatePerChannel<=0 || this.MaxUpstreamRatePerChannel>=channel_upstream_rate+channel_bitrate);
}