rakemkv 0.2.0 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cd54a538d15fb78a5905d935a82afd6015cb9c5d
4
- data.tar.gz: dae6fb5b06d867b7174c9f5d8783cbad34d3f37d
2
+ SHA256:
3
+ metadata.gz: 02f8cffb011e4838056e6c79727ece8658762505d1870a0b54c0dd8a782b82b1
4
+ data.tar.gz: 0f3cefd92a771f90cfdb831682522eb4d95254e73306d1d12fda2c286408e556
5
5
  SHA512:
6
- metadata.gz: 9af5fa59cabaa281f2f7a8fdbd26f2468896333f9209b037156a01e1037e6fce90a7dceb5791112ca3d02a6a1adcad6f731f62bdbdbc5ef165d350416453a56d
7
- data.tar.gz: f4295cb3583406b97e197c99e8efe29d3e245dbdc509b6de6537a1413102b54828c338b946288dbee3bf23b732df146be85d8ba9668083fd2b01be9f4606423a
6
+ metadata.gz: 46cc001c74272390379c57bec0248f40d2a4f4ad9c4839d64dad08d0364ca574810188e340e2758ece0d572518e0ce20e7415a3f0f77f76e6d3828014cb43cbc
7
+ data.tar.gz: 3b47c8aa8ba78870574fe2d4ba138ce39f9d6151ebdd4c147995db9462e2302a0c9bb3e683067a13369f6552ab393cd50e507bae9df7138143132ee266482402
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ working_directory: "~/rakemkv"
5
+ docker:
6
+ - image: tabfugnic/debian-makemkv
7
+ steps:
8
+ - checkout
9
+ - run:
10
+ name: Setup
11
+ command: |
12
+ gem install bundler
13
+ bundle install
14
+ - run:
15
+ name: Run tests
16
+ command: bundle exec rspec
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ spec/reports
18
18
  test/tmp
19
19
  test/version_tmp
20
20
  tmp
21
+ wget-log*
data/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.3.0 - 2018/07/01
6
+
7
+ - [Change] Output to folder with disc name
8
+ - [Feature] Allow `all` for `title_id` on disc to transcode all titles above minimum length threshold
9
+ - [Change] Remove most things from the configuration singleton
10
+ - [Feature] Start building project with continuous integration
11
+ - [Fix] Normalize name of disc for folders
12
+ - [Change] Adjust API to more closely replicate MakeMKV
13
+
14
+ ## 0.2.0 - 2015/03/08
15
+
16
+ - Initial release
17
+ - Allow basic transcoding
data/README.md CHANGED
@@ -25,20 +25,49 @@ Or install it yourself as:
25
25
 
26
26
  ## Usage
27
27
 
28
+ Most straight forward usage to transcode a single disc. This will find
29
+ the longest title, transcode it, and place that file in the working
30
+ directory.
31
+
28
32
  ```
29
- disc = RakeMKV::Disc.new('location/to/disc')
33
+ disc = RakeMKV::Disc.new(location: "path/to/disc")
30
34
  disc.transcode!
31
35
  ```
32
36
 
37
+ `transcode!` by default will transcode the longest title, but it takes
38
+ `title_id` as an argument if you determine a different title. Passing
39
+ `all` will include every title above the minimum length specified.
40
+
41
+ To transcode the fifth title you would do:
42
+
43
+ ```
44
+ disc = RakeMKV::Disc.new(location: "path/to/disc")
45
+ disc.transcode!(title_id: 5)
46
+ ```
47
+
48
+ `Disc` takes destination and minlength as arguments as well. This lets
49
+ you determine where you want the files to end up and what the minimum
50
+ length of the titles transcoded must be.
51
+
52
+ For example, if you wanted to transcode titles over the 20 minutes
53
+ long into the tmp directory you can do the following:
54
+
55
+ ```
56
+ disc = RakeMKV::Disc.new(
57
+ destination: "/tmp",
58
+ location: "path/to/disc",
59
+ minlength: 1200, # time in seconds
60
+ )
61
+ disc.transcode!(title_id: "all")
62
+ ```
63
+
33
64
  ## Configuration
34
65
 
35
66
  You can configure RakeMKV by doing the following:
36
67
 
37
68
  ```ruby
38
69
  RakeMKV.configure do |config|
39
- config.binary = 'new_makemkv_binary'
40
- config.destination = 'new/destination/path'
41
- config.minimum_title_length = 120 # Number in seconds
70
+ config.binary = "new_makemkv_binary'
42
71
  end
43
72
  ```
44
73
 
data/bin/create_disc ADDED
@@ -0,0 +1,105 @@
1
+ #!/bin/sh
2
+
3
+ main() {
4
+ final_disc_title=$1
5
+ number_of_titles=${2:-2}
6
+ length_range=${3:-5}
7
+
8
+ current_directory=$(pwd)
9
+ tmp_directory=$(mktemp -d)
10
+
11
+ echo "Building fake disc '$final_disc_title' with $number_of_titles titles no longer than $length_range seconds each"
12
+
13
+ cd $tmp_directory
14
+ echo "Setup Environment"
15
+ generate_dvdstructure $number_of_titles
16
+
17
+ echo "Creating Blank Video"
18
+ for i in `seq 1 $number_of_titles`; do
19
+ create_blank_mpeg $i $((RANDOM % length_range + 1))
20
+ done
21
+
22
+ echo "Building DVD from Files"
23
+ create_dvd_from_files
24
+
25
+ echo "Transform into ISO"
26
+ build_iso_from_movie ${final_disc_title} "test.iso"
27
+
28
+ cp test.iso $current_directory/
29
+ rm -rf $tmp_directory
30
+ }
31
+
32
+
33
+ create_blank_mpeg() {
34
+ name=$1
35
+ length=$2
36
+
37
+ ffmpeg \
38
+ -loglevel panic \
39
+ -t $length \
40
+ -s 720x480 \
41
+ -f rawvideo \
42
+ -pix_fmt monow \
43
+ -r 25 \
44
+ -i /dev/zero \
45
+ -y \
46
+ -target ntsc-dvd \
47
+ -g 18 \
48
+ -aspect 16:9 \
49
+ -mbd rd \
50
+ -trellis 2 \
51
+ -cmp 2 \
52
+ -subcmp 2 \
53
+ $name.mpg
54
+ }
55
+
56
+ create_dvd_from_files() {
57
+ dvdauthor -o movie -x dvdstructure.xml >/dev/null 2>&1
58
+ }
59
+
60
+ generate_dvdstructure() {
61
+ number_of_titles=$1
62
+
63
+ for i in `seq 1 $number_of_titles`; do
64
+ pgc_content=$(generate_pgc_content ${i}.mpg)
65
+ done
66
+
67
+ cat <<EOF > dvdstructure.xml
68
+ <?xml version="1.0" encoding="UTF-8"?>
69
+ <dvdauthor>
70
+ <vmgm>
71
+ <menus>
72
+ <video format="ntsc" aspect="16:9" resolution="720xfull"/>
73
+ <pgc entry="title">
74
+ <pre>g2 = 0; jump title 1;</pre>
75
+ </pgc>
76
+ </menus>
77
+ </vmgm>
78
+ <titleset>
79
+ <titles>
80
+ <video format="ntsc" aspect="16:9" widescreen="nopanscan"/>
81
+ ${pgc_content}
82
+ </titles>
83
+ </titleset>
84
+ </dvdauthor>
85
+ EOF
86
+ }
87
+
88
+ build_iso_from_movie() {
89
+ final_title=$1
90
+ output=$2
91
+
92
+ genisoimage -dvd-video -V $final_title -o $output $(pwd)/movie >/dev/null 2>&1
93
+ }
94
+
95
+ generate_pgc_content() {
96
+ filename=$1
97
+
98
+ cat <<EOF
99
+ <pgc pause="10">
100
+ <vob file="./${filename}" />
101
+ </pgc>
102
+ EOF
103
+ }
104
+
105
+ main $1 $2 $3
data/lib/rakemkv.rb CHANGED
@@ -8,11 +8,11 @@ module RakeMKV
8
8
  end
9
9
  end
10
10
 
11
- require "cocaine"
11
+ require "terrapin"
12
12
  require "singleton"
13
+ require "rakemkv/binary"
13
14
  require "rakemkv/code"
14
15
  require "rakemkv/command"
15
- require "rakemkv/command_builder"
16
16
  require "rakemkv/configuration"
17
17
  require "rakemkv/disc"
18
18
  require "rakemkv/parser"
