<commit_before>import BaseController from '../../base/base_controller';
import Config from '../../core/config';
import DOM from '../../utils/dom';
import {PROVIDERS_LIST} from '../../constants/providers';

import YoutubeProvider from './providers/youtube/youtube_provider';
import YoutubeModel from './providers/youtube/youtube_model';

import VimeoProvider from './providers/vimeo/vimeo_provider';
import VimeoModel from './providers/vimeo/vimeo_model';

import SoundCloudProvider from './providers/soundcloud/soundcloud_provider';
import SoundCloudModel from './providers/soundcloud/soundcloud_model';


/**
 *
 */
class PlayerController extends BaseController {
    static CLASS = 'PlayerController';
    static selectorClass = '.smp_player';

    songModel = null;


    /**
     *
     */
    init(songModel) {
        this.songModel = songModel;
        this.render();
    }


    /**
     *
     */
    play() {
        this.logger.info('PLAY CALLED');

        try {
            this.getProvider().play();
        } catch(err) {
            this.logger.error(err);
        }
    }


    /**
     *
     */
    render() {
        this.logger.info('RENDER CALLED');
    }


    /**
     *
     */
    getProvider() {
        if (null !== this.Provider) return this.Provider;

        switch (this.songModel.CLASS) {
            case YoutubeProvider.CLASS:
                this.Provider = YoutubeProvider.create(this.songModel);
                break;

            case VimeoProvider.CLASS:
                this.Provider = VimeoProvider.create(this.songModel);
                break;

            case SoundCloudProvider.CLASS:
                this.Provider = SoundCloudProvider.create(this.songModel);
                break;

            default:
                throw new Error('Provider was not found');

            return null;
        }
    }
}

export default PlayerController;<commit_msg>provider controller fixed ref<commit_after>import BaseController from '../../base/base_controller';
import Config from '../../core/config';
import DOM from '../../utils/dom';
import {PROVIDERS_LIST} from '../../constants/providers';

import YoutubeProvider from './providers/youtube/youtube_provider';
import VimeoProvider from './providers/vimeo/vimeo_provider';
import SoundCloudProvider from './providers/soundcloud/soundcloud_provider';



/**
 *
 */
class PlayerController extends BaseController {
    static CLASS = 'PlayerController';
    static selectorClass = '.smp_player';

    songModel = null;
    Provider = null;


    /**
     *
     */
    init(songModel) {
        this.songModel = songModel;
        this.render();
    }


    /**
     *
     */
    play() {
        this.logger.info('PLAY CALLED');

        try {
            this.getProvider().play();
        } catch(err) {
            this.logger.error(err);
        }
    }


    /**
     *
     */
    render() {
        this.logger.info('RENDER CALLED');
    }


    /**
     *
     */
    getProvider() {
        if (null !== this.Provider) return this.Provider;

        switch (this.songModel.provider) {
            case PROVIDERS_LIST.YOUTUBE:
                this.Provider = YoutubeProvider.create(this.songModel);
                break;

            case PROVIDERS_LIST.VIMEO:
                this.Provider = VimeoProvider.create(this.songModel);
                break;

            case PROVIDERS_LIST.SOUNDCLOUD:
                this.Provider = SoundCloudProvider.create(this.songModel);
                break;

            default:
                throw new Error('Provider was not found');
                break;

            return this.Provider;
        }
    }
}

export default PlayerController;
{'fraction_non_alphanumeric': 0.12394901003525902, 'fraction_numerical': 0.0, 'mean_word_length': 1.931637519872814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5703241', 'n_tokens_mistral': 1059, 'n_tokens_neox': 988, 'n_words': 195}