Class: Itunes_video

Inherits:
Object
  • Object
show all
Defined in:
lib/itunes_video.rb

Overview

The entire gem is contained in the Itunes_video class.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#artworkObject

Returns the value of attribute artwork.



9
10
11
# File 'lib/itunes_video.rb', line 9

def artwork
  @artwork
end

#categoryObject

Returns the value of attribute category.



9
10
11
# File 'lib/itunes_video.rb', line 9

def category
  @category
end

#commentObject

Returns the value of attribute comment.



9
10
11
# File 'lib/itunes_video.rb', line 9

def comment
  @comment
end

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'lib/itunes_video.rb', line 9

def description
  @description
end

#episode_numObject

Returns the value of attribute episode_num.



9
10
11
# File 'lib/itunes_video.rb', line 9

def episode_num
  @episode_num
end

#genreObject

Returns the value of attribute genre.



9
10
11
# File 'lib/itunes_video.rb', line 9

def genre
  @genre
end

#idObject

Returns the value of attribute id.



9
10
11
# File 'lib/itunes_video.rb', line 9

def id
  @id
end

#kindObject

Returns the value of attribute kind.



9
10
11
# File 'lib/itunes_video.rb', line 9

def kind
  @kind
end

#long_descriptionObject

Returns the value of attribute long_description.



9
10
11
# File 'lib/itunes_video.rb', line 9

def long_description
  @long_description
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/itunes_video.rb', line 9

def name
  @name
end

#played_countObject

Returns the value of attribute played_count.



9
10
11
# File 'lib/itunes_video.rb', line 9

def played_count
  @played_count
end

#ratingObject

Returns the value of attribute rating.



9
10
11
# File 'lib/itunes_video.rb', line 9

def rating
  @rating
end

#season_numObject

Returns the value of attribute season_num.



9
10
11
# File 'lib/itunes_video.rb', line 9

def season_num
  @season_num
end

#show_nameObject

Returns the value of attribute show_name.



9
10
11
# File 'lib/itunes_video.rb', line 9

def show_name
  @show_name
end

#unplayedObject

Returns the value of attribute unplayed.



9
10
11
# File 'lib/itunes_video.rb', line 9

def unplayed
  @unplayed
end

#yearObject

Returns the value of attribute year.



9
10
11
# File 'lib/itunes_video.rb', line 9

def year
  @year
end