Git Product home page Git Product logo

srt-parser's Introduction

srt-parser

Simple C program to modify and verify errors on SubRip subtitles

πŸ“šThis is the final project of a C language seminar on university. It's a command line program that checks for usual errors on subtitles in SubRip format (usually with a .srt extension).

In the SubRip format, the sequence of subtitles are formatted like this:

Captur2

Example of a SubRip subtitle:

Captura

Parameters and functionality:

  • -f "filein" ← file is the file name to process

  • -o "fileout" ← fileout is the file name where changes will be saved

  • -b index ← deletes the subtitle on index

  • -i startmilis endmillis "text" ← inserts a new subtitle text, starting on startmilis to endmilis

  • -v ← validates the subtitle looking for the following errors:

    • index values are not ordered consecutive numbers
    • index numbers don't start on 1
    • subtitles are overlapped (subtitle i end_time is greater than subtitle i+1 start_time)
    • a subtitle lasts less than 1 second
    • a subtitle lasts more than 7 seconds
    • subtitle line too long (more than 36 characters)
    • too many characters per second (more than 25)
    • subtitle has more than 2 lines of text
    • less than 75 miliseconds between subtitle i end and subtitle i+1 start.

    If errors are found, the program must print the index of the respective subtitle and a description of the error, and keep validating the file.

The project requirements and the way the parameters are processed:

  • f parameter is mandatory and cannot repeat
  • o parameter is mandatory if the file is modified with other parameters (all except -v) and cannot repeat
  • the rest of parameters are opcional, all need to be processed , and processed in order
  • parameters are received in any order
  • if there are more than one -f or -o parameter a help message is displayed and the exit code is 1
  • if a mandatory parameter is not received the previous message is displayed and the exit code is 2
  • if a invalid parameter is received the help message is displayed and exit code is 3
  • if the file in or file out cannot be opened or saved the exit code is 4.

Using it

Clone the repository

git clone https://github.com/fgerst/srt-parser.git

Compile the C source code using Makefile and GCC

cd srt-parser
make 

An example of a program invocation would be like this

> ./srt_parser -v -f "pine_barrens.srt" -o "pine_barrens_out.srt" -i 7000 8200 "Did you wrap the package?" -v -b 3 -v

srt-parser's People

Contributors

fgerst avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.