Class: Itunes_video
- Inherits:
-
Object
- Object
- Itunes_video
- Defined in:
- lib/itunes_video.rb
Overview
The entire gem is contained in the Itunes_video class.
Instance Attribute Summary collapse
-
#artwork ⇒ Object
Returns the value of attribute artwork.
-
#category ⇒ Object
Returns the value of attribute category.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#description ⇒ Object
Returns the value of attribute description.
-
#episode_num ⇒ Object
Returns the value of attribute episode_num.
-
#genre ⇒ Object
Returns the value of attribute genre.
-
#id ⇒ Object
Returns the value of attribute id.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#long_description ⇒ Object
Returns the value of attribute long_description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#played_count ⇒ Object
Returns the value of attribute played_count.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#season_num ⇒ Object
Returns the value of attribute season_num.
-
#show_name ⇒ Object
Returns the value of attribute show_name.
-
#unplayed ⇒ Object
Returns the value of attribute unplayed.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(file) ⇒ Itunes_video
constructor
The initialize method imports the video into iTunes and returns an iTunes track ID, which is used to identify the video for the other methods.
Constructor Details
#initialize(file) ⇒ Itunes_video
The initialize method imports the video into iTunes and returns an iTunes track ID, which is used to identify the video for the other methods.
If the file supplied is not a full path, look for the file relative to the working directory before bailing out.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/itunes_video.rb', line 18 def initialize(file) if !(Pathname.new file).absolute? if File.exist?(File.join(FileUtils.pwd, file)) file = File.join(FileUtils.pwd, file) else raise "could not find video to import" end end import = `osascript -e 'tell application \"iTunes\" to add POSIX file \"#{file}\"'` if import.split(" ")[3].nil? raise "could not import video" else @id = import.split(" ")[3] end end |
Instance Attribute Details
#artwork ⇒ Object
Returns the value of attribute artwork.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def artwork @artwork end |
#category ⇒ Object
Returns the value of attribute category.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def category @category end |
#comment ⇒ Object
Returns the value of attribute comment.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def comment @comment end |
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def description @description end |
#episode_num ⇒ Object
Returns the value of attribute episode_num.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def episode_num @episode_num end |
#genre ⇒ Object
Returns the value of attribute genre.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def genre @genre end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def id @id end |
#kind ⇒ Object
Returns the value of attribute kind.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def kind @kind end |
#long_description ⇒ Object
Returns the value of attribute long_description.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def long_description @long_description end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def name @name end |
#played_count ⇒ Object
Returns the value of attribute played_count.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def played_count @played_count end |
#rating ⇒ Object
Returns the value of attribute rating.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def @rating end |
#season_num ⇒ Object
Returns the value of attribute season_num.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def season_num @season_num end |
#show_name ⇒ Object
Returns the value of attribute show_name.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def show_name @show_name end |
#unplayed ⇒ Object
Returns the value of attribute unplayed.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def unplayed @unplayed end |
#year ⇒ Object
Returns the value of attribute year.
9 10 11 |
# File 'lib/itunes_video.rb', line 9 def year @year end |