movie_organizer 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f54c3650fd6f47604caa55e65e6849c3e205dbf56682c1a4e152992bde76ddd
4
- data.tar.gz: 62dac5e6ffc9548d7f7560a3246bdd304d122c0bafd9a98e4f6a2d34b39ac769
3
+ metadata.gz: a28b7b48ec7f557670cc640b987534dba854888ecb6fa82652edb99af1999e61
4
+ data.tar.gz: 6274d25406a319fb04e31c599b17941d5d9b860fa55752f38db5296e375f7913
5
5
  SHA512:
6
- metadata.gz: e3663b3c36305f0c5f8906c9273be61764dec2d1e57e5bc9d9b5e81fbf9427522c84b5f244a3b2282c0f045e283ac92d9856a8d75d97442498ca86e73646583c
7
- data.tar.gz: 000717141ad377bf135acad6ba2b88a1abb14e9c6cc21c07d2d91cf9130182cb05beba1bcc9d6f1bc4607a8185d468d0062ea79eb30cef3127cfc2dd05276af5
6
+ metadata.gz: aa2d1fff8f2f40c78d3c661261cae8aa292b0f703ca46c75fafd302be6d81f7a1374eebb8a58b4c54162c64b2734168c9f889d7628ed05d9edca96bfd8dd100c
7
+ data.tar.gz: 55b058b03139ae43e85e1c81b99ecaafaa546a54a0a880d92cce972457510af6e8fcd2b95bca8e860cf4b0dfb3c2a50b3642fa6c73eb2e0f77a8094bb1c8726f
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ mkmf.log
17
17
  /vendor
18
18
  /spec/.DS_Store
19
19
  /.DS_Store
20
+ .DS_Store
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ *0.1.10* (March 14, 2018)
2
+
3
+ * Strip 'WebRip' from filenames
4
+ * Add specs
5
+
1
6
  *0.1.9* (March 09, 2018)
2
7
 
3
8
  * Handle timeouts for remote SSH hosts
@@ -82,6 +82,7 @@ module MovieOrganizer
82
82
  cleanstr = cleanstr.gsub(/BrRip/i, '').strip
83
83
  cleanstr = cleanstr.gsub(/ECI/i, '').strip
84
84
  cleanstr = cleanstr.gsub(/HDTV/i, '').strip
85
+ cleanstr = cleanstr.gsub(/WEBRip/i, '').strip
85
86
  cleanstr = cleanstr.gsub(/x264/, '').strip
86
87
  cleanstr = cleanstr.gsub(/-lol/i, '').strip
87
88
  # cleanstr = cleanstr.gsub(/[\.\s-]us[\.\s-]/i, ' ').strip
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MovieOrganizer
4
- VERSION = '0.1.9'.freeze
4
+ VERSION = '0.1.10'.freeze
5
5
  end
@@ -27,7 +27,8 @@ module MovieOrganizer
27
27
  movies = [
28
28
  'Coco.2017.1080p.BluRay.x264-[BOGUS.IT]',
29
29
  'Beetlejuice',
30
- 'Justice.League.2017.1080p.BluRay.x264-[YTS.AM]'
30
+ 'Justice.League.2017.1080p.BluRay.x264-[YTS.AM]',
31
+ 'Jumanji.Welcome.To.The.Jungle.2017.1080p.WEBRip.x264-[YTS.AM].mp4'
31
32
  ]
32
33
 
33
34
  movies.each do |filename|
@@ -5,48 +5,76 @@ module MovieOrganizer
5
5
  RSpec.describe Movie, type: :lib do
6
6
  include_context 'media_shared'
7
7
 
8
- let(:filename) do
9
- create_test_file(
10
- filename: 'Foreign+Correspondent+(1940)+1080p', extension: 'mp4'
11
- ).first
12
- end
13
- let(:movie) { Movie.new(filename, default_options) }
8
+ movies = {
9
+ 'Coco.2017.1080p.BluRay.x264-[BOGUS.IT]' => {
10
+ year: '2017',
11
+ name: 'Coco (2017).mp4'
12
+ },
13
+ 'Beetlejuice' => {
14
+ year: nil,
15
+ name: 'Beetlejuice ().mp4'
16
+ },
17
+ 'Justice.League.2017.1080p.BluRay.x264-[YTS.AM]' => {
18
+ year: '2017',
19
+ name: 'Justice League (2017).mp4'
20
+ },
21
+ 'Jumanji.Welcome.To.The.Jungle.2017.1080p.WEBRip.x264-[YTS.AM]' => {
22
+ year: '2017',
23
+ name: 'Jumanji Welcome To The Jungle (2017).mp4'
24
+ }
25
+ }
14
26
 
15
- context '#new' do
16
- it 'returns a child of the Media class' do
17
- expect(movie).to be_a(Media)
18
- end
27
+ movies.each_pair do |filename, data|
28
+ context filename do
29
+ before(:each) do
30
+ @filepath = create_test_file(filename: filename, extension: 'mp4').first
31
+ @expected_filename = data[:name]
32
+ @expected_year = data[:year]
33
+ @movie = Movie.new(@filepath, default_options)
34
+ end
19
35
 
20
- it 'is a Movie' do
21
- expect(movie).to be_a(Movie)
22
- end
36
+ context '.processed_filename' do
37
+ it "correctly processes the filename: [#{filename}]" do
38
+ expect(
39
+ @movie.processed_filename
40
+ ).to eq(@expected_filename)
41
+ end
42
+ end
23
43
 
24
- it 'sets filename accessor' do
25
- expect(movie.filename).to eq(filename)
44
+ context '.year' do
45
+ it 'returns the correct year' do
46
+ expect(@movie.year).to eq(@expected_year)
47
+ end
48
+ end
26
49
  end
27
50
  end
28
51
 
29
- context '.processed_filename' do
30
- it 'correctly processes the filename' do
31
- expect(
32
- movie.processed_filename
33
- ).to eq('Foreign Correspondent (1940).mp4')
52
+ context 'single movie' do
53
+ let(:filename) do
54
+ create_test_file(
55
+ filename: 'Foreign+Correspondent+(1940)+1080p', extension: 'mp4'
56
+ ).first
34
57
  end
35
- end
58
+ let(:movie) { Movie.new(filename, default_options) }
59
+
60
+ context '#new' do
61
+ it 'is a Movie' do
62
+ expect(movie).to be_a(Movie)
63
+ end
36
64
 
37
- context '.year' do
38
- it 'returns the year' do
39
- expect(movie.year).to eq('1940')
65
+ it 'sets filename accessor' do
66
+ expect(movie.filename).to eq(filename)
67
+ end
40
68
  end
41
- end
42
69
 
43
- context '.process!' do
44
- it 'moves the file to the configured location' do
45
- settings = Settings.new
46
- settings[:movies][:directory] = MovieOrganizer.root.join('tmp', 'files', 'movies').to_s
47
- settings.save
48
- movie.process!
49
- expect(File.exist?(filename)).to eq(true)
70
+ context '.process!' do
71
+ it 'moves the file to the configured location' do
72
+ settings = Settings.new
73
+ settings[:movies][:directory] = MovieOrganizer.root.join('tmp', 'files', 'movies').to_s
74
+ settings.save
75
+ movie.process!
76
+ expect(File.exist?(filename)).to eq(true)
77
+ end
50
78
  end
51
79
  end
52
80
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movie_organizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Blackburn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-09 00:00:00.000000000 Z
11
+ date: 2018-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler