<commit_before><?php
use \Entity\Station;
use \Entity\Song;

class Api_NowplayingController extends \PVL\Controller\Action\Api
{
    public function indexAction()
    {
        $np = \DF\Cache::get('api_nowplaying_data');

        if (!$np)
        {
            $return_raw = $this->em->createQuery('SELECT s FROM Entity\Station s WHERE s.is_active = 1 ORDER BY s.weight ASC')
                ->getArrayResult();

            $np = array();
            foreach($return_raw as $row)
            {
                $np_row = $this->_processRow($row);
                $short_name = $np_row['station']['shortcode'];

                $np[$short_name] = $np_row;
            }

            \DF\Cache::save($np, 'api_nowplaying_data', array(), 10);
        }

        if ($this->_hasParam('id'))
        {
            $id = (int)$this->_getParam('id');
            $station = Station::find($id);<commit_msg>Update for data source of nowplaying API.<commit_after><?php
use \Entity\Station;
use \Entity\Song;

class Api_NowplayingController extends \PVL\Controller\Action\Api
{
    public function indexAction()
    {
        $np = \DF\Cache::get('api_nowplaying_data');

        if (!$np)
        {
            $return_raw = Station::fetchArray();

            $np = array();
            foreach($return_raw as $row)
            {
                $np_row = $this->_processRow($row);
                $short_name = $np_row['station']['shortcode'];

                $np[$short_name] = $np_row;
            }

            \DF\Cache::save($np, 'api_nowplaying_data', array(), 10);
        }

        if ($this->_hasParam('id'))
        {
            $id = (int)$this->_getParam('id');
            $station = Station::find($id);
{'fraction_non_alphanumeric': 0.15635939323220538, 'fraction_numerical': 0.0029171528588098016, 'mean_word_length': 1.9018612521150593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, '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': '3828729', 'n_tokens_mistral': 533, 'n_tokens_neox': 505, 'n_words': 95}