apple-tv-converter 0.5.6 → 0.5.7

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/CHANGELOG CHANGED
@@ -1,6 +1,15 @@
1
+ v0.5.7
2
+ ------
3
+ * Added "--season" option (thanks @shir)
4
+ * Added "--episode" option
5
+ * Added "--imdb_id" option
6
+ * Added "--tvdb_id" option
7
+ * Updated "--id" option to set both IMDB and TheTVDB ids
8
+ * Fixed #1 Couldn't parse filename
9
+
1
10
  v0.5.6
2
11
  ------
3
- * Fixed "[libfaac @ 0x7ff7bc0e6e00] Specified channel layout '2.1' is not supported" error
12
+ * Fixed "libfaac: Specified channel layout '2.1' is not supported" error
4
13
 
5
14
  v0.5.5
6
15
  ------
data/README.md CHANGED
@@ -14,6 +14,8 @@ Now, it also supports automatically downloading subtitles from [opensubtitles.or
14
14
  Usage: apple-tv-converter [options] [file]
15
15
  [file] must be provided unless the -d (--dir) switch is present.
16
16
  -i, --id id Set a specific id for fetching metadata from online services
17
+ --imdb_id id Set a specific id for fetching metadata from IMDB
18
+ --tvdb_id id Set a specific id for fetching metadata from TheTVDB
17
19
  -l, --languages eng,por,... Only keep audio and subtitles in the specified languages
18
20
  -d, --dir DIRECTORY Process all files in DIRECTORY recursively
19
21
  --itunes Add processed file to iTunes library, if it isn't present yet
@@ -31,6 +33,8 @@ Advanced options:
31
33
  --use-absolute-numbering Use absolute numbering for TV Show episodes (specially useful for cartoons)
32
34
  --episode-number-padding NUMBER
33
35
  Set the episode number padding length (ie, 3 for 001, 002, etc.)
36
+ -s, --season NUMBER Set the season number for TV Shows in case folder/file naming scheme doesn't contain right season
37
+ -e, --episode NUMBER Set the episode number for TV Shows in case folder/file naming scheme doesn't contain right episode number
34
38
 
35
39
  Other options:
36
40
  -f, --ffmpeg LOCATION Set path to ffmpeg binary
@@ -77,7 +81,7 @@ For Plex Media Server users, you can pass the command-line option `--plex` to au
77
81
 
78
82
  ### Other remarks
79
83
 
80
- After conversion, `apple-tv-converter` will create a file named `.apple-tv-converter.data` on the base directory of the file containing some information (IMDB id, TheTVDB id, etc.) that can be useful for subsequent processing).
84
+ After conversion, `apple-tv-converter` will create a file named `.apple-tv-converter.data` on the base directory of the file containing some information (IMDB id, TheTVDB id, etc.) that can be useful for subsequent processing.
81
85
 
82
86
  ## Thanks
83
87
 
@@ -31,6 +31,8 @@ module AppleTvConverter
31
31
  require 'optparse/time'
32
32
  require 'ostruct'
33
33
 
34
+ id_switch = 0
35
+
34
36
  options = OpenStruct.new
35
37
  options.skip_transcoding = false
36
38
  options.skip_subtitles = false
@@ -41,17 +43,38 @@ module AppleTvConverter
41
43
  options.plex_format = false
42
44
  options.interactive = true
43
45
  options.imdb_id = nil
46
+ options.tvdb_id = nil
44
47
  options.use_absolute_numbering = false
45
48
  options.episode_number_padding = nil
46
49
  options.languages = []
47
50
  options.media = []
51
+ options.season = nil
52
+ options.episode = nil
48
53
 
49
54
  opts = OptionParser.new do |opts|
50
55
  opts.banner = "Usage: apple-tv-converter [options] [file]\n" +
51
56
  " [file] must be provided unless the -d (--dir) switch is present.\n"
52
57
 
53
58
  opts.on('-i', '--id id', "Set a specific id for fetching metadata from online services") do |id|
59
+ raise ArgumentError.new("Can't supply both --id and --imdb_id or --tvdb_id at the same time!") if id_switch > 0
60
+
61
+ id_switch = 3
54
62
  options.imdb_id = id
63
+ options.tvdb_id = id
64
+ end
65
+
66
+ opts.on('--imdb_id id', "Set a specific id for fetching metadata from IMDB") do |id|
67
+ raise ArgumentError.new("Can't supply both --id and --imdb_id or --tvdb_id at the same time!") if id_switch & 1 > 0
68
+
69
+ id_switch |= 1
70
+ options.imdb_id = id
71
+ end
72
+
73
+ opts.on('--tvdb_id id', "Set a specific id for fetching metadata from TheTVDB") do |id|
74
+ raise ArgumentError.new("Can't supply both --id and --imdb_id or --tvdb_id at the same time!") if id_switch & 2 > 0
75
+
76
+ id_switch |= 2
77
+ options.tvdb_id = id
55
78
  end
56
79
 
57
80
  opts.on('-l', '--languages eng,por,...', Array, "Only keep audio and subtitles in the specified languages") do |languages|
@@ -124,6 +147,14 @@ module AppleTvConverter
124
147
  options.episode_number_padding = i.to_i
125
148
  end
126
149
 
150
+ opts.on('-s', '--season NUMBER', 'Set the season number for TV Shows in case folder/file naming scheme doesn\'t contain right season') do |i|
151
+ options.season = i.to_i
152
+ end
153
+
154
+ opts.on('-e', '--episode NUMBER', 'Set the episode number for TV Shows in case folder/file naming scheme doesn\'t contain right episode number') do |i|
155
+ options.episode = i.to_i
156
+ end
157
+
127
158
  opts.separator ""
128
159
  opts.separator "Other options:"
129
160
 
@@ -175,7 +206,7 @@ module AppleTvConverter
175
206
  e = AppleTvConverter::Media.new
176
207
 
177
208
  # Extract name (check if the folder name is Season XX, and use the parent folder name if it is)
178
- test_path = File.basename(File.dirname(file)) =~ /^season\s*\d+/i ? File.dirname(File.dirname(file)) : File.dirname(file)
209
+ test_path = File.expand_path(File.basename(File.dirname(file)) =~ /^season\s*\d+/i ? File.dirname(File.dirname(file)) : File.dirname(file))
179
210
 
180
211
  match = test_path.match(/.*\/(.*?)(?:S(\d+))?$/i)
181
212
 
@@ -204,8 +235,10 @@ module AppleTvConverter
204
235
 
205
236
  return e
206
237
  rescue => exc
238
+ puts "File.expand_path(file): #{File.expand_path(file)}"
207
239
  puts "Couldn't parse filename, skipping: #{File.basename(file)}"
208
- puts exc.respond_to? :message ? exc.message : exc
240
+ puts "Reason: #{exc.respond_to?(:message) ? exc.message : exc}"
241
+ puts "In: #{exc.backtrace.join("\n ")}"
209
242
 
210
243
  return nil
211
244
  end
@@ -24,12 +24,20 @@ module AppleTvConverter
24
24
  puts "* Name: #{media.show}"
25
25
  puts "* Genre: #{media.genre}"
26
26
  end
27
+
27
28
  if !@options.skip_online_metadata
28
29
  if media.imdb_id
29
30
  puts "* IMDB ID: #{media.imdb_id}"
30
31
  elsif !@options.skip_metadata
31
32
  puts "* IMDB ID: Unknown yet"
32
33
  end
34
+ if media.is_tv_show_episode?
35
+ if media.tvdb_id
36
+ puts "* TheTVDB ID: #{media.tvdb_id}"
37
+ elsif !@options.skip_metadata
38
+ puts "* TheTVDB ID: Unknown yet"
39
+ end
40
+ end
33
41
  end
34
42
 
35
43
  puts "* #{media.audio_streams.length} audio track(s)"
@@ -72,6 +80,7 @@ module AppleTvConverter
72
80
 
73
81
  unless @options.skip_metadata || @options.skip_online_metadata
74
82
  media.imdb_id ||= @options.imdb_id
83
+ media.tvdb_id ||= @options.tvdb_id
75
84
  @adapter.get_metadata(media)
76
85
  end
77
86
 
@@ -89,7 +98,10 @@ module AppleTvConverter
89
98
  def apply_options_to_media!(media)
90
99
  # Load IMDB id from options
91
100
  media.imdb_id ||= @options.imdb_id
101
+ media.tvdb_id ||= @options.tvdb_id
92
102
 
103
+ media.season = @options.season if @options.season
104
+ media.number = @options.episode if @options.episode
93
105
  media.use_absolute_episode_numbering = @options.use_absolute_numbering
94
106
  media.episode_number_padding = @options.episode_number_padding if @options.episode_number_padding
95
107
  end
@@ -1,3 +1,3 @@
1
1
  module AppleTvConverter
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple-tv-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-26 00:00:00.000000000 Z
12
+ date: 2014-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec