Code Monkey home page Code Monkey logo

cinecanvas-xml's Introduction

DCPsub is a low-level DCP subtitle XML generator for Python. It generates CineCanvas compliant subtitle code. It does not do any actual writing to a file.

Usage

Instantiate the XMLsubgen class by supplying a minimum of UUID and the film title like:

my_sub = XMLsubgen(uuid, title)

Then you can get the XML file header:

header = my_sub.genheader()

A subtitle event is generated by supplying a 2-item list representing timecode in and exclusive timecode out, and an n-element list representing subtitle rows where n is any positive integer. For example:

tc = ['01:00:00:000', '01:00:04:201']

txt = ['The best practice is', 'to have maximum of two rows.']

subtitle = my_sub.gensubtitle(tc, txt)

Note that CineCanvas spec does not use SMPTE timecode. The values in the last field represent ticks (1 tick = 4 ms). The class method does not do any validation. It is up to you to supply a valid string.

Finally, to generate the closing XML tags use:

endtags = my_sub.genendtags()

There is a convenience genuuid() method which generates compliant UUIDs for suplying back to the class when creating an instance. The UUID should also be used in the file name. To use the UUID generator:

uuid = my_sub.genuuid()

The CineCanvas spec is available at http://www.deluxecdn.com/dcinema/support/ti_subtitle_spec_v1_1.pdf.

cinecanvas-xml's People

Contributors

igorridanovic avatar

Stargazers

wangbodbs avatar

Watchers

 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.