我需要字幕方面的帮助 =)
我有两个带字幕的 .srt 文件。一个是英语,另一个是斯洛文尼亚语。问题是斯洛文尼亚语的文件没有正确的时间码,所以字幕比实际行快。我想要做的是编写一个程序来读取这两个文件,从 eng.srt 文件中获取字幕的数量和时间码以及从slo.srt文件中的字幕,并将所有内容写入complete.srt。我不在乎它是用 Java 还是 C 语言。我目前正在尝试用 C 语言编写程序,我会寻求任何帮助。
现在来演示一下我想要做什么:
eng.srt (right timecode)
1
00:00:01,259 --> 00:00:03,734
<i>Previously on...</i>
2
00:00:03,746 --> 00:00:06,910
<i>Tom and Lynette drifted further apart,</i>
3
00:00:06,911 --> 00:00:09,275
<i>and Jane took advantage.</i>
4
00:00:09,440 --> 00:00:10,670
I'm scared.
5
00:00:10,671 --> 00:00:13,362
<i>Roy helped Karen face her cancer.</i>
slo.srt (right subtitles)
1
00:00:00,009 --> 00:00:02,484
<i>Prejšnič...</i>
2
00:00:02,496 --> 00:00:05,660
<i>Tom and Lynette
sta se še bolj odtujila,</i>
3
00:00:05,661 --> 00:00:08,025
<i>in Jane je to izkoristila.</i>
4
00:00:08,190 --> 00:00:09,420
Strah me je.
5
00:00:09,421 --> 00:00:12,112
<i>Roy se je pomagal Karen
soočiti z rakom.</i>
complete.srt (where i write)
1
00:00:01,259 --> 00:00:03,734
<i>Prejšnič...</i>
2
00:00:03,746 --> 00:00:06,910
<i>Tom and Lynette
sta se še bolj odtujila,</i>
...
这是我到目前为止所拥有的(我打开 3 个文件,我将随时更新我的工作):
#include <stdio.h>
#include <stdlib.h>
int main()
{
char ch, sf1[20], sf2[20], tf[20];
FILE *source1, *source2, *target;
//first source file
printf("Enter name of first source file\n");
gets(sf1);
source1 = fopen(sf1, "r");
//seconds source file
printf("Enter name of second source file\n");
gets(sf2);
source2 = fopen(sf2, "r");
if( source == NULL )
{
printf("Press any key to exit...\n");
exit(EXIT_FAILURE);
}
//target file
printf("Enter name of target file\n");
gets(tf);
target = fopen(tf, "w");
if( target == NULL )
{
fclose(source);
printf("Press any key to exit...\n");
exit(EXIT_FAILURE);
}
printf("File writen successfully.\n");
fclose(source1);
fclose(source2);
fclose(target);
return 0;
}
我的问题是我不知道如何告诉程序只读取eng.srt文件中的数字,而不是跳过字幕部分并等待,而不是读取slo.srt 文件取出字幕并跳过数字。