<commit_before>import "regenerator-runtime"
import { take, put, cps } from "redux-saga/effects"
import { addSaga } from "apollos/core/store/utilities"

addSaga(function* setMetaData(getStore) {

  while(true) {
    const payload = yield take("AUDIO.SET_STATE");

    if (typeof NowPlaying === "undefined") return;

    const { audio } = getStore();

    const playing = audio.state === "playing";
    const paused = audio.state === "paused";

    // convert elapsed time to seconds
    const [timeMin, timeSec] = audio.time.split(":");
    const elapsedSeconds = (Number((timeMin * 60)) + Number(timeSec)) || 0;

    // convert duration to seconds
    const [durMin, durSec] = audio.playing.track.duration.split(":");
    const durationSeconds = Number((durMin * 60)) + Number(durSec) || 0;

    NowPlaying.set({
      albumTitle: audio.playing.album.title,
      artist: "NewSpring", // switch to artist when available
      title: audio.playing.track.title,
      artwork: `https://${audio.playing.album.content.images[0]}`,
      elapsedPlaybackTime: elapsedSeconds,
      playbackDuration: durationSeconds,
      playbackRate: playing ? 1 : 0,<commit_msg>add some comments<commit_after>import "regenerator-runtime"
import { take, put, cps } from "redux-saga/effects"
import { addSaga } from "apollos/core/store/utilities"

addSaga(function* setMetaData(getStore) {

  /* This updates the iOS MPNowPlayingInfoCenter, which basically
   * means it provides title, artwork, and playback information to
   * the lock screen and the command center.
   *
   * We only need to update the information when the playback state
   * has changed, because MPNowPlayingInfoCenter will automatically
   * calculate how much time has passed based on `playbackRate`.
   * When paused, `playbackRate` is 0, and when playing it is 1.
   */
  while(true) {
    const payload = yield take("AUDIO.SET_STATE");

    if (typeof NowPlaying === "undefined") return;

    const { audio } = getStore();

    const playing = audio.state === "playing";
    const paused = audio.state === "paused";

    // convert elapsed time to seconds
    const [timeMin, timeSec] = audio.time.split(":");
    const elapsedSeconds = (Number((timeMin * 60)) + Number(timeSec)) || 0;

    // convert duration to seconds
    const [durMin, durSec] = audio.playing.track.duration.split(":");
    const durationSeconds = Number((durMin * 60)) + Number(durSec) || 0;

    NowPlaying.set({
      albumTitle: audio.playing.album.title,
      artist: "NewSpring", // switch to artist when available
      title: audio.playing.track.title,
      artwork: `https://${audio.playing.album.content.images[0]}`,
      elapsedPlaybackTime: elapsedSeconds,
      playbackDuration: durationSeconds,
      playbackRate: playing ? 1 : 0,
{'fraction_non_alphanumeric': 0.12747569319409435, 'fraction_numerical': 0.007202016564638099, 'mean_word_length': 3.622296173044925, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, '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': '5930365', 'n_tokens_mistral': 864, 'n_tokens_neox': 807, 'n_words': 233}