@@ -0,0 +1,25 @@
1
+ module RakeMKV
2
+ class Binary
3
+ WHICH="which".freeze
4
+
5
+ def initialize(command_line_class: Terrapin::CommandLine)
6
+ @command_line_class = command_line_class
7
+ end
8
+
9
+ def self.installed?
10
+ new.installed?
11
+ end
12
+
13
+ def installed?
14
+ !command_line_class.new(WHICH, makemkv_binary).run.empty?
15
+ end
16
+
17
+ private
18
+
19
+ attr_reader :command_line_class
20
+
21
+ def makemkv_binary
22
+ RakeMKV.config.binary
23
+ end
24
+ end
25
+ end
data/lib/rakemkv/code.rb CHANGED
@@ -40,8 +40,8 @@ class RakeMKV::Code
40
40
  :seamless_info,
41
41
  :panel_text,
42
42
  :mkv_flags,
43
- :mkv_flags_text
44
- ]
43
+ :mkv_flags_text,
44
+ ].freeze
45
45
 
46
46
  attr_reader :index
47
47
 
@@ -1,35 +1,39 @@
1
1
  # Command Object
2
2
  class RakeMKV::Command
3
3
  # Initialize with path
4
- def initialize(path)
4
+ def initialize(path:, command_line_class: Terrapin::CommandLine)
5
5
  @path = path
6
- end
7
-
8
- # Check if mkv is installed
9
- def self.installed?
10
- output = Cocaine::CommandLine.new('which', RakeMKV.config.binary).run
11
- !output.empty?
6
+ @command_line_class = command_line_class
12
7
  end
13
8
 
14
9
  # Call info command on disc
15
- def info
16
- @info ||= execute("info #{@path}")
10
+ def info(options = {})
11
+ arguments = build_arguments(options)
12
+ @info ||= execute("info #{path}", arguments)
17
13
  end
18
14
 
19
15
  # Call mkv command on disc
20
- def mkv(title_id, destination)
21
- @mkv ||= execute("mkv #{@path} #{title_id} #{destination}")
16
+ def mkv(title_id, destination, options = {})
17
+ arguments = build_arguments(options)
18
+ @mkv ||= execute("mkv #{path} #{title_id} #{destination}", arguments)
22
19
  end
23
20
 
24
21
  private
25
22
 
26
- def execute(command)
27
- Cocaine::CommandLine.new(
28
- "#{RakeMKV.config.binary} -r", full_command(command)
29
- ).run
23
+ attr_reader :command_line_class, :path
24
+
25
+ def build_arguments(options)
26
+ options.map do |key,value|
27
+ "--#{key}=#{value}"
28
+ end.join(" ")
29
+ end
30
+
31
+ def execute(command, arguments)
32
+ full_command = [command, arguments].reject(&:empty?).join(" ")
33
+ command_line_class.new(binary, full_command).run
30
34
  end
31
35
 
32
- def full_command(command)
33
- RakeMKV::CommandBuilder.new(command).build
36
+ def binary
37
+ "#{RakeMKV.config.binary} -r"
34
38
  end
35
39
  end
@@ -5,16 +5,10 @@ class RakeMKV::Configuration
5
5
  attr_writer :binary, :destination
6
6
 
7
7
  def binary
8
- @binary || 'makemkvcon'
9
- end
10
-
11
- def destination
12
- @destination || Dir.pwd
8
+ @binary || "makemkvcon"
13
9
  end
14
10
 
15
11
  def reset!
16
12
  self.binary = nil
17
- self.destination = nil
18
- self.minimum_title_length = nil
19
13
  end
20
14
  end
data/lib/rakemkv/disc.rb CHANGED
@@ -2,9 +2,19 @@
2
2
  class RakeMKV::Disc
3
3
  attr_reader :location
4
4
 
5
+ DEFAULT_MINLENGTH = 120
6
+
5
7
  # Initialize disc
6
- def initialize(location)
8
+ def initialize(
9
+ location:,
10
+ destination: Dir.pwd,
11
+ minlength: DEFAULT_MINLENGTH,
12
+ parser_class: RakeMKV::Parser
13
+ )
7
14
  @location = location
15
+ @destination = destination
16
+ @minlength = minlength
17
+ @parser_class = parser_class
8
18
  end
9
19
 
10
20
  # Get path from location
@@ -24,14 +34,17 @@ class RakeMKV::Disc
24
34
 
25
35
  # parse file info from command
26
36
  def info
27
- @info ||= RakeMKV::Parser.new(command.info)
37
+ @info ||= parser_class.new command.info(arguments)
28
38
  end
29
39
 
30
40
  # Transcode information on disc
31
- def transcode!(options = {})
32
- destination = options[:destination] || RakeMKV.config.destination
33
- title_id = options[:title_id] || titles.longest.id
34
- command.mkv(title_id, destination)
41
+ def transcode!(title_id: titles.longest.id)
42
+ check_and_create_destination
43
+ command.mkv(title_id, destination_with_name, arguments)
44
+ end
45
+
46
+ def filesafe_name
47
+ info.cinfo[:name].downcase.gsub(/[\/ ]/ , "_")
35
48
  end
36
49
 
37
50
  # Get titles for disc
@@ -44,10 +57,22 @@ class RakeMKV::Disc
44
57
  info.cinfo[method.to_sym] || super
45
58
  end
46
59
 
60
+ def destination_with_name
61
+ File.join(destination, filesafe_name)
62
+ end
63
+
47
64
  private
48
65
 
66
+ attr_reader :minlength, :destination, :parser_class
67
+
49
68
  def command
50
- RakeMKV::Command.new(path)
69
+ RakeMKV::Command.new(path: path)
70
+ end
71
+
72
+ def check_and_create_destination
73
+ if !Dir.exists?(destination_with_name)
74
+ Dir.mkdir(destination_with_name)
75
+ end
51
76
  end
52
77
 
53
78
  def build_titles
@@ -61,4 +86,8 @@ class RakeMKV::Disc
61
86
  raise StandardError
62
87
  end
63
88
  end
89
+
90
+ def arguments
91
+ { minlength: minlength }.compact
92
+ end
64
93
  end
@@ -1,3 +1,3 @@
1
1
  module RakeMKV
2
- VERSION = '0.2.0'
2
+ VERSION = "0.3.0"
3
3
  end
data/rakemkv.gemspec CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{spec/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_dependency "json", "~> 1.7"
20
- spec.add_dependency "cocaine", "~> 0.5"
19
+ spec.add_dependency "json", "~> 2.1"
20
+ spec.add_dependency "terrapin", "~> 0.6"
21
21
 
22
22
  spec.add_development_dependency "bundler"
23
23
  spec.add_development_dependency "rake"
Binary file
@@ -1,17 +1,36 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
- describe 'transcoding disc' do
4
- it 'copies disc to destination' do
5
- movie = File.new('./spec/fixtures/movie.iso')
3
+ describe "transcoding disc" do
4
+ it "copies the longest title of the disc to destination" do
5
+ movie = File.new("./spec/fixtures/movie.iso")
6
6
  movie_path = File.expand_path(movie.path)
7
7
 
8
8
  Dir.mktmpdir do |directory|
9
- RakeMKV.config.minimum_title_length = 2
10
- RakeMKV.config.destination = directory
9
+ RakeMKV::Disc.new(
10
+ destination: directory,
11
+ location: movie_path,
12
+ minlength: 3,
13
+ ).transcode!
11
14
 
12
- RakeMKV::Disc.new(movie_path).transcode!
15
+ expect(Dir.entries(directory)).to include("DVDVIDEO")
16
+ expect(Dir.entries("#{directory}/DVDVIDEO")).to include("title00.mkv")
17
+ end
18
+ end
19
+
20
+ it "copies all titles to the destination" do
21
+ movie = File.new("./spec/fixtures/movie.iso")
22
+ movie_path = File.expand_path(movie.path)
23
+
24
+ Dir.mktmpdir do |directory|
25
+ RakeMKV::Disc.new(
26
+ destination: directory,
27
+ location: movie_path,
28
+ minlength: 2,
29
+ ).transcode!(title_id: "all")
13
30
 
14
- expect(Dir.entries(directory)).to include('title00.mkv')
31
+ expect(Dir.entries(directory)).to include("DVDVIDEO")
32
+ expect(Dir.entries("#{directory}/DVDVIDEO")).
33
+ to include("title00.mkv", "title01.mkv")
15
34
  end
16
35
  end
17
36
  end
@@ -0,0 +1,14 @@
1
+ require "spec_helper"
2
+
3
+ describe RakeMKV::Binary do
4
+ describe "#installed?" do
5
+ it "verified makemkv is installed" do
6
+ command_line = double("command_line", run: "thing")
7
+ command_line_class = double("command_line_class", new: command_line)
8
+
9
+ binary = described_class.new(command_line_class: command_line_class)
10
+
11
+ expect(binary).to be_installed
12
+ end
13
+ end
14
+ end
@@ -1,33 +1,37 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe RakeMKV::Command do
4
- describe '.installed?' do
4
+ describe "#info" do
5
+ it "gets the info for the object" do
6
+ command_line = double("terrapin", run: "info")
7
+ command_line_class = double(:command_line_class, new: command_line)
5
8
 
6
- it 'verifies makemkv is installed' do
7
- allow(Cocaine::CommandLine).to receive(:new)
8
- .with('which', 'makemkvcon')
9
- .and_return(double('command', run: '/something/great'))
10
- expect(RakeMKV::Command).to be_installed
11
- end
12
- end
9
+ command = described_class.new(
10
+ path: "disc:0",
11
+ command_line_class: command_line_class,
12
+ )
13
13
 
14
- describe '#info' do
15
- it 'gets the info for the object' do
16
- command = RakeMKV::Command.new('disc:0')
17
- allow(Cocaine::CommandLine).to receive(:new)
18
- .with('makemkvcon -r', 'info disc:0')
19
- .and_return(double('cocaine', run: 'info'))
20
- expect(command.info).to eq 'info'
14
+ expect(command.info).to eq "info"
15
+ expect(command_line_class).to have_received(:new)
16
+ .with("makemkvcon -r", "info disc:0")
21
17
  end
22
18
  end
23
19
 
24
- describe '#mkv' do
25
- it 'takes title and destination' do
26
- command = RakeMKV::Command.new('disc:0')
27
- allow(Cocaine::CommandLine).to receive(:new)
28
- .with('makemkvcon -r', 'mkv disc:0 5 /path/to/heart')
29
- .and_return(double('cocaine', run: 'mkv'))
30
- expect(command.mkv(5,'/path/to/heart')).to eq 'mkv'
20
+ describe "#mkv" do
21
+ it "takes title and destination" do
22
+ command_line = double("terrapin", run: "mkv")
23
+ command_line_class = double(:command_line_class, new: command_line)
24
+
25
+ command = described_class.new(
26
+ path: "disc:0",
27
+ command_line_class: command_line_class,
28
+ )
29
+
30
+ expect(
31
+ command.mkv(5, "/path/to/heart"),
32
+ ).to eq "mkv"
33
+ expect(command_line_class).to have_received(:new)
34
+ .with("makemkvcon -r", "mkv disc:0 5 /path/to/heart")
31
35
  end
32
36
  end
33
37
  end
@@ -1,43 +1,28 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe RakeMKV::Configuration do
4
4
  before do
5
5
  config.reset!
6
6
  end
7
7
 
8
- describe '#binary' do
9
- it 'returns default makemkvcon' do
10
- expect(config.binary).to eq 'makemkvcon'
8
+ describe "#binary" do
9
+ it "returns default makemkvcon" do
10
+ expect(config.binary).to eq "makemkvcon"
11
11
  end
12
12
 
13
- it 'set a new binary' do
14
- config.binary = 'new_binary'
15
- expect(config.binary).to eq 'new_binary'
13
+ it "set a new binary" do
14
+ config.binary = "new_binary"
15
+ expect(config.binary).to eq "new_binary"
16
16
  end
17
17
  end
18
18
 
19
- describe '#destination' do
20
- it 'defaults the to current directory' do
21
- expect(config.destination).to eq Dir.pwd
22
- end
23
-
24
- it 'sets a new destination' do
25
- config.binary = 'new_destination'
26
- expect(config.binary).to eq 'new_destination'
27
- end
28
- end
29
-
30
- describe '#reset!' do
31
- it 'resets all the things' do
32
- config.minimum_title_length = 3
33
- config.binary = 'stuff'
34
- config.destination = '/path/somewhere'
19
+ describe "#reset!" do
20
+ it "resets all the things" do
21
+ config.binary = "stuff"
35
22
 
36
23
  config.reset!
37
24
 
38
- expect(config.minimum_title_length).to be_nil
39
- expect(config.binary).to eq 'makemkvcon'
40
- expect(config.destination).to eq Dir.pwd
25
+ expect(config.binary).to eq "makemkvcon"
41
26
  end
42
27
  end
43
28
 
@@ -6,58 +6,72 @@ describe RakeMKV::Disc do
6
6
  .to receive(:info) { RakeMKVMock.info }
7
7
  end
8
8
 
9
- describe '#path' do
10
- it 'accepts the device path' do
11
- RakeMKV::Disc.new('/dev/sd0').path.should eq 'dev:/dev/sd0'
9
+ describe "#path" do
10
+ it "accepts the device path" do
11
+ expect(RakeMKV::Disc.new(location: "/dev/sd0").path).to eq "dev:/dev/sd0"
12
12
  end
13
- it 'accepts the file iso path' do
14
- RakeMKV::Disc.new('path_to.iso').path.should eq 'iso:path_to.iso'
13
+
14
+ it "accepts the file iso path" do
15
+ expect(RakeMKV::Disc.new(location: "path_to.iso").path)
16
+ .to eq "iso:path_to.iso"
15
17
  end
16
- it 'accepts disc parameter' do
17
- RakeMKV::Disc.new('disc:0').path.should eq 'disc:0'
18
+
19
+ it "accepts disc parameter" do
20
+ expect(RakeMKV::Disc.new(location: "disc:0").path).to eq "disc:0"
18
21
  end
19
- it 'accepts an integer for the path' do
20
- RakeMKV::Disc.new(0).path.should eq 'disc:0'
22
+
23
+ it "accepts an integer for the path" do
24
+ expect(RakeMKV::Disc.new(location: 0).path).to eq "disc:0"
21
25
  end
22
- it 'raises an error when not a valid path' do
23
- expect { RakeMKV::Disc.new('bork').path }.to raise_error
26
+
27
+ it "raises an error when not a valid path" do
28
+ expect { RakeMKV::Disc.new(location: "bork").path }.
29
+ to raise_error(StandardError)
24
30
  end
25
31
  end
26
32
 
27
- describe '#transcode!' do
28
- subject(:disc) { RakeMKV::Disc.new('disc:0') }
29
- let(:title) { double(RakeMKV::Title, id: 0) }
30
- before do
31
- File.stub(:directory?).and_return true
33
+ describe "#transcode!" do
34
+ it "converts only a specific title" do
35
+ Dir.mktmpdir do |path|
36
+ disc = RakeMKV::Disc.new(location: "disc:0", destination: path)
37
+ allow(File).to receive(:directory?).and_return true
38
+ expect_any_instance_of(RakeMKV::Command).
39
+ to receive(:mkv).with(1, "#{path}/DIME_NTSC", { minlength: 120 })
40
+
41
+ disc.transcode!(title_id: 1)
42
+ end
32
43
  end
44
+ end
33
45
 
34
- it 'converts only a specific title' do
35
- expect_any_instance_of(RakeMKV::Command).to receive(:mkv)
36
- .with(1, Dir.pwd)
46
+ describe "#filesafe_name" do
47
+ it "grabs the name of the disc" do
48
+ disc = RakeMKV::Disc.new(location: "disc:0")
37
49
 
38
- disc.transcode!(title_id: 1)
50
+ expect(disc.filesafe_name).to eq "dime_ntsc"
39
51
  end
40
- end
41
52
 
42
- describe '#name' do
43
- subject(:disc) { RakeMKV::Disc.new('disc:0') }
44
- it 'grabs the name of the disc' do
45
- expect(disc.name).to eq 'DIME_NTSC'
53
+ it "fixes the name with bad characters" do
54
+ parsed = double("parsed", cinfo: { name: "Foo/Bar bAz" })
55
+ parser_class = double("parser_class", new: parsed)
56
+
57
+ disc = RakeMKV::Disc.new(location: "disc:0", parser_class: parser_class)
58
+
59
+ expect(disc.filesafe_name).to eq "foo_bar_baz"
46
60
  end
47
61
  end
48
62
 
49
63
  describe '#titles' do
50
64
  it 'builds a places to hold titles' do
51
- disc = RakeMKV::Disc.new('disc:0')
65
+ disc = RakeMKV::Disc.new(location: "disc:0")
52
66
 
53
67
  expect(disc.titles).to be_a_kind_of(RakeMKV::Titles)
54
68
  end
55
69
 
56
- it 'returns a list of titles' do
57
- disc = RakeMKV::Disc.new('disc:0')
58
- RakeMKV::Title.stub(:new).and_return('new_title')
70
+ it "returns a list of titles" do
71
+ disc = RakeMKV::Disc.new(location: "disc:0")
72
+ allow(RakeMKV::Title).to receive(:new).and_return("new_title")
59
73
 
60
- expect(disc.titles).to include 'new_title'
74
+ expect(disc.titles).to include "new_title"
61
75
  end
62
76
  end
63
77
  end
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,6 @@ require "support/rakemkvmock"
4
4
  require "tmpdir"
5
5
 
6
6
  RSpec.configure do |config|
7
- config.treat_symbols_as_metadata_keys_with_true_values = true
8
7
  config.run_all_when_everything_filtered = true
9
8
  config.filter_run :focus
10
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakemkv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Collins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-08 00:00:00.000000000 Z
11
+ date: 2018-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '2.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: cocaine
28
+ name: terrapin
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
33
+ version: '0.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.5'
40
+ version: '0.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -88,17 +88,18 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
+ - ".circleci/config.yml"
91
92
  - ".gitignore"
92
- - ".travis.yml"
93
+ - CHANGELOG.md
93
94
  - Gemfile
94
- - Guardfile
95
95
  - LICENSE.txt
96
96
  - README.md
97
97
  - Rakefile
98
+ - bin/create_disc
98
99
  - lib/rakemkv.rb
100
+ - lib/rakemkv/binary.rb
99
101
  - lib/rakemkv/code.rb
100
102
  - lib/rakemkv/command.rb
101
- - lib/rakemkv/command_builder.rb
102
103
  - lib/rakemkv/configuration.rb
103
104
  - lib/rakemkv/disc.rb
104
105
  - lib/rakemkv/parser.rb
@@ -108,8 +109,8 @@ files:
108
109
  - rakemkv.gemspec
109
110
  - spec/fixtures/movie.iso
110
111
  - spec/integration/transcodes_disc_spec.rb
112
+ - spec/lib/rakemkv/binary_spec.rb
111
113
  - spec/lib/rakemkv/code_spec.rb
112
- - spec/lib/rakemkv/command_builder_spec.rb
113
114
  - spec/lib/rakemkv/command_spec.rb
114
115
  - spec/lib/rakemkv/configuration_spec.rb
115
116
  - spec/lib/rakemkv/disc_spec.rb
@@ -139,15 +140,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  version: '0'
140
141
  requirements: []
141
142
  rubyforge_project:
142
- rubygems_version: 2.2.1
143
+ rubygems_version: 2.7.6
143
144
  signing_key:
144
145
  specification_version: 4
145
146
  summary: Object oriented wrapper around MakeMKV
146
147
  test_files:
147
148
  - spec/fixtures/movie.iso
148
149
  - spec/integration/transcodes_disc_spec.rb
150
+ - spec/lib/rakemkv/binary_spec.rb
149
151
  - spec/lib/rakemkv/code_spec.rb
150
- - spec/lib/rakemkv/command_builder_spec.rb
151
152
  - spec/lib/rakemkv/command_spec.rb
152
153
  - spec/lib/rakemkv/configuration_spec.rb
153
154
  - spec/lib/rakemkv/disc_spec.rb
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 1.9.3
5
- - 1.9.2
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard :rspec do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
@@ -1,19 +0,0 @@
1
- class RakeMKV::CommandBuilder
2
- def initialize(command)
3
- @command = command
4
- end
5
-
6
- def build
7
- [command, minimum_length].join(' ').strip
8
- end
9
-
10
- private
11
-
12
- attr_reader :command
13
-
14
- def minimum_length
15
- if RakeMKV.config.minimum_title_length
16
- "--minlength=#{RakeMKV.config.minimum_title_length}"
17
- end
18
- end
19
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RakeMKV::CommandBuilder do
4
- describe '#build' do
5
- it 'adds minimum length from configuration' do
6
- RakeMKV.configure do |config|
7
- config.minimum_title_length = 5
8
- end
9
-
10
- full_command = RakeMKV::CommandBuilder.new("command").build
11
-
12
- expect(full_command).to eq "command --minlength=5"
13
- end
14
- end
15
- end