cui.bundle/utils.rb
# user class must define tracks and get_new_tracks
user class must define tracks and get_new_tracks
user class must define tracks and get_new_tracks
def refresh!(options={})
        if options[:clear]
          @tracks.clear
        else
          @tracks = @tracks.select {|t| t.validate_handle and not t.played }
        end
        track_ids = {}
        @tracks.each {|t| track_ids[t.persistentID] = true }
        self.get_new_tracks.each do |t|
          pid = t.persistentID
          cnt = 1
          while track_ids[t.persistentID]
            cnt += 1
            t.persistentID = "#{pid}_#{cnt}"
          end
          @tracks << t
          track_ids[t.persistentID] = true
        end
        @refreshed_at = options[:now] || Time.now
        @timestamp = @refreshed_at.to_i
      end
def refresh! ( options = { } ) if options [ :clear ] @tracks . clear else @tracks = @tracks . select { | t | t . validate_handle and not t . played } end track_ids = { } @tracks . each { | t | track_ids [ t . persistentID ] = true } self . get_new_tracks . each do | t | pid = t . persistentID cnt = 1 while track_ids [ t . persistentID ] cnt += 1 t . persistentID = "#{pid}_#{cnt}" end @tracks << t track_ids [ t . persistentID ] = true end @refreshed_at = options [ :now ] || Time . now @timestamp = @refreshed_at . to_i end
user class must define tracks and get_new_tracks
user class must define tracks and get_new_tracks
options
<not_specific>