<commit_before>require 'lastfm'

module Scrapescrobbler
  class Listener
    attr_accessor :lastfm, :station, :started

    def initialize(station)
      @lastfm = Listener.authenticate
      @station = ::Scrapescrobbler::Stations.const_get(station.classify)
    end

    def listen
      raise if @started
      @started = DateTime.now
    end

    def update
      playlist = Stations::Wyep::playlist
      if playlist and playlist.length > 0 then
        @now_playing = playlist.first
        playlist.each do |song|
          next if song == nil
          saved = song.save
          self.scrobble(song) if saved
        end
      end
    end

    def scrobble song
      puts "Scrobbling #{song} @ #{song.time || Time.now}"
      @lastfm.track.scrobble(song.artist, song.title, song.album,
          song.time.utc.to_i || Time.now.utc.to_i)
    end

    def now_playing
      update if not @now_playing
      @now_playing
    end

    private
<commit_msg>Fix order of arguments in scrobble method.<commit_after>require 'lastfm'

module Scrapescrobbler
  class Listener
    attr_accessor :lastfm, :station, :started

    def initialize(station)
      @lastfm = Listener.authenticate
      @station = ::Scrapescrobbler::Stations.const_get(station.classify)
    end

    def listen
      raise if @started
      @started = DateTime.now
    end

    def update
      playlist = Stations::Wyep::playlist
      if playlist and playlist.length > 0 then
        @now_playing = playlist.first
        playlist.each do |song|
          next if song == nil
          saved = song.save
          self.scrobble(song) if saved
        end
      end
    end

    def scrobble song
      puts "Scrobbling #{song} @ #{song.time || Time.now}"
      @lastfm.track.scrobble(song.artist, song.title,
          song.time.utc.to_i || Time.now.utc.to_i, song.album)
    end

    def now_playing
      update if not @now_playing
      @now_playing
    end

    private

{'fraction_non_alphanumeric': 0.08568496664956388, 'fraction_numerical': 0.001026167265264238, 'mean_word_length': 2.260869565217391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '498031', 'n_tokens_mistral': 651, 'n_tokens_neox': 612, 'n_words': 156}