Skip to content

pglaum/e7impress-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

e7impress utils

This is a parser for e7impress files. The song lyrics can be output as json or plain text.

setup

You need to install the following dependencies package from your favorite python package manager.

  • click
  • pydantic

(e.g. run pip install -r requirements.txt or install them manually)

command line utilities

The is a command-line program e7 can be used to create scripts.

Example (in your shell):

$ ./e7 parse path/to/file.7is
$ ./e7 parse -f txt path/to/file.7is
$ ./e7 parse -o output.json path/to/file.7is

The resulting json files can be loaded and printed as txt:

$ ./e7 load output.json

full command line syntax

$ ./e7 --help
Usage: e7 [OPTIONS] COMMAND [ARGS]...

  Initialize the cli context.

Options:
  --debug / --no-debug
  --help                Show this message and exit.

Commands:
  load   Load a `Song` file.
  parse  Parse an e7impress file.

$ ./e7 load --help
Usage: e7 load [OPTIONS] FILENAME

  Load a `Song` file.

Options:
  -f, --format [txt|json]  The output format
  --help                   Show this message and exit.

$ ./e7 parse --help
Usage: e7 parse [OPTIONS] FILENAME

  Parse an e7impress file.

Options:
  -f, --format [txt|json]  The output format.
  -o, --output TEXT        The output file. If no filename is given, the
                           result iswritten to stdout.

  --help                   Show this message and exit.

e7parser

You can load and parse a file like this:

from e7parser import E7File

e7file = E7File('path/to/file.7is')
song = e7file.get_song()

The Song class contains all relevant info. This is the schema:

class Verse:
    name: str
    text: str

class Song:
    order: List[str]  # List of verse names in order
    verses: List[Verse]  # All verses in the song
    title: str

A Song object can be written into a file, like this:

song.save('filename.json')

The file can also be loaded:

song = Song.load('filename.json')

A Song object returns the whole Song, in order, with the following command:

song.txt()

About

Simple parser for .7is files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages