cuechapter 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/cuechapter +29 -0
- data/lib/cuechapter.rb +39 -0
- metadata +80 -0
data/bin/cuechapter
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'cuechapter'
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
opts = OptionParser.new do |opts|
|
9
|
+
opts.on("-c", "--cue PATH", "Path to chesheet file") do |cue_file|
|
10
|
+
options[:cue] = cue_file
|
11
|
+
end
|
12
|
+
|
13
|
+
opts.on("-x", "--xml [PATH]", "Path to xml file") do |xml_file|
|
14
|
+
options[:xml] = xml_file
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on("-p", "--picture [PATH]", "Path to picture") do |pic_file|
|
18
|
+
options[:pic] = pic_file
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on("-l", "--link [link]", "Link for chapters") do |link|
|
22
|
+
options[:link] = link
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.parse!
|
27
|
+
|
28
|
+
cuechapter = CueChapter::CueChapter.new(options[:cue], options[:xml], options[:pic], options[:link])
|
29
|
+
cuechapter.convert
|
data/lib/cuechapter.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rubycue'
|
2
|
+
require 'builder'
|
3
|
+
|
4
|
+
module CueChapter
|
5
|
+
class CueChapter < RubyCue::Cuesheet
|
6
|
+
def initialize(cuesheet, xml_file=nil, image_file=nil, link=nil)
|
7
|
+
super(File.read(cuesheet))
|
8
|
+
parse!
|
9
|
+
|
10
|
+
if @xml_file.nil?
|
11
|
+
@xml_file=File.path(cuesheet).gsub(File.extname(cuesheet),".xml")
|
12
|
+
puts @xml_file
|
13
|
+
else
|
14
|
+
@xml_file = xml_file
|
15
|
+
end
|
16
|
+
|
17
|
+
@image_file = image_file
|
18
|
+
@link = link
|
19
|
+
end
|
20
|
+
|
21
|
+
def convert
|
22
|
+
File.open(@xml_file, 'w') { |f| f.write(to_chapter_xml) }
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_chapter_xml
|
26
|
+
xml = Builder::XmlMarkup.new(:indent => 2)
|
27
|
+
|
28
|
+
xml.chapters("version" => "1") {
|
29
|
+
songs.each do |song|
|
30
|
+
xml.chapter("starttime" => "#{song[:index].minutes}:#{song[:index].seconds}") {
|
31
|
+
xml.title "#{song[:performer]} - #{song[:title]}"
|
32
|
+
xml.picture "#{@image_file}"
|
33
|
+
xml.link "#{@link}"
|
34
|
+
}
|
35
|
+
end
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cuechapter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Owen Parrish
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rubycue
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.0.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: builder
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.1.4
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.1.4
|
46
|
+
description: Converts a cuesheet file into a chapter XML file that can be used by
|
47
|
+
ChatperX or GarageBand/ChapterTool to add chapters to an m4a/m4b file
|
48
|
+
email: owen.parrish@gmail.com
|
49
|
+
executables:
|
50
|
+
- cuechapter
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- lib/cuechapter.rb
|
55
|
+
- bin/cuechapter
|
56
|
+
homepage: https://github.com/oparrish/cuechapter
|
57
|
+
licenses: []
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.8.24
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Convert a cuesheet to a chapter XML file
|
80
|
+
test_files: []
|