Skip to content

macmillanpublishers/split_spf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Split and Rename SPF files

A ruby script to chunk SPF files generated by the royalties program VISTA and rename each chunk as AUTHORNUM_PAYEENUM_ISBN_STATEMENTDATE.spf.

Dependencies

Ruby must be installed on the system running the script. The system must also support the basic bash commands cp and rm.

Splitting the file depends on the following:

  • Each file starts with the landscape layout binary code: ESC&l1O followed by a line break followed by an initial FF binary pagebreak
  • Page breaks are demarked by the binary FF character
  • The first page of every unique statement contains the string "Page 1" somewhere on that page

Renaming depends on 4 spans of data within each statement being formatted as follows:

Author Number:

  • String: "AUTHOR:""
  • Followed by: At least one up to any number of consecutive spaces
  • Followed by: At least one up to any number of consecutive digits

Payee Number:

  • String: "PAYEE:""
  • Followed by: At least one up to any number of consecutive spaces
  • Followed by: At least one up to any number of consecutive digits

ISBN

  • String: "978"
  • Followed by: 10 digits

Date

  • String: "ROYALTY STATEMENT FOR PERIOD ENDING "
  • Followed by: 2 digits + / + 4 digits

Distribution End Points

TK

Deployment

TK

Usage

On the command line, run:

$ ruby splitspf.rb inputfilename.spf

About

Splits and renames SPF files created from VISTA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages