Class: BbEPUB::Transform::AudioSoundtrack

Inherits:
Bookbinder::Transform
  • Object
show all
Defined in:
lib/bb-epub/transform/audio_soundtrack.rb

Overview

For the specification, see the iBooks Asset Guide, specifically the section titled “Ambient Soundtrack” in version 5.1:

https://itunesconnect.apple.com/docs/iBooksAssetGuide5.1Revision2.pdf

Instance Method Summary collapse

Instance Method Details

#dependenciesObject



9
10
11
# File 'lib/bb-epub/transform/audio_soundtrack.rb', line 9

def dependencies
  [BbEPUB::Transform::Spine]
end

#from_map(package) ⇒ Object

Iterate through each spine item, adding an audio tag to components that don’t have one, or setting the src if the audio tag exists.



28
29
30
31
32
33
34
# File 'lib/bb-epub/transform/audio_soundtrack.rb', line 28

def from_map(package)
  package.map['spine'].each { |cmpt|
    if cmpt['audio-soundtrack']
      add_soundtrack_to_component(cmpt, package.file(cmpt['path']))
    end
  }
end

#to_map(package) ⇒ Object

Iterate through each spine item, looking for

<audio epub:type="ibooks:soundtrack" src="..." />


18
19
20
21
22
# File 'lib/bb-epub/transform/audio_soundtrack.rb', line 18

def to_map(package)
  package.map['spine'].each { |cmpt|
    find_soundtrack_in_component(cmpt, package.file(cmpt['path']))
  }
end