Module: Squeezer::Client::Database

Included in:
Squeezer::Client
Defined in:
lib/squeezer/client/database.rb

Instance Method Summary collapse

Instance Method Details

#abortscan!Object

“The ”abortscan“ command causes Squeezebox Server to cancel a running scan. Please note that after stopping a scan this way you’ll have to fully rescan your music collection to get consistent data.”



52
53
54
# File 'lib/squeezer/client/database.rb', line 52

def abortscan!
  cmd("abortscan")
end

#albumsObject



29
30
31
# File 'lib/squeezer/client/database.rb', line 29

def albums
  Models::Album.all
end

#artistsObject



25
26
27
# File 'lib/squeezer/client/database.rb', line 25

def artists
  Models::Artist.all
end

#genresObject



37
38
39
# File 'lib/squeezer/client/database.rb', line 37

def genres
  Models::Genre.all
end

#rescan!Object



41
42
43
# File 'lib/squeezer/client/database.rb', line 41

def rescan!
  cmd("rescan")
end

#rescan_progressObject

TODO format the return data better and make it useful



65
66
67
# File 'lib/squeezer/client/database.rb', line 65

def rescan_progress
  extract_hash_from_data(cmd("rescanprogress"))
end

#scanning?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/squeezer/client/database.rb', line 45

def scanning?
  cmd("rescan ?").to_boolean
end

#total_albumsObject



13
14
15
# File 'lib/squeezer/client/database.rb', line 13

def total_albums
  Models::Album.total
end

#total_artistsObject

doesn’t include ‘Various Artists’



9
10
11
# File 'lib/squeezer/client/database.rb', line 9

def total_artists
  Models::Artist.total
end

#total_genresObject



21
22
23
# File 'lib/squeezer/client/database.rb', line 21

def total_genres
  Models::Genre.total
end

#total_tracksObject



17
18
19
# File 'lib/squeezer/client/database.rb', line 17

def total_tracks
  Models::Track.total
end

#tracksObject



33
34
35
# File 'lib/squeezer/client/database.rb', line 33

def tracks
  Models::Track.all
end

#wipecache!Object

The “wipecache” command allows the caller to have the Squeezebox Server rescan its music library, reloading the music file information. This differs from the “rescan!” command in that it first clears the tag database. During a rescan triggered by “wipecache!”, “rescan?” returns true.



60
61
62
# File 'lib/squeezer/client/database.rb', line 60

def wipecache!
  cmd("wipecache")
end