<commit_before>// @flow
/**
 * All About Olaf
 * KSTO page
 */

import React from 'react'
import {StyleSheet, View, Text, Dimensions, Image} from 'react-native'
import * as c from '../components/colors'
import Icon from 'react-native-vector-icons/Ionicons'
import delay from 'delay'
import Video from 'react-native-video'
import {Touchable} from '../components/touchable'
import {TabBarIcon} from '../components/tabbar-icon'

const kstoStream = 'https://cdn.stobcm.com/radio/ksto1.stream/master.m3u8'
const image = require('../../../images/streaming/ksto/ksto-logo.png')

export default class KSTOView extends React.PureComponent {
  static navigationOptions = {
    tabBarLabel: 'KSTO',
    tabBarIcon: TabBarIcon('radio'),
  }

  state: {
    refreshing: boolean,
    paused: boolean,
    streamError: ?Object,
    metadata: Object[],
  } = {
    refreshing: false,
    paused: true,
    streamError: null,
    metadata: [],
  }

  changeControl = () => {
    this.setState(state => ({paused: !state.paused}))
  }

  // callback when HLS ID3 tags change
  onTimedMetadata = (data: any) => {
    this.setState(() => ({metadata: data}))
    console.log(data)
  }

  // error from react-native-video
  onError = (e: any) => {
    this.setState(() => ({streamError: e, paused: true}))
    console.log(e)
  }

  player: Video

  render() {
    <PlayPauseButton
      onPress={this.changeControl}
      paused={this.state.paused}
    />

    return (
      <View style={styles.container}>
        <Logo />
        {button}
        {/*<Song />*/}
        <Title />

        <Video
          ref={ref => (this.player = ref)}
          source={{uri: kstoStream}}
          playInBackground={true}
          playWhenInactive={true}
          paused={this.state.paused}
          onTimedMetadata={this.onTimedMetadata}
          onError={this.onError}
        />
      </View>
    )
  }
}

const Logo = () =>
  <View style={styles.wrapper}>
    <Image source={image} style={styles.logo} /><commit_msg>Fixup according to prettier and lint<commit_after>// @flow
/**
 * All About Olaf
 * KSTO page
 */

import React from 'react'
import {StyleSheet, View, Text, Dimensions, Image} from 'react-native'
import * as c from '../components/colors'
import Icon from 'react-native-vector-icons/Ionicons'
import Video from 'react-native-video'
import {Touchable} from '../components/touchable'
import {TabBarIcon} from '../components/tabbar-icon'

const kstoStream = 'https://cdn.stobcm.com/radio/ksto1.stream/master.m3u8'
const image = require('../../../images/streaming/ksto/ksto-logo.png')

export default class KSTOView extends React.PureComponent {
  static navigationOptions = {
    tabBarLabel: 'KSTO',
    tabBarIcon: TabBarIcon('radio'),
  }

  state: {
    refreshing: boolean,
    paused: boolean,
    streamError: ?Object,
    metadata: Object[],
  } = {
    refreshing: false,
    paused: true,
    streamError: null,
    metadata: [],
  }

  changeControl = () => {
    this.setState(state => ({paused: !state.paused}))
  }

  // callback when HLS ID3 tags change
  onTimedMetadata = (data: any) => {
    this.setState(() => ({metadata: data}))
    console.log(data)
  }

  // error from react-native-video
  onError = (e: any) => {
    this.setState(() => ({streamError: e, paused: true}))
    console.log(e)
  }

  player: Video

  render() {
    return (
      <View style={styles.container}>
        <Logo />
        <PlayPauseButton
          onPress={this.changeControl}
          paused={this.state.paused}
        />
        {/*<Song />*/}
        <Title />

        <Video
          ref={ref => (this.player = ref)}
          source={{uri: kstoStream}}
          playInBackground={true}
          playWhenInactive={true}
          paused={this.state.paused}
          onTimedMetadata={this.onTimedMetadata}
          onError={this.onError}
        />
      </View>
    )
  }
}

const Logo = () =>
  <View style={styles.wrapper}>
    <Image source={image} style={styles.logo} />
{'fraction_non_alphanumeric': 0.15531540588087459, 'fraction_numerical': 0.0020105554159336515, 'mean_word_length': 2.6580882352941178, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 37, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6063247', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1290, 'n_words': 278}