Module: AudioRating
- Defined in:
- lib/audio_rating/base.rb,
lib/audio_rating/m4a.rb,
lib/audio_rating/mp3.rb,
lib/audio_rating/ogg.rb,
lib/audio_rating/wav.rb,
lib/audio_rating/aiff.rb,
lib/audio_rating/flac.rb,
lib/audio_rating/id3v2.rb,
lib/audio_rating/version.rb,
lib/audio_rating/constants.rb
Overview
A library for reading embedded star-ratings in audio files.
Defined Under Namespace
Modules: AIFF, FLAC, ID3v2, M4A, MP3, Ogg, WAV
Constant Summary collapse
- VERSION =
The library version
'0.1.0'
- RATE_VALUE_TO_STAR_RATING =
Maps newer ‘Rate’ value to star rating.
{ # Used by: # - MusicBee for AIFF/FLAC/MP4/Ogg/Wav # - MediaMonkey for FLAC/MP4/Ogg: 10 => 0.5, 20 => 1, 30 => 1.5, 40 => 2, 50 => 2.5, 60 => 3, 70 => 3.5, 80 => 4, 90 => 4.5, 100 => 5 }.freeze
- POPM_VALUE_TO_STAR_RATING =
Maps ID3v2 Popularimeter rating value to star rating.
{ # Whole star format used by: # - Windows Media Player for MP3 # - foobar2000 for AIFF/MP3/WAV # - MusicBee for MP3 # - MediaMonkey for AIFF/MP3 1 => 1, 64 => 2, 128 => 3, 196 => 4, 255 => 5, # Half-star format used by: # - MusicBee for MP3 # - MediaMonkey for AIFF/MP3: 13 => 0.5, 54 => 1.5, 118 => 2.5, 186 => 3.5, 242 => 4.5 }.freeze
Class Method Summary collapse
-
.get(path) ⇒ Integer, ...
Get an audio file’s embedded star-rating metadata if present.
Class Method Details
.get(path) ⇒ Integer, ...
Get an audio file’s embedded star-rating metadata if present.
Supports file formats: AIFF, FLAC, M4A, MP3, Ogg and WAV.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/audio_rating/base.rb', line 21 def self.get(path) case File.extname(path).downcase when '.aiff' then AIFF.get(path) when '.flac' then FLAC.get(path) when '.m4a' then M4A.get(path) when '.mp3' then MP3.get(path) when '.ogg' then Ogg.get(path) when '.wav' then WAV.get(path) end end |