<commit_before>module Player
  class MPDAbstract
    #Note: its real ugly to start/stop in every function (must be a way in ruby similar to rails' before/after filters?), but can't keep an open connection as otherwise MPD's Max Connections overfill (though as I'm checking for connected? everytime don't really get why thats happening..)

    # Initialize MPD connection
    def initialize
      @mpd = MPD.new MPD_HOST, MPD_PORT unless @mpd
    end

    def connect
      unless @mpd.connected?
        @mpd.disconnect
        @mpd.connect( true ) 
      end
    end

    def disconnect
      @mpd.disconnect if @mpd.connected?
    end


    def play(pos)
      self.connect
      @mpd.play(pos)
      self.disconnect
    end


    def previous
      self.connect
      @mpd.previous
      self.disconnect
    end

    def next
      self.connect
      @mpd.next
      self.disconnect<commit_msg>adding hack to allow direct access to MPD<commit_after>module Player
  class MPDAbstract
    #Note: its real ugly to start/stop in every function (must be a way in ruby similar to rails' before/after filters?), but can't keep an open connection as otherwise MPD's Max Connections overfill (though as I'm checking for connected? everytime don't really get why thats happening..)

    # Initialize MPD connection
    def initialize
      @mpd = MPD.new MPD_HOST, MPD_PORT unless @mpd
    end

    def mpd
      @mpd
    end

    def connect
      unless @mpd.connected?
        @mpd.disconnect
        @mpd.connect( true )
      end
    end

    def disconnect
      @mpd.disconnect if @mpd.connected?
    end


    def play(pos)
      self.connect
      @mpd.play(pos)
      self.disconnect
    end


    def previous
      self.connect
      @mpd.previous
      self.disconnect
    end

    def next
      self.connect
      @mpd.next
      self.disconnect
{'fraction_non_alphanumeric': 0.062061521856449, 'fraction_numerical': 0.0, 'mean_word_length': 2.2640845070422535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5780090', 'n_tokens_mistral': 574, 'n_tokens_neox': 541, 'n_words': 196}