Class: RJL::Track

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

Instance Method Summary collapse

Constructor Details

#initialize(track_obj) ⇒ Track

Returns a new instance of Track.



4
5
6
# File 'lib/rjl/track.rb', line 4

def initialize track_obj
  @track_obj = track_obj
end

Instance Method Details

#albumObject



33
34
35
# File 'lib/rjl/track.rb', line 33

def album
  return @track_obj.album.get
end

#album=(str) ⇒ Object



36
37
38
# File 'lib/rjl/track.rb', line 36

def album=(str)
  @track_obj.album.set(str)
end

#album_artistObject



47
48
49
# File 'lib/rjl/track.rb', line 47

def album_artist
  return @track_obj.album_artist.get
end

#album_artist=(str) ⇒ Object



50
51
52
# File 'lib/rjl/track.rb', line 50

def album_artist=(str)
  @track_obj.album_artist.set(str)
end

#artistObject



19
20
21
# File 'lib/rjl/track.rb', line 19

def artist
  return @track_obj.artist.get
end

#artist=(str) ⇒ Object



22
23
24
# File 'lib/rjl/track.rb', line 22

def artist=(str)
  @track_obj.artist.set(str)
end

#classObject



102
103
104
# File 'lib/rjl/track.rb', line 102

def class
  return @track_obj.class_.get
end

#commentObject



84
85
86
# File 'lib/rjl/track.rb', line 84

def comment
  return @track_obj.comment.get
end

#comment=(str) ⇒ Object



87
88
89
# File 'lib/rjl/track.rb', line 87

def comment=(str)
  @track_obj.comment.set(str)
end

#compilation?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/rjl/track.rb', line 98

def compilation?
  return @track_obj.compilation.get
end

#composerObject



61
62
63
# File 'lib/rjl/track.rb', line 61

def composer
  return @track_obj.composer.get
end

#composer=(str) ⇒ Object



64
65
66
# File 'lib/rjl/track.rb', line 64

def composer=(str)
  @track_obj.composer.set(str)
end

#database_idObject



8
9
10
# File 'lib/rjl/track.rb', line 8

def database_id
  return @track_obj.database_ID.get
end

#disc_numberObject



91
92
93
# File 'lib/rjl/track.rb', line 91

def disc_number
  return @track_obj.disc_number.get
end

#disc_number=(int) ⇒ Object



94
95
96
# File 'lib/rjl/track.rb', line 94

def disc_number=(int)
  @track_obj.disc_number.set(int)
end

#genreObject



75
76
77
# File 'lib/rjl/track.rb', line 75

def genre
  return @track_obj.genre.get
end

#genre=(str) ⇒ Object



78
79
80
81
82
# File 'lib/rjl/track.rb', line 78

def genre=(str)
  unless self.class == :shared_track
    @track_obj.genre.set(str)
  end
end

#groupingObject



68
69
70
# File 'lib/rjl/track.rb', line 68

def grouping
  return @track_obj.grouping.get
end

#grouping=(str) ⇒ Object



71
72
73
# File 'lib/rjl/track.rb', line 71

def grouping=(str)
  @track_obj.grouping.set(str)
end

#nameObject



12
13
14
# File 'lib/rjl/track.rb', line 12

def name
  return @track_obj.name.get
end

#name=(str) ⇒ Object



15
16
17
# File 'lib/rjl/track.rb', line 15

def name=(str)
  @track_obj.name.set(str)
end

#sort_albumObject



40
41
42
# File 'lib/rjl/track.rb', line 40

def sort_album
  return @track_obj.sort_album.get
end

#sort_album=(str) ⇒ Object



43
44
45
# File 'lib/rjl/track.rb', line 43

def sort_album=(str)
  @track_obj.sort_album.set(str)
end

#sort_album_artistObject



54
55
56
# File 'lib/rjl/track.rb', line 54

def sort_album_artist
  return @track_obj.sort_album_artist.get
end

#sort_album_artist=(str) ⇒ Object



57
58
59
# File 'lib/rjl/track.rb', line 57

def sort_album_artist=(str)
  @track_obj.sort_album_artist.set(str)
end

#sort_artistObject



26
27
28
# File 'lib/rjl/track.rb', line 26

def sort_artist
  return @track_obj.sort_artist.get
end

#sort_artist=(str) ⇒ Object



29
30
31
# File 'lib/rjl/track.rb', line 29

def sort_artist=(str)
  @track_obj.sort_artist.set(str)
end

#tagsList of String

Tags use square bracket markup in the ‘groupings’ field of iTunes

Returns:

  • (List of String)

    tags



108
109
110
111
112
113
114
115
# File 'lib/rjl/track.rb', line 108

def tags
  tags = []
  begin
    tags = self.grouping.gsub("][", ",")[1..-2].split(',')
  rescue
  end
  return tags
end

#to_sObject



117
118
119
# File 'lib/rjl/track.rb', line 117

def to_s
  puts "#{self.artist} - #{self.name}"
end