propre 0.0.8 → 0.1.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
2
  SHA1:
3
- metadata.gz: 5c5c7606d91fe4f008d8affa8dc9d04c4d5395f0
4
- data.tar.gz: 6455448d1277e3309711baead0bd70620570ee73
3
+ metadata.gz: 32f0c4169afcfc915cc3b04c3401afdbd9690105
4
+ data.tar.gz: db6ecfc029dcc06d7a7b6c4087d8c68eabaa31c3
5
5
  SHA512:
6
- metadata.gz: cf2929a9a581eb0522d5037aa686269bc15b572c3ed2913ce75efc2fb86c64293d791ae8676553f68ee7dfb3a30be2653c9447443f460e35839a9974d7e523d2
7
- data.tar.gz: 506f6eff152694a7422390be1c1d3ca7cea5ce0676bd16232beeac0be4a95fa2702186e566847940b1a8cca2185e09de9cbf2a9f63819655a2eeeeb932f62027
6
+ metadata.gz: eb04ca6a71b743ddd68e56c2917a440f375884f0b9c097d4e1c8fa4cfdfe81ff7594e65fad3f46217795a3d72a7e6b08c8d3128bbb9e6155249b9d4aa70bc503
7
+ data.tar.gz: c6acdecc5c94cbd0e862a88d2c66009de7bfad7a087153cbc4849f549e5c3c3f33dab4c54f24fae149c3a9d32937284b498d24d1e45aa47611b934cd8aa337bb
data/README.md CHANGED
@@ -3,25 +3,39 @@
3
3
  Propre
4
4
  ======
5
5
 
6
+ ![Propre](http://cl.ly/image/3b3M2Q2s2r2r/Image%202014-12-31%20at%204.10.46%20PM.png)
7
+
6
8
  ##Introduction
7
9
 
8
- **Propre** is a handy tool written in Ruby to bulk rename your movies using TheMovieDB API.
10
+ **Propre** is a handy tool written in Ruby to bulk rename your movies using [TheMovieDB](https://www.themoviedb.org/) API.
11
+
12
+ Propre will extract the title of a movie from it's filename and then rename it based on search result from TMDB.
9
13
 
10
14
  ##Installation
11
15
 
12
16
  gem install propre
13
17
 
18
+ To use Propre, you need an API Key from TheMovieDB. Get your API key [here](https://www.themoviedb.org/account).
19
+
14
20
  ##Usage
15
21
 
16
22
  Usage: propre [OPTION]... SOURCE...
17
- -R, --recursive Run recursively
18
23
  -i, --interactive Run interactively
24
+ -R, --recursive Run recursively
19
25
  -V, --video-only Search for video files only
20
26
  -s, --sanitize Sanitize filename before search
21
27
  -d, --dotfile Don't ignore .dotfile
28
+ -v, --version Show version information about this program and quit.
29
+ -h, --help, --usage Show this help message and quit.
22
30
 
23
31
  ##Changelog
24
32
 
33
+ ### 0.1.0
34
+
35
+ - The first result is now the best match in the list (using similar_text)
36
+ - Results are now ordered by release date
37
+ - Extensions are now in lowercase when renaming (.AVI,.Avi -> .avi)
38
+
25
39
  ### 0.0.8
26
40
 
27
41
  - Add version and usage params
@@ -29,11 +43,7 @@ Propre
29
43
  - Fix: Wording
30
44
  - Better errors handling
31
45
 
32
- ### 0.0.7
33
-
34
- - Fix: Sanitize params now work
35
-
36
46
  Disclaimer
37
47
  ----------
38
48
 
39
- This tool was made on my spare time, i'm not responsable of any damages caused to your files
49
+ This tool was made on my spare time, i'm not responsable of any damages caused to your files
@@ -1,3 +1,3 @@
1
1
  module Version
2
- VERSION = "0.0.8"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/propre.rb CHANGED
@@ -5,6 +5,7 @@ require 'propre/version'
5
5
  require 'fileutils'
6
6
  require 'themoviedb'
7
7
  require 'mime/types'
8
+ require 'similar_text'
8
9
 
9
10
  class Propre
10
11
  include Prompt
@@ -50,6 +51,10 @@ class Propre
50
51
  abort("Error: Did you set you're API Key ? (401)")
51
52
  end
52
53
  end
54
+ @movies = @movies.sort { |a,b| b.release_date <=> a.release_date }
55
+ movie = @movies.max_by {|v| filename.similar(v.title)}
56
+ @movies.delete(@movies.index(movie))
57
+ @movies.unshift(movie)
53
58
  if self.confirm
54
59
  File.rename(file, File.join(File.dirname(file), self.format(@selected)))
55
60
  end
@@ -70,7 +75,7 @@ class Propre
70
75
  year = !movie.release_date.empty? ? Date.strptime(movie.release_date, "%Y-%m-%d").year : false
71
76
  title = year ? "#{movie.title} (#{year})" : "#{movie.title}"
72
77
  title.gsub! ':','-'
73
- return "#{title}#{File.extname(@file)}"
78
+ return "#{title}#{File.extname(@file).downcase}"
74
79
  end
75
80
 
76
81
  def sanitize(filename)
data/propre.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.add_dependency "themoviedb", "~> 0.0.24"
20
20
  spec.add_dependency "mime-types", "~> 2.4.3"
21
21
  spec.add_dependency "highline", "~> 1.6.21"
22
+ spec.add_dependency "similar_text", "~> 0.0.4"
22
23
 
23
24
  spec.add_development_dependency "bundler", "~> 1.7"
24
25
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,97 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propre
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Yadomi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-31 00:00:00.000000000 Z
11
+ date: 2015-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parseconfig
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.6
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
26
  version: 1.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: themoviedb
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.0.24
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
40
  version: 0.0.24
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mime-types
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.4.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.4.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: highline
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.6.21
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.6.21
69
+ - !ruby/object:Gem::Dependency
70
+ name: similar_text
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.4
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.4
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ~>
74
88
  - !ruby/object:Gem::Version
75
89
  version: '1.7'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ~>
81
95
  - !ruby/object:Gem::Version
82
96
  version: '1.7'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ~>
88
102
  - !ruby/object:Gem::Version
89
103
  version: '10.0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ~>
95
109
  - !ruby/object:Gem::Version
96
110
  version: '10.0'
97
111
  description:
@@ -102,7 +116,7 @@ executables:
102
116
  extensions: []
103
117
  extra_rdoc_files: []
104
118
  files:
105
- - ".gitignore"
119
+ - .gitignore
106
120
  - Gemfile
107
121
  - README.md
108
122
  - Rakefile
@@ -121,17 +135,17 @@ require_paths:
121
135
  - lib
122
136
  required_ruby_version: !ruby/object:Gem::Requirement
123
137
  requirements:
124
- - - ">="
138
+ - - '>='
125
139
  - !ruby/object:Gem::Version
126
140
  version: '0'
127
141
  required_rubygems_version: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ">="
143
+ - - '>='
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  requirements: []
133
147
  rubyforge_project:
134
- rubygems_version: 2.2.2
148
+ rubygems_version: 2.4.5
135
149
  signing_key:
136
150
  specification_version: 4
137
151
  summary: CLI tool to rename movies using TheMovieDB API