MobileSheets Forums

Full Version: ChoPro metadata fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a ChoPro file "fiets.cho" that starts with

{t: Op Fietse}
{artist: Daniƫl Lohoes & Skik}

I have checked "Use Text Fields During Song Creation".

When I import this file, I get a song titled "fiets" (after the file name). In the song view the title is "Op Fietse" (as it should be) and below it is the artist info.
However, when I edit this song, field "Title" shows "fiets" and none of the other metadata has been set.

What am I doing wrong?

MSPro version 1.1.3.
Artist wasn't one of the fields that was being automatically populated. I've now updated the code to include that field. I also was not using the title in the chord pro file as the title for the song - that has been changed as well. There was also a bug where the fields were being set in the song but the UI on the fields tab was not updated.

Thanks for the help,

From the chordii site I'm not sure the spec is specific enough regarding whitespace ("Check: Is whitespace before/after the : allowed? Whitespace after the argument?") but I think it would be a good idea programming wise to be tolerant of whitespace in each of those cases. Before the colon, after the colon, and after the argument. Just a thought.

I didn't try before the colon because that just wasn't intuitive for me. I did notice however that after the colon is OK but after the argument is not.
There's an old saying, attributed to Jon Postel: "Be liberal in what you accept, and conservative in what you produce."
The ChordPro reference implementation uses the C-library function strtok with ": " (colon + space) as delimeters. Therefore it accepts all of the following:
{columns 2}
{columns: 2}
{columns : 2}
{ : columns ::: 2 : }

This also means that
{title: My Song}

specifies the title as "My Song" with no leading spaces.
I've reworked the parsing to use a tokenizing approach similar to what you suggested Johan. That should make it a little more forgiving.