itunes_video 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/itunes_video.rb +23 -2
  2. metadata +19 -28
data/lib/itunes_video.rb CHANGED
@@ -6,7 +6,7 @@ class Itunes_video
6
6
  require 'pathname'
7
7
  require 'fileutils'
8
8
 
9
- attr_accessor :id, :kind, :category, :name, :genre, :year, :description, :long_description, :comment, :unplayed, :played_count, :rating, :season_num, :episode_num, :show_name
9
+ attr_accessor :id, :kind, :category, :name, :genre, :year, :description, :long_description, :comment, :unplayed, :played_count, :rating, :artwork, :season_num, :episode_num, :show_name
10
10
 
11
11
  ##
12
12
  # The initialize method imports the video into iTunes and returns an iTunes
@@ -35,7 +35,7 @@ class Itunes_video
35
35
  def kind=(kind)
36
36
  kinds = ["tv show", "movie", "music video", "none"]
37
37
  if !kinds.include?(kind)
38
- raise "video kind must be one of: #{kinds}"
38
+ raise "video kind must be one of: #{kinds.join(', ')}"
39
39
  else
40
40
  if `osascript -e 'tell application \"iTunes\" to set video kind of file track id #{@id} to #{kind}'`
41
41
  @kind = kind
@@ -167,6 +167,27 @@ class Itunes_video
167
167
  end
168
168
  end
169
169
 
170
+ ##
171
+ # A list of file formats that Image Events can read from is as follows:
172
+ # PICT, Photoshop, BMP, QuickTime Image, GIF, JPEG, MacPaint, JPEG2, SGI, PSD, TGA, Text, PDF, PNG, and TIFF.
173
+ # Trying to set artwork not of one of these types will throw a -206 error.
174
+
175
+ def artwork=(artwork)
176
+ if !File.exists?(artwork)
177
+ raise "file '#{artwork}' does not exist"
178
+ elsif
179
+ `osascript <<EOF
180
+ tell application "iTunes"
181
+ set the_artwork to read (POSIX file \"#{artwork}\") as picture
182
+ set data of artwork 1 of file track id #{@id} to the_artwork
183
+ end tell
184
+ EOF`
185
+ @artwork = artwork
186
+ else
187
+ raise "could not set 'artwork' for video"
188
+ end
189
+ end
190
+
170
191
  # :section: tv show-specific methods
171
192
 
172
193
  ##
metadata CHANGED
@@ -1,55 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: itunes_video
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
4
5
  prerelease:
5
- version: 0.3.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Richard Myers
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-08-02 00:00:00 Z
12
+ date: 2013-09-01 00:00:00.000000000 Z
14
13
  dependencies: []
15
-
16
14
  description: A gem to import and organize your video collection in iTunes. OS X only.
17
15
  email: rick.myers@me.com
18
16
  executables: []
19
-
20
17
  extensions: []
21
-
22
18
  extra_rdoc_files: []
23
-
24
- files:
19
+ files:
25
20
  - lib/itunes_video.rb
26
21
  homepage: https://rubygems.org/gems/itunes_video
27
- licenses:
22
+ licenses:
28
23
  - WTFPL
29
24
  post_install_message:
30
25
  rdoc_options: []
31
-
32
- require_paths:
26
+ require_paths:
33
27
  - lib
34
- required_ruby_version: !ruby/object:Gem::Requirement
28
+ required_ruby_version: !ruby/object:Gem::Requirement
35
29
  none: false
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: "0"
40
- required_rubygems_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
35
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
46
40
  requirements: []
47
-
48
41
  rubyforge_project:
49
- rubygems_version: 1.8.23
42
+ rubygems_version: 1.8.24
50
43
  signing_key:
51
44
  specification_version: 3
52
45
  summary: Import and organize videos in iTunes
53
46
  test_files: []
54
-
55
- has_rdoc: