<commit_before>package com.felkertech.sample.channelsurfer;

import android.media.PlaybackParams;
import android.media.tv.TvInputManager;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.felkertech.channelsurfer.TimeShiftable;
import com.felkertech.channelsurfer.model.Channel;
import com.felkertech.channelsurfer.model.Program;
import com.felkertech.channelsurfer.service.MultimediaInputProvider;
import com.felkertech.channelsurfer.service.WebViewInputProvider;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by guest1 on 1/7/2016.
 */
public class SampleTvInputProvider extends MultimediaInputProvider
        implements TimeShiftable {
    private String TAG = "SampleTvInputProvider";

    @Override
    public List<Channel> getAllChannels() {
        Log.d(TAG, "Get all channels");
//        Toast.makeText(SampleTvInputProvider.this, "Get all channels", Toast.LENGTH_SHORT).show();
        List<Channel> channels = new ArrayList<>();
        channels.add(new Channel()
            .setName("Time.Is")
            .setNumber("1"));
        channels.add(new Channel()
            .setName("Big Buck Bunny")
            .setNumber("2"));
        channels.add(new Channel()
            .setName("androidtv.news")
            .setNumber("3"));
        channels.add(new Channel()
            .setName("Dance Party")
            .setNumber("4"));
        Log.d(TAG, "Get channels");
        return channels;
    }

    @Override
    public List<Program> getProgramsForChannel(Uri channelUri, Channel channelInfo, long startTimeMs, long endTimeMs) {
        Log.d(TAG, "Get programs for channel "+channelInfo.getName());
//        Toast.makeText(SampleTvInputProvider.this, "Get all programs for "+channelInfo.getName(), Toast.LENGTH_SHORT).show();
        int programs = (int) ((endTimeMs-startTimeMs)/1000/60/60); //Hour long segments
        int SEGMENT = 1000*60*60; //Hour long segments
        List<Program> programList = new ArrayList<>();
        Log.d(TAG, "Get programs");
        for(int i=0;i<programs;i++) {
            Program p = null;
            if(channelInfo.getNumber().equals("1")) {
                p = new Program.Builder(getGenericProgram(channelInfo))
                        .setTitle("What Time is It?")
                        .setInternalProviderData("http://time.is")
                        .setVideoWidth(1920)
                        .setVideoHeight(1080)
                        .setStartTimeUtcMillis((getNearestHour() + SEGMENT * i))
                        .setEndTimeUtcMillis((getNearestHour() + SEGMENT * (i + 1)))
                        .build();
            } else if(channelInfo.getNumber().equals("2")) {
                p = new Program.Builder(getGenericProgram(channelInfo))
                        .setTitle("Big Buck Bunny")
                        .setInternalProviderData("http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8")
                        .setVideoWidth(1920)
                        .setVideoHeight(1080)
                        .setStartTimeUtcMillis((getNearestHour() + SEGMENT * i))
                        .setEndTimeUtcMillis((getNearestHour() + SEGMENT * (i + 1)))
                        .build();
            } else if(channelInfo.getNumber().equals("3")) {
                p = new Program.Builder(getGenericProgram(channelInfo))
                        .setTitle("Sample Video")
                        .setDescription("Visit http://androidtv.news, the one-stop shop for everything Android TV")
                        .setInternalProviderData(getLocalVideoUri(SampleTvSetup.LOCAL_FILES_FOLDER+"/atnews.mp4")) //b/c getPackageName is broken
                        .setVideoWidth(1600)
                        .setVideoHeight(900)
                        .setStartTimeUtcMillis((getNearestHour() + SEGMENT * i))
                        .setEndTimeUtcMillis((getNearestHour() + SEGMENT * (i + 1)))
                        .build();
            } else if(channelInfo.getNumber().equals("4")) {
                p = new Program.Builder(getGenericProgram(channelInfo))
                        .setTitle("Ectasy")
                        .setDescription("An example of building a music-based app, with local (or online) music. Ectasy is a song from PurplePlanet.")
                        .setInternalProviderData(getLocalAudioUri(SampleTvSetup.LOCAL_FILES_FOLDER+"/ectasy.mp3"))
                        .setVideoWidth(1920)
                        .setVideoHeight(1080)
                        .setStartTimeUtcMillis((getNearestHour() + SEGMENT * i))
                        .setEndTimeUtcMillis((getNearestHour() + SEGMENT * (i + 1)))<commit_msg>Local video, audio playback works now I do still want to integrate Crashlytics into the sample app before submitting again<commit_after>package com.felkertech.sample.channelsurfer;

import android.media.PlaybackParams;
import android.media.tv.TvInputManager;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.felkertech.channelsurfer.TimeShiftable;
import com.felkertech.channelsurfer.model.Channel;
import com.felkertech.channelsurfer.model.Program;
import com.felkertech.channelsurfer.service.MultimediaInputProvider;
import com.felkertech.channelsurfer.service.WebViewInputProvider;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by guest1 on 1/7/2016.
 */
public class SampleTvInputProvider extends MultimediaInputProvider
        implements TimeShiftable {
    private String TAG = "SampleTvInputProvider";

    @Override
    public List<Channel> getAllChannels() {
        Log.d(TAG, "Get all channels");
//        Toast.makeText(SampleTvInputProvider.this, "Get all channels", Toast.LENGTH_SHORT).show();
        List<Channel> channels = new ArrayList<>();
        channels.add(new Channel()
            .setName("Time.Is")
            .setNumber("1"));
        channels.add(new Channel()
            .setName("<NAME>")
            .setNumber("2"));
        channels.add(new Channel()
            .setName("androidtv.news")
            .setNumber("3"));
        channels.add(new Channel()
            .setName("Dance Party")
            .setNumber("4"));
        Log.d(TAG, "Get channels");
        return channels;
    }

    @Override
    public List<Program> getProgramsForChannel(Uri channelUri, Channel channelInfo, long startTimeMs, long endTimeMs) {
        Log.d(TAG, "Get programs for channel "+channelInfo.getName());
//        Toast.makeText(SampleTvInputProvider.this, "Get all programs for "+channelInfo.getName(), Toast.LENGTH_SHORT).show();
        int programs = (int) ((endTimeMs-startTimeMs)/1000/60/60); //Hour long segments
        int SEGMENT = 1000*60*60; //Hour long segments
        List<Program> programList = new ArrayList<>();
        Log.d(TAG, "Get programs");
        for(int i=0;i<programs;i++) {
            Program p = null;
            if(channelInfo.getNumber().equals("1")) {
                p = new Program.Builder(getGenericProgram(channelInfo))
                        .setTitle("What Time is It?")
                        .setInternalProviderData("http://time.is")
                        .setVideoWidth(1920)
                        .setVideoHeight(1080)
                        .setStartTimeUtcMillis((getNearestHour() + SEGMENT * i))
                        .setEndTimeUtcMillis((getNearestHour() + SEGMENT * (i + 1)))
                        .build();
            } else if(channelInfo.getNumber().equals("2")) {
                p = new Program.Builder(getGenericProgram(channelInfo))
                        .setTitle("Big Buck Bunny")
                        .setInternalProviderData("http://172.16.31.10/vod/smil:BigBuckBunny.smil/playlist.m3u8")
                        .setVideoWidth(1920)
                        .setVideoHeight(1080)
                        .setStartTimeUtcMillis((getNearestHour() + SEGMENT * i))
                        .setEndTimeUtcMillis((getNearestHour() + SEGMENT * (i + 1)))
                        .build();
            } else if(channelInfo.getNumber().equals("3")) {
                p = new Program.Builder(getGenericProgram(channelInfo))
                        .setTitle("Sample Video")
                        .setDescription("Visit http://androidtv.news, the one-stop shop for everything Android TV")
                        .setInternalProviderData(getLocalVideoUri(SampleTvSetup.LOCAL_FILES_FOLDER+"/androidtvnews.mp4")) //b/c getPackageName is broken
                        .setVideoWidth(1600)
                        .setVideoHeight(900)
                        .setStartTimeUtcMillis((getNearestHour() + SEGMENT * i))
                        .setEndTimeUtcMillis((getNearestHour() + SEGMENT * (i + 1)))
                        .build();
            } else if(channelInfo.getNumber().equals("4")) {
                p = new Program.Builder(getGenericProgram(channelInfo))
                        .setTitle("Ectasy")
                        .setDescription("An example of building a music-based app, with local (or online) music. Ectasy is a song from PurplePlanet.")
                        .setInternalProviderData(getLocalAudioUri(SampleTvSetup.LOCAL_FILES_FOLDER+"/ectasy.mp3"))
                        .setVideoWidth(1920)
                        .setVideoHeight(1080)
                        .setStartTimeUtcMillis((getNearestHour() + SEGMENT * i))
                        .setEndTimeUtcMillis((getNearestHour() + SEGMENT * (i + 1)))
{'fraction_non_alphanumeric': 0.11579269536829219, 'fraction_numerical': 0.016527239338910427, 'mean_word_length': 2.166343669250646, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6003094', 'n_tokens_mistral': 2815, 'n_tokens_neox': 2644, 'n_words': 510}