package tv7;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] credit=new String[5000];
String[] v=new String[5000];
String title,sta,week;
String start,end;
String y1,m1,y2,m2;
String[] term=new String[500];
String[] time=new String[500];
int number;
String[] time_start=new String[500];
String[] time_end=new String[500];
String[] time_week=new String[500];
String[] year_start=new String[500];
String[] month_start=new String[500];
String[] year_end=new String[500];
String[] month_end=new String[500];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
for(s=1;s<5061;s++){
readfile sub2=new readfile();
sub2.makedata("data/"+s+".txt","UTF-8");
datanumber=sub2.datanumber;
if(datanumber>2){
memo sub=new memo();
sub.makedata("data/"+s+".txt");
}
}
}
}
package tv7;
import tool.*;
public class memo {
int s,datanumber;
String[] data=new String[5000];
String[] credit=new String[5000];
String[] v=new String[5000];
String title,sta,week;
String start,end;
String y1,m1,y2,m2;
String[] term=new String[500];
String[] time=new String[500];
int number;
String[] time_start=new String[500];
String[] time_end=new String[500];
String[] time_week=new String[500];
String[] year_start=new String[500];
String[] month_start=new String[500];
String[] year_end=new String[500];
String[] month_end=new String[500];
void makedata(String file){
readfile sub2=new readfile();
sub2.makedata(file,"UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
title="";
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
credit[s]="";
v[s]="";
int h=0;
if(x.length==1)h=h+1;
if(title.length()==0)h=h+1;
if(h==2)title=x[0];
if(x.length>1)credit[s]=x[0];
if(x.length>1)v[s]=x[1];
}
sta="";
for(s=1;s<datanumber+1;s++){
if(credit[s].indexOf("制作局")>-1)sta=v[s];
}
int sx=0;
for(s=1;s<datanumber+1;s++){
if(credit[s].indexOf("放送期間")>-1)sx=sx+1;
if(credit[s].indexOf("放送期間")>-1)term[sx]=v[s];
}
sx=0;
for(s=1;s<datanumber+1;s++){
if(credit[s].indexOf("放送時間")>-1)sx=sx+1;
if(credit[s].indexOf("放送時間")>-1)time[sx]=v[s];
}
number=sx;
for(s=1;s<number+1;s++){
time[s]=time[s].replace("曜日","曜");
time[s]=time[s].replace("毎週","");
}
for(s=1;s<number+1;s++){
timex(time[s]);
time_week[s]=week;
time_start[s]=start;
time_end[s]=end;
}
for(s=1;s<number+1;s++){
if(term[s]==null)term[s]="";
datex(term[s]);
year_start[s]=y1;
year_end[s]=y2;
month_start[s]=m1;
month_end[s]=m2;
}
for(s=1;s<number+1;s++){
System.out.print(title+","+sta+",");
System.out.print(time_week[s]+",");
System.out.print(year_start[s]+","+month_start[s]+",");
System.out.print(year_end[s]+","+month_end[s]+",");
System.out.println(time_start[s]+","+time_end[s]);
}
}
void datex(String d1){
int q1=d1.indexOf("年");
y1="";
if(q1>-1)y1=d1.substring(0,q1);
int q2=-1;
if(q1>-1)q2=d1.indexOf("月",q1);
m1="";
if(q2>-1)m1=d1.substring(q1+1,q2);
int q3=d1.indexOf("-");
int q4=-1;
if(q3>-1)q4=d1.indexOf("年",q3);
y2="";
if(q4>-1)y2=d1.substring(q3+1,q4);
int q5=-1;
if(q4>-1)q5=d1.indexOf("月",q4);
m2="";
if(q5>-1)m2=d1.substring(q4+1,q5);
}
void timex(String t1){
int p1=t1.indexOf("曜");
int px=0;
if(p1>-1)px= t1.indexOf("曜",p1+1);
if(px>0)p1=px;
week="";
if(p1>-1)week=t1.substring(0,p1+1);
int p2=-1;
if(p1>-1)p2= t1.indexOf("-",p1);
start="";
if(p2>-1)start=t1.substring(p1+1,p2);
int p3=-1;
if(p2>-1)p3= t1.indexOf("(",p2);
end="";
if(p3>-1)end=t1.substring(p2+1,p3);
}
}
最終更新:2016年07月22日 05:35