reorganise 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,135 @@
1
+ Reorganise
2
+ =============
3
+
4
+ Reorganise is a Ruby Gem that simplifies the tedious task of renaming and organising your TV series.
5
+
6
+ ###Installation
7
+ 1. Ensure Ruby is installed. The latest Windows version is available at [RubyInstaller.org](http://rubyinstaller.org/downloads/).
8
+ 2. Ruby now comes standard with Rubygems, so simply run:
9
+ gem install reorganise
10
+ 3. That's it!
11
+
12
+ ###How to use Reorganise
13
+ Reorganise is run from the command line. One you have installed the gem, open up your command prompt (Start -> Run -> cmd) in Windows or Terminal in Linux. Typing:
14
+
15
+ reorganise -h
16
+
17
+ will present you with the following options:
18
+ Usage: reorganise [options]
19
+
20
+ Command options:
21
+ -i, --input-dir DIRECTORY Specifies where to look for episodes to rename.
22
+ -o, --output-dir DIRECTORY Specifies where to move renamed files to. Default is the input directory.
23
+ -n, --name NAME What to rename the series to. Title is derived from series if not given.
24
+ -c, --confirm Confirms the go ahead to rename files. Only pretends to rename files to show the effects if not given.
25
+ -r, --regexp MATCHER Alternative regexp matcher.
26
+ -v, --verbose Verbose output. Automatically selected for pretend runs.
27
+ -h, --help Display this to screen.
28
+
29
+ ###Examples
30
+
31
+ #### NOTE: To confirm and actually proceed with the renaming in these and any other examples, supply the `-c` or `--confirm` option.
32
+
33
+ The following example is a simple renaming of a series. We do not want to move the files to another directory, so no -o argument is supplied. Note, no confirm option (-c) was supplied, so this example would only show what WOULD happen if it was supplied. This is useful as it allows the user to note if something were to go amiss.
34
+
35
+ C:\>reorganise -i "E:\Media\Series\Breaking Bad"
36
+
37
+ Results in
38
+
39
+ ------------------------------------------------------------------------
40
+ Finding all files with the following extensions: avi, mp4, mkv
41
+
42
+ Directory: E:/Media/Series/Breaking Bad
43
+ Found 11 files.
44
+ ------------------------------------------------------------------------
45
+
46
+ !!! NOTICE: This is a PRETEND renaming to show what would happen. !!!
47
+ To confirm the renaming of files, run the command again with -c. e.g. `reorganis
48
+ e -c -i [input-dir]
49
+
50
+ Starting to rename files using regex (?i-mx:S(\d+)x?E(\d+)|(\d{1,2})(\d{2,})|(\d+)x(\d+))...
51
+
52
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x01] - Pilot.mkv
53
+ +: E:/Media/Series/Breaking Bad/Season 1/Breaking Bad - S01E01.mkv
54
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x02] - Cat's in the Bag....mkv
55
+ +: E:/Media/Series/Breaking Bad/Season 1/Breaking Bad - S01E02.mkv
56
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x03] - ...And the Bag's in the River.mkv
57
+ +: E:/Media/Series/Breaking Bad/Season 1/Breaking Bad - S01E03.mkv
58
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x04] - Cancer Man.mkv
59
+ +: E:/Media/Series/Breaking Bad/Season 1/Breaking Bad - S01E04.mkv
60
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x05] - Gray Matter.mkv
61
+ +: E:/Media/Series/Breaking Bad/Season 1/Breaking Bad - S01E05.mkv
62
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x06] - Crazy Handful of Nothin'.mkv
63
+ +: E:/Media/Series/Breaking Bad/Season 1/Breaking Bad - S01E06.mkv
64
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x07] - ANo-Rough-Stuff Type Deal.mkv
65
+ +: E:/Media/Series/Breaking Bad/Season 1/Breaking Bad - S01E07.mkv
66
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 2/Breaking Bad - [2x01] - Seven Thirty-Seven.mkv
67
+ +: E:/Media/Series/Breaking Bad/Season 2/Breaking Bad - S02E01.mkv
68
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 2/Breaking Bad - [2x02] - Grilled.mkv
69
+ +: E:/Media/Series/Breaking Bad/Season 2/Breaking Bad - S02E02.mkv
70
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 2/Breaking Bad - [2x03] - Bit by a Dead Bee.mkv
71
+ +: E:/Media/Series/Breaking Bad/Season 2/Breaking Bad - S02E03.mkv
72
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 2/Breaking Bad - [2x04] - Down.mkv
73
+ +: E:/Media/Series/Breaking Bad/Season 2/Breaking Bad - S02E04.mkv
74
+
75
+ Finished renaming 11 files.
76
+
77
+ !!! NOTICE: This was a pretend run, nothing was renamed. !!!
78
+ To confirm the renaming, run this command again with -c
79
+
80
+
81
+ Supplying the name argument (-n [series name]) does a custom rename. This is useful for those who are fussy about their naming methods with shows like QI and CSI which, without the name option, would result in Qi and Csi respectively. **Please note, this log file has been shortened for the sake of reducing excessive scrolling. No files were skipped because of the additional option.**
82
+
83
+ C:\>reorganise -i "E:\Media\Series\Breaking Bad" -n "BB"
84
+
85
+ Results in
86
+
87
+ ------------------------------------------------------------------------
88
+ Finding all files with the following extensions: avi, mp4, mkv
89
+
90
+ Directory: E:/Media/Series/Breaking Bad
91
+ Found 11 files.
92
+ ------------------------------------------------------------------------
93
+
94
+ !!! NOTICE: This is a PRETEND renaming to show what would happen. !!!
95
+ To confirm the renaming of files, run the command again with -c. e.g. `reorganis
96
+ e -c -i [input-dir]
97
+
98
+ Starting to rename files using regex (?i-mx:S(\d+)x?E(\d+)|(\d{1,2})(\d{2,})|(\d+)x(\d+))...
99
+
100
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x01] - Pilot.mkv
101
+ +: E:/Media/Series/Breaking Bad/Season 1/BB - S01E01.mkv
102
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x02] - Cat's in the Bag....mkv
103
+ +: E:/Media/Series/Breaking Bad/Season 1/BB - S01E02.mkv
104
+ ...
105
+ ...
106
+
107
+ #### Outputting to another directory
108
+
109
+ C:\>reorganise -i "E:\Media\Series\Breaking Bad" -o C:\
110
+
111
+ Results in
112
+
113
+ ------------------------------------------------------------------------
114
+ Finding all files with the following extensions: avi, mp4, mkv
115
+
116
+ Directory: E:/Media/Series/Breaking Bad
117
+ Found 11 files.
118
+ ------------------------------------------------------------------------
119
+
120
+ !!! NOTICE: This is a PRETEND renaming to show what would happen. !!!
121
+ To confirm the renaming of files, run the command again with -c. e.g. `reorganis
122
+ e -c -i [input-dir]
123
+
124
+ Starting to rename files using regex (?i-mx:S(\d+)x?E(\d+)|(\d{1,2})(\d{2,})|(\d+)x(\d+))...
125
+
126
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x01] - Pilot.mkv
127
+ +: C:/Breaking Bad/Season 1/Breaking Bad - S01E01.mkv
128
+ -: E:/Media/Series/Breaking Bad/Breaking Bad Season 1/Breaking Bad - [1x02] - Cat's in the Bag....mkv
129
+ +: C:/Breaking Bad/Season 1/Breaking Bad - S01E02.mkv
130
+ ...
131
+ ...
132
+
133
+
134
+ ## Credits
135
+ Author: Justin Cossutti
data/bin/reorganise CHANGED
@@ -22,7 +22,7 @@ module Reorganise
22
22
 
23
23
  def parse_options!(argv)
24
24
  optparse = OptionParser.new(argv) do |opts|
25
- opts.banner = "Usage: rename.rb [options]\n\nCommand options:"
25
+ opts.banner = "Usage: reorganise [options]\n\nCommand options:"
26
26
 
27
27
  @options[:regex] = @matcher
28
28
 
@@ -104,8 +104,8 @@ module Reorganise
104
104
 
105
105
  unless @output_dir
106
106
  # Check to see if the files were already organised into season folders
107
- if old_directory.split("/").last =~ /^(?:season (\d+)|s(\d+))$/i and details[:season].to_i == ($1 || $2).to_i
108
- target_directory = old_directory
107
+ if old_directory.split("/").last =~ /(?:season (\d+)|^s(\d+)$)/i and details[:season].to_i == ($1 || $2).to_i
108
+ target_directory = File.join(old_directory.split("/")[0..-2].join("/"), "Season #{details[:season].to_i}")
109
109
  else
110
110
  target_directory = File.join(old_directory, "Season #{details[:season].to_i}")
111
111
  end
@@ -1,3 +1,3 @@
1
1
  module Reorganise
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reorganise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-09 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: to_regexp
16
- requirement: &70441060 !ruby/object:Gem::Requirement
16
+ requirement: &86167830 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70441060
24
+ version_requirements: *86167830
25
25
  description: Sorts and renames your series.
26
26
  email:
27
27
  - justin.cossutti@gmail.com
@@ -32,6 +32,7 @@ extra_rdoc_files: []
32
32
  files:
33
33
  - .gitignore
34
34
  - Gemfile
35
+ - README.markdown
35
36
  - Rakefile
36
37
  - bin/reorganise
37
38
  - lib/reorganise.rb