package tv3;
import tool.*;
import java.io.*;
import java.io.File;
public class pro {
int s,datanumber;
String[] subdata=new String[5000000];
String[] data=new String[5000];
String[] sta=new String[5000];
String[] time=new String[5000];
String[] time2=new String[5000];
String[] title=new String[5000];
String[] link=new String[5000];
int number;
int[] year=new int[5000];
int[] month=new int[5000];
int[] day=new int[5000];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
File f=new File("gdata");
String[] ff=f.list();
int tr;
int sx=0;
for(tr=0;tr<ff.length;tr++){
readfile sub=new readfile();
sub.makedata("gdata/"+ff[tr],"UTF-8");
data=sub.data;
datanumber=sub.datanumber;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
time[s]=x[0];
title[s]=x[1];
link[s]=x[2];
sta[s]="";
if(link[s].indexOf("cx")>-1)sta[s]="フジ";
if(link[s].indexOf("tx")>-1)sta[s]="テレビ東京";
if(link[s].indexOf("tbs")>-1)sta[s]="TBS";
if(link[s].indexOf("ex")>-1)sta[s]="テレビ朝日";
if(link[s].indexOf("nhk")>-1)sta[s]="NHK";
if(link[s].indexOf("ntv")>-1)sta[s]="日本テレビ";
}
time2[datanumber]="05:00";
for(s=1;s<datanumber;s++){
time2[s]="05:00";
if(sta[s].equals(sta[s+1]))time2[s]=time[s+1];
}
String x1=ff[tr].substring(0,4);
String x2=ff[tr].substring(4,6);
String x3=ff[tr].substring(6,8);
for(s=1;s<datanumber;s++){
year[s]=num_int(x1);
month[s]=num_int(x2);
day[s]=num_int(x3);
}
for(s=1;s<datanumber;s++){
sx=sx+1;
subdata[sx]=year[s]+","+month[s]+","+day[s]+","+time[s]+","+time2[s]+","+sta[s]+","+title[s]+","+link[s];
}
}
datanumber=sx;
writexml("ren.txt");
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<datanumber+1;s++){
pw.println(subdata[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
int num_int(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2017年01月15日 08:49