NetEase Public Course in English subtitle file merge code

Source: Internet
Author: User

If you want to reprint please indicate the source: http://blog.csdn.net/itas109

QQ Technology Group: 129518033


After downloading the video of NetEase public class, it is found that the Chinese and English letters are separate, and when they are opened with other players, they can only load a subtitle, so they want to merge 2 files.


Ideas:

Assume that the English caption of the file named 1.srt, the Chinese title of the file named 2.srt, the new merged file named 3.SRT. Assume a starting behavior of 1.

Reads each row in 1.SRT, synchronously reads each row in 2.srt, and writes 1.srt of data to 3.SRT, and writes data read in 2.SRT to 3.SRT when the value of the row count to 4 is found to be 3 o'clock.



Note: There may be extra blank lines in the Chinese subtitles of netease public course, resulting in merge errors.

Solution: With notepad++ first out of Chinese subtitles, in the replacement, find the mode select "Expand", find the content of "\r\n\r\n\r\n", replace the content "\r\n\r\n". (or try to find the content "\nn\n" and replace it with "\ n").



Processing part of the code:

while (Fgets (S,100,FP1)!=null) {fgets (S1,100,FP2); Fwrite (S,getlen (s), 1,FP3); Count++;if (count%4 = 3) {fwrite (S1, Getlen (S1), 1,fp3); line++;}}

Full code Download:

http://download.csdn.net/detail/itas109/8477269


If you want to reprint please indicate the source: http://blog.csdn.net/itas109

QQ Technology Group: 129518033


NetEase Public Course in English subtitle file merge code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.