Coder Social home page Coder Social logo

rpp's Introduction

RPP

Description

RPP is a format used to describe REAPER projects. This package is designed to be RPP parser/emitter and uses PLY as parser framework.

Examples

Import the package:

>>> import rpp

Decode RPP:

>>> r = rpp.loads("""\
<REAPER_PROJECT 0.1 "4.32" 1372525904
  RIPPLE 0
  GROUPOVERRIDE 0 0 0
  AUTOXFADE 1
>
""")
>>> r
Element(tag='REAPER_PROJECT', attrib=['0.1', '4.32', '1372525904'], children=[
    ['RIPPLE', '0'],
    ['GROUPOVERRIDE', '0', '0', '0'],
    ['AUTOXFADE', '1'],
])

Transform elements into RPP:

>>> from rpp import Element
>>> rpp.dumps(
...     Element(tag='REAPER_PROJECT', attrib=['0.1', '4.32', '1372525904'], children=[
...         ['RIPPLE', '0'],
...         ['GROUPOVERRIDE', '0', '0', '0'],
...         ['AUTOXFADE', '1'],
...     ]))
'<REAPER_PROJECT 0.1 4.32 1372525904\n  RIPPLE 0\n  GROUPOVERRIDE 0 0 0\n  AUTOXFADE 1\n>\n'

Element mimics the interface of xml.etree.ElementTree.Element. You can perform quering operations with findall, find, iterfind. Note that attribute and text predicates are not supported.

>>> groupoverride = r.find('.//GROUPOVERRIDE')
>>> groupoverride
['GROUPOVERRIDE', '0', '0', '0']
>>> groupoverride[1:] = ['9', '9', '9']
>>> r
Element(tag='REAPER_PROJECT', attrib=['0.1', '4.32', '1372525904'], children=[
    ['RIPPLE', '0'],
    ['GROUPOVERRIDE', '9', '9', '9'],
    ['AUTOXFADE', '1'],
])

Dependencies

rpp's People

Contributors

perlence avatar leighsmith 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.