Generating usage reports from OpenLP

edited June 13 in General Support
I recently wrote a Perl script (sorry - not  that fluent yet in Python) to generate usage reports from the Usage Tracking file that OpenLP can generate. It summarizes the number of times a particular song is used over a specified period of time. It also aggregates any usage within a one hour period, so if you test a song and then play it back during a service (all within the same clock hour) it will count as one usage. It's written in basic Perl, so any system (Windows, MacOS or Linux) that has Perl installed should be able to run it. I used Strawberry Perl on Windows. I'm releasing it under GNU General Public License. This is based on OpenLP 2.4.6 file format. If you're interested, send me a note and I'll be happy to send a copy. I'm not sure how to post the whole script or upload it to the OpenLP repository.

Sample output below:
perl OpenLP_usage.pl -h
Usage:
  perl OpenLP_usage.pl -in=<infile> -out=<outfile> -start=<start_date> -end=<end_date> [-DEBUG] [-DETAIL]
  -in                   Input file (required)
  -out                  Output file (required)
  -start                First date to process (yyyy-mm-dd)  (Default=2016-01-01)
  -end|last             Ending date to process (yyyy-mm-dd) (Default=now)
  -detail               If specified, the date and time of each song's usage will also be shown
  -help                 Print this usage message
  -debug                Enable Debug (default=0)

perl OpenLP_usage.pl -in=usage.csv -out=usage.txt -start=2019-05-01 -end=2019-05-31

Processed 74 lines from usage.csv
  for period 2019-05-01 through 2019-05-31
  beginning with line number 222 and ending with 296.

Uses  Title
   1  All I Want
   1  At the Table of Jesus
   1  G1-66 Psalm 67: May God Bless Us in His Mercy
   1  G2-34: Psalm 34: Taste and See
   2  G2-442 Sing with All the Saints in Glory
   1  G2-456 Now the Green Blade Rises
   1  G2-496 How Great Thou Art
...

perl OpenLP_usage.pl -in=usage.csv -out=usage.txt -start=2019-05-01 -end=2019-05-31 -detail

Processed 74 lines from usage.csv
  for period 2019-05-01 through 2019-05-31
  beginning with line number 222 and ending with 296.

Uses  Title
   1  All I Want
      2019-05-26 09:44:32
   1  At the Table of Jesus
      2019-05-26 09:42:35
   1  G1-66 Psalm 67: May God Bless Us in His Mercy
      2019-05-26 10:36:21
   1  G2-34: Psalm 34: Taste and See
      2019-05-11 10:09:22
   2  G2-442 Sing with All the Saints in Glory
      2019-05-12 09:56:32
      2019-05-12 11:25:45
 ...
Sign In or Register to comment.