Exporting Song Lyrics from "My Songs" in Proclaim....

Page 1 of 1 (1 items)
This post has 0 Replies | 0 Followers

Posts 62
Jason Ledbetter | Forum Activity | Posted: Tue, Jun 13 2017 8:59 PM

Folk,

I figure this might be of use to someone else in the future, so I'm posting it here for posterity. I had the need to export all of my song lyrics (including my customized lyric ordering) from the "My Songs" portion of Proclaim, but the application doesn't seem to have that function.

I reached out to customer support who happily sent me a document on how to *add* new lyrics to Proclaim... 

Anyway, this is a python script - works on MacOS, dumps output similar to the following:

--snip--

==Start==
October 16th, 2016 - 11AM - Jonah, 2016-09-25, 'Tis so Sweet
CustomOrder: Verse 1, Chorus 1, Verse 2, Verse 3, Verse 4
Song Number: 22609
CCLI#: XXXX
Hymn Number: Hymn 391
Credits: Louisa M. R. Stead; William James Kirkpatrick
Copyright: Words: Public Domain ; Music: Public Domain
License Number: XXXX
Song Number: 22609
Song Title: 'Tis So Sweet To Trust In Jesus

Verse 1
'Tis so sweet to trust in Jesus
Just to take Him at His word
.....
--snip--

The underlying databases are simply sqlite, so the following python code will provide all of the unique song lists for importing elsewhere...

import os
import json
from bs4 import BeautifulSoup

# My local PresentationManager path on MacOS -- Yours should be similar, except "ssreg00c.b3u" may be different..
dbPath=os.path.expanduser("~/Library/Application Support/Proclaim/Data/ssreg00c.b3u/PresentationManager")
dbFile = dbPath + "/" + "PresentationManager.db"
os.chdir(dbPath)

# Helper function to parse the JSON content stored in PresentationManager.db
def parse_and_display_content(content):
# Turn the mess into a usable JSON/dict object
content = json.loads(content)

# Content that I want to know exists, or is null.
print("CustomOrder:", content.get('CustomOrderSequence'))
print("Song Number:", content.get('_textfield:Song Number'))
print("CCLI#:", content.get("_textfield:License Number"))

# Generic catchall for other fields, which may duplicate the above fields.
for key in content.keys():
if key.startswith("_textfield:"):
(k, v) = key.split(":")
print(v + ":", content.get(key))

print("")
# Pretty print the lyrics up for us
soup = BeautifulSoup(content["_richtextfield:Lyrics"], "lxml")
for p in soup.findAll('paragraph'):
if p.run:
print(p.run['text'])
elif p.run is None:
print("")

query= "SELECT p.Title as PresentationTitle, p.DateGiven, s.Title as SongTitle, s.Content \
FROM ServiceItems AS s JOIN Presentations AS p \
ON s.PresentationId == p.PresentationID \
WHERE ServiceItemKind = 'SongLyrics' GROUP BY s.Title;"

db = sqlite3.connect(dbFile)
db.row_factory = sqlite3.Row
cursor=db.execute(query)

for rec in cursor:
print("==Start==")
print("%s, %s, %s" % (rec['PresentationTitle'], rec['DateGiven'], rec['SongTitle']))
parse_and_display_content(rec['Content'])
print("==End==")

db.close()

-j

Page 1 of 1 (1 items) | RSS