Initial commit
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class AudioConfirmationData
|
||||
def initialize(audio_confirmation)
|
||||
@audio_confirmation = audio_confirmation
|
||||
end
|
||||
|
||||
def cue_number
|
||||
""
|
||||
end
|
||||
|
||||
def timecode_in
|
||||
audio_confirmation.timecode_in
|
||||
end
|
||||
|
||||
def title_and_source_file_name
|
||||
[audio_confirmation.title, audio_confirmation.source_file_name].reject(&:blank?).join(" - ")
|
||||
end
|
||||
|
||||
def catalog
|
||||
audio_confirmation.catalog
|
||||
end
|
||||
|
||||
def use
|
||||
"#{audio_confirmation.music_type} #{audio_confirmation.music_category}"
|
||||
end
|
||||
|
||||
def interested_parties
|
||||
"Composers:\n#{audio_confirmation.composer_info}\nPublishers:\n#{audio_confirmation.publisher_info}"
|
||||
end
|
||||
|
||||
def composers
|
||||
converted_composers.map do |composer|
|
||||
"#{composer.name} (#{composer.affiliation})"
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
def composers_split
|
||||
converted_composers.map(&:percentage).join("\n")
|
||||
end
|
||||
|
||||
def composers_with_split
|
||||
converted_composers.map do |composer|
|
||||
"#{composer.name} (#{composer.affiliation}) #{composer.percentage}%"
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
def composers_cae_numbers
|
||||
converted_composers.map(&:cae_number).join("\n")
|
||||
end
|
||||
|
||||
def publishers
|
||||
converted_publishers.map do |publisher|
|
||||
"#{publisher.name} (#{publisher.affiliation})"
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
def publishers_split
|
||||
converted_publishers.map(&:percentage).join("\n")
|
||||
end
|
||||
|
||||
def publishers_with_split
|
||||
converted_publishers.map do |publisher|
|
||||
"#{publisher.name} (#{publisher.affiliation}) #{publisher.percentage}%"
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
def music_type
|
||||
audio_confirmation.music_type.to_s.first
|
||||
end
|
||||
|
||||
def music_category
|
||||
audio_confirmation.music_category.to_s.first
|
||||
end
|
||||
|
||||
def timecode_out
|
||||
audio_confirmation.timecode_out
|
||||
end
|
||||
|
||||
def duration
|
||||
audio_confirmation.duration
|
||||
end
|
||||
|
||||
def origin
|
||||
if audio_confirmation.confirmation_type_library?
|
||||
"Production Library (Non-affiliated)"
|
||||
else
|
||||
"Commissioned"
|
||||
end
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
audio_confirmation == other.audio_confirmation
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
attr_reader :audio_confirmation
|
||||
|
||||
def converted_composers
|
||||
composers = audio_confirmation.composer_info.split("|")
|
||||
composers.map do |composer_info|
|
||||
parts = composer_info.split(",")
|
||||
if cae_number_index = parts.index { |part| part.include?("$cae") }
|
||||
cae_number = parts.delete_at(cae_number_index)
|
||||
end
|
||||
Composer.new(
|
||||
name: parts[0...-2].join(","),
|
||||
affiliation: parts[-2].strip,
|
||||
percentage: parts.last,
|
||||
cae_number: cae_number.to_s.gsub("$cae:", "").strip
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def converted_publishers
|
||||
audio_confirmation.publisher_info.split("|").map do |publisher_info|
|
||||
parts = publisher_info.split(",")
|
||||
Publisher.new(
|
||||
name: parts[0...-2].join(","),
|
||||
affiliation: parts[-2].strip,
|
||||
percentage: parts.last,
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class BrayInnovationGroupMusicCueHeaderData
|
||||
def initialize(video)
|
||||
@video = video
|
||||
end
|
||||
|
||||
def title
|
||||
video.name
|
||||
end
|
||||
|
||||
def company_name
|
||||
video.project.producer_name
|
||||
end
|
||||
|
||||
def company_address
|
||||
video.project.producer_address
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :video
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class BrayInnovationGroupMusicCueReport
|
||||
def initialize(video)
|
||||
@video = video
|
||||
end
|
||||
|
||||
def to_xls
|
||||
BrayInnovationGroupMusicCueSheet.build(workbook, report_data, report_header_data)
|
||||
package.to_stream.read
|
||||
end
|
||||
|
||||
def filename
|
||||
"#{video.file.filename.to_s.parameterize}_big-cue-sheet.xlsx"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :video
|
||||
|
||||
def report_data
|
||||
video.audio_confirmations.order(timecode_in: :asc).map do |audio_confirmation|
|
||||
AudioConfirmationData.new(audio_confirmation)
|
||||
end
|
||||
end
|
||||
|
||||
def report_header_data
|
||||
BrayInnovationGroupMusicCueHeaderData.new(video)
|
||||
end
|
||||
|
||||
def workbook
|
||||
@workbook ||= package.workbook
|
||||
end
|
||||
|
||||
def package
|
||||
@package ||= Axlsx::Package.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,97 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class BrayInnovationGroupMusicCueSheet < ::ExcelReports::Worksheet
|
||||
def title
|
||||
"BiG Music Cue Sheet"
|
||||
end
|
||||
|
||||
def fill_content(sheet)
|
||||
sheet.add_row ["TITLE", header_data.title]
|
||||
sheet.add_row ["COMPANY NAME", header_data.company_name]
|
||||
sheet.add_row ["ADDRESS", header_data.company_address]
|
||||
sheet.add_row ["LENGTH", ""]
|
||||
sheet.add_row ["TYPE", ""]
|
||||
sheet.add_row
|
||||
sheet.add_row table_headers
|
||||
sheet.add_row table_subheaders
|
||||
|
||||
data.each do |datum|
|
||||
sheet.add_row [
|
||||
datum.cue_number,
|
||||
datum.title_and_source_file_name,
|
||||
datum.composers,
|
||||
datum.composers_split,
|
||||
datum.publishers,
|
||||
datum.publishers_split,
|
||||
datum.music_type,
|
||||
datum.music_category,
|
||||
datum.timecode_in,
|
||||
datum.timecode_out,
|
||||
datum.duration,
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
def format(sheet)
|
||||
sheet.merge_cells "G7:H7"
|
||||
sheet.column_widths *column_widths
|
||||
end
|
||||
|
||||
def style(sheet)
|
||||
sheet.add_style "A1:A5", Styles::PROGRAM_HEADER
|
||||
sheet.add_style "B1:B5", Styles::HEADER_DATA
|
||||
sheet.add_style "A7:K7", Styles::TABLE_HEADER
|
||||
|
||||
if data.any?
|
||||
sheet.add_style "A#{data_start_index}:K#{data_end_index}", Styles::TABLE_DATA
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def table_headers
|
||||
[
|
||||
"Cue #",
|
||||
"Cue Title",
|
||||
"Composer(s)/Affiliation",
|
||||
"%",
|
||||
"Publisher(s)/Affiliation",
|
||||
"%",
|
||||
"Use",
|
||||
"",
|
||||
"In Time",
|
||||
"Out Time",
|
||||
"Duration",
|
||||
]
|
||||
end
|
||||
|
||||
def table_subheaders
|
||||
[
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"I = Instr.\nV = Vocal",
|
||||
"B = Bckgrnd\nF = Feature\nT = Theme",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
]
|
||||
end
|
||||
|
||||
def column_widths
|
||||
[15, 40, 20, 10, 20, 10, 20, 20, 15, 15, 15]
|
||||
end
|
||||
|
||||
def data_start_index
|
||||
9
|
||||
end
|
||||
|
||||
def data_end_index
|
||||
(data_start_index + data.size) - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,29 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class DiscoveryMusicCueHeaderData
|
||||
def initialize(video)
|
||||
@video = video
|
||||
end
|
||||
|
||||
def title
|
||||
video.name
|
||||
end
|
||||
|
||||
def company_name
|
||||
video.project.producer_name
|
||||
end
|
||||
|
||||
def client_name
|
||||
video.project.client_name
|
||||
end
|
||||
|
||||
def episode_number
|
||||
video.number
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :video
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class DiscoveryMusicCueReport
|
||||
def initialize(video)
|
||||
@video = video
|
||||
end
|
||||
|
||||
def to_xls
|
||||
DiscoveryMusicCueSheet.build(workbook, report_data, report_header_data)
|
||||
package.to_stream.read
|
||||
end
|
||||
|
||||
def filename
|
||||
"#{video.file.filename.to_s.parameterize}_discovery-cue-sheet.xlsx"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :video
|
||||
|
||||
def report_header_data
|
||||
DiscoveryMusicCueHeaderData.new(video)
|
||||
end
|
||||
|
||||
def report_data
|
||||
video.audio_confirmations.order(timecode_in: :asc).map do |audio_confirmation|
|
||||
AudioConfirmationData.new(audio_confirmation)
|
||||
end
|
||||
end
|
||||
|
||||
def workbook
|
||||
@workbook ||= package.workbook
|
||||
end
|
||||
|
||||
def package
|
||||
@package ||= Axlsx::Package.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,90 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class DiscoveryMusicCueSheet < ::ExcelReports::Worksheet
|
||||
def title
|
||||
"Discovery Music Cue Sheet"
|
||||
end
|
||||
|
||||
def fill_content(sheet)
|
||||
sheet.add_row ["Original Production Title", header_data.title, "Original Series Title", "", "Broadcaster", ""]
|
||||
sheet.add_row ["Alternative Production Title", "", "Alternative Series Title", "", "Production Company", header_data.company_name]
|
||||
sheet.add_row ["Local Production Title", "", "Local Series Title", "", "", ""]
|
||||
sheet.add_row ["Working Production Title", "", "Working Series Title", "", "Production Number", ""]
|
||||
sheet.add_row ["Version Production Title", "", "Version Series Title", "", "Director", ""]
|
||||
sheet.add_row ["Episode No.", header_data.episode_number, "Season No.", "", "Production Parent Identifier", ""]
|
||||
sheet.add_row ["Year", "", "Country", "", "Soundmouse Legacy Identifier", ""]
|
||||
sheet.add_row ["Duration", "", "Type", "", "Production ID", ""]
|
||||
sheet.add_row ["First Transmission", "", "Source", ""]
|
||||
sheet.add_row ["Product Name", ""]
|
||||
sheet.add_row ["Client Name", header_data.client_name]
|
||||
sheet.add_row ["Narrative", ""]
|
||||
sheet.add_row ["End Line", ""]
|
||||
sheet.add_row ["Clock Number", ""]
|
||||
sheet.add_row ["ISAN", ""]
|
||||
|
||||
sheet.add_row
|
||||
sheet.add_row table_headers
|
||||
|
||||
data.each_with_index do |datum, index|
|
||||
sheet.add_row [
|
||||
index + 1,
|
||||
datum.timecode_in,
|
||||
datum.title_and_source_file_name,
|
||||
datum.catalog,
|
||||
datum.use,
|
||||
datum.interested_parties,
|
||||
"",
|
||||
datum.duration,
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
def format(sheet)
|
||||
sheet.column_widths *column_widths
|
||||
end
|
||||
|
||||
def style(sheet)
|
||||
sheet.add_style "A1:A15", Styles::PROGRAM_HEADER
|
||||
sheet.add_style "C1:C9", Styles::PROGRAM_HEADER
|
||||
sheet.add_style "E1:E8", Styles::PROGRAM_HEADER
|
||||
|
||||
sheet.add_style "B1:B15", Styles::HEADER_DATA
|
||||
sheet.add_style "D1:D9", Styles::HEADER_DATA
|
||||
sheet.add_style "F1:F8", Styles::HEADER_DATA
|
||||
|
||||
sheet.add_style "A17:H17", Styles::TABLE_HEADER
|
||||
|
||||
if data.any?
|
||||
sheet.add_style "A#{data_start_index}:H#{data_end_index}", Styles::TABLE_DATA
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def table_headers
|
||||
[
|
||||
"No.",
|
||||
"Timecode",
|
||||
"Title",
|
||||
"Music Origin",
|
||||
"Use (Theme/Description)",
|
||||
"Interested Parties",
|
||||
"Identifiers",
|
||||
"Duration",
|
||||
]
|
||||
end
|
||||
|
||||
def column_widths
|
||||
[20, 20, 40, 20, 20, 20, 20, 20]
|
||||
end
|
||||
|
||||
def data_start_index
|
||||
18
|
||||
end
|
||||
|
||||
def data_end_index
|
||||
(data_start_index + data.size) - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,36 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class NatGeoMusicCueSheet
|
||||
def initialize(video)
|
||||
@video = video
|
||||
end
|
||||
|
||||
def to_xls
|
||||
NatGeoMusicCueSheets::MainSheet.build(workbook, report_data)
|
||||
package.to_stream.read
|
||||
end
|
||||
|
||||
def filename
|
||||
"#{video.file.filename.to_s.parameterize}_music-cue-sheet.xlsx"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :video
|
||||
|
||||
def report_data
|
||||
video.audio_confirmations.order(timecode_in: :asc).map do |audio_confirmation|
|
||||
AudioConfirmationData.new(audio_confirmation)
|
||||
end
|
||||
end
|
||||
|
||||
def workbook
|
||||
@workbook ||= package.workbook
|
||||
end
|
||||
|
||||
def package
|
||||
@package ||= Axlsx::Package.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,97 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
module NatGeoMusicCueSheets
|
||||
class MainSheet < Worksheet
|
||||
def title
|
||||
"Nat Geo Music Cue Sheet"
|
||||
end
|
||||
|
||||
def fill_content(sheet)
|
||||
sheet.add_row ["National Geographic", "", "", "", "", "", "", "", "", ""]
|
||||
sheet.add_row ["Music Cue Sheet", "", "", "", "", "", "", "", "", ""]
|
||||
sheet.add_row
|
||||
sheet.add_row table_headers
|
||||
|
||||
data.each_with_index do |datum, index|
|
||||
sheet.add_row [
|
||||
index + 1,
|
||||
datum.title_and_source_file_name,
|
||||
datum.timecode_in,
|
||||
datum.timecode_out,
|
||||
datum.composers_with_split,
|
||||
datum.publishers_with_split,
|
||||
datum.catalog,
|
||||
datum.origin,
|
||||
datum.use,
|
||||
datum.duration,
|
||||
]
|
||||
end
|
||||
|
||||
sheet.add_row ["", "", "", "", "", "", "", "", "Total Music Duration:", total_duration]
|
||||
end
|
||||
|
||||
def format(sheet)
|
||||
sheet.column_widths *column_widths
|
||||
cells_to_merge.each { |cell| sheet.merge_cells cell }
|
||||
end
|
||||
|
||||
def style(sheet)
|
||||
sheet.add_style "A1:J1", Styles::BOLD, { sz: 18 }
|
||||
sheet.add_style "A2:J2", Styles::BOLD, Styles::FULLY_CENTERED, { sz: 16 }
|
||||
sheet.add_style "A#{data_start_index-1}:J#{data_start_index-1}", Styles::BOLD, Styles::THIN_BLACK_BORDER, Styles::WRAP_TEXT
|
||||
|
||||
if data.any?
|
||||
sheet.add_style "A#{data_start_index}:J#{data_end_index}", Styles::THIN_BLACK_BORDER
|
||||
sheet.add_style "E#{data_start_index}:F#{data_end_index}", Styles::WRAP_TEXT
|
||||
sheet.add_style "I#{data_start_index}:I#{data_end_index}", Styles::WRAP_TEXT
|
||||
end
|
||||
|
||||
sheet.add_style "I#{data_end_index + 1}", Styles::BOLD, Styles::WRAP_TEXT
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def table_headers
|
||||
[
|
||||
"No.",
|
||||
"Title",
|
||||
"In",
|
||||
"Out",
|
||||
"Composer",
|
||||
"Publisher",
|
||||
"Record Label / Library",
|
||||
"Music Origin",
|
||||
"Use",
|
||||
"Duration",
|
||||
]
|
||||
end
|
||||
|
||||
def column_widths
|
||||
[10, 30, 20, 20, 50, 50, 20, 25, 25, 20]
|
||||
end
|
||||
|
||||
def cells_to_merge
|
||||
%w(A1:J1 A2:J2)
|
||||
end
|
||||
|
||||
def data_start_index
|
||||
5
|
||||
end
|
||||
|
||||
def data_end_index
|
||||
(data_start_index + data.size) - 1
|
||||
end
|
||||
|
||||
def total_duration
|
||||
data.map do |datum|
|
||||
begin
|
||||
DurationTimecode.parse(datum.duration)
|
||||
rescue ArgumentError
|
||||
DurationTimecode.new(0, 0, 0)
|
||||
end
|
||||
end.sum.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,36 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
class NatGeoOriginalMusicLog
|
||||
def initialize(video)
|
||||
@video = video
|
||||
end
|
||||
|
||||
def to_xls
|
||||
NatGeoOriginalMusicLogs::MainSheet.build(workbook, report_data)
|
||||
package.to_stream.read
|
||||
end
|
||||
|
||||
def filename
|
||||
"#{video.file.filename.to_s.parameterize}_original-music-log.xlsx"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :video
|
||||
|
||||
def report_data
|
||||
video.audio_confirmations.original.order(timecode_in: :asc).map do |audio_confirmation|
|
||||
AudioConfirmationData.new(audio_confirmation)
|
||||
end
|
||||
end
|
||||
|
||||
def workbook
|
||||
@workbook ||= package.workbook
|
||||
end
|
||||
|
||||
def package
|
||||
@package ||= Axlsx::Package.new
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,74 @@
|
||||
module ExcelReports
|
||||
module AudioReports
|
||||
module NatGeoOriginalMusicLogs
|
||||
class MainSheet < Worksheet
|
||||
def title
|
||||
"Nat Geo Original Music Log"
|
||||
end
|
||||
|
||||
def fill_content(sheet)
|
||||
sheet.add_row ["National Geographic", "", "", "",]
|
||||
sheet.add_row ["National Geographic Music", "", "", "",]
|
||||
sheet.add_row ["Original Music Log", "", "", "",]
|
||||
sheet.add_row ["[PROGRAM]", "", "", ""]
|
||||
sheet.add_row ["[SEASON #]", "", "", ""]
|
||||
sheet.add_row [BigMediaTime.time_zone_now.to_date.strftime("%D"), "", "", ""]
|
||||
sheet.add_row table_headers
|
||||
|
||||
data.each_with_index do |datum, index|
|
||||
sheet.add_row [
|
||||
datum.title_and_source_file_name,
|
||||
datum.composers_with_split,
|
||||
datum.composers_cae_numbers,
|
||||
datum.publishers_with_split,
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
def format(sheet)
|
||||
sheet.column_widths *column_widths
|
||||
cells_to_merge.each { |cell| sheet.merge_cells cell }
|
||||
end
|
||||
|
||||
def style(sheet)
|
||||
sheet.add_style "A1:D1", Styles::BOLD, { sz: 18 }
|
||||
sheet.add_style "A2:D2", Styles::BOLD, Styles::FULLY_CENTERED, { sz: 16 }
|
||||
sheet.add_style "A3:D3", Styles::FULLY_CENTERED, { sz: 14 }
|
||||
sheet.add_style "A#{data_start_index-1}:D#{data_start_index-1}", Styles::BOLD, Styles::THIN_BLACK_BORDER, Styles::WRAP_TEXT, Styles::BG_GRAY
|
||||
|
||||
if data.any?
|
||||
sheet.add_style "A#{data_start_index}:D#{data_end_index}", Styles::THIN_BLACK_BORDER
|
||||
sheet.add_style "A#{data_start_index}:D#{data_end_index}", Styles::WRAP_TEXT
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def table_headers
|
||||
[
|
||||
"CUE TITLE",
|
||||
"COMPOSER(S), % SPLIT & PRO",
|
||||
"COMPOSER CAE/IPI#",
|
||||
"PUBLISHER(S), % SPLIT & PRO",
|
||||
]
|
||||
end
|
||||
|
||||
def column_widths
|
||||
[25, 45, 25, 80]
|
||||
end
|
||||
|
||||
def cells_to_merge
|
||||
%w(A1:D1 A2:D2 A3:D3)
|
||||
end
|
||||
|
||||
def data_start_index
|
||||
8
|
||||
end
|
||||
|
||||
def data_end_index
|
||||
(data_start_index + data.size) - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user