<commit_before>package com.bwfcwalshy.flarebot.music;

import com.bwfcwalshy.flarebot.FlareBot;
import sx.blah.discord.util.audio.AudioPlayer;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class MusicManager {

    // Guild ID | Queue
    private Map<String, AudioPlayer> players;

    private FlareBot bot;
    public MusicManager(FlareBot flareBot){
        players = new ConcurrentHashMap<>();
        this.bot = flareBot;
    }

    public boolean addSong(String guildId, String musicFile, String trackName){
        AudioPlayer player = players.computeIfAbsent(guildId,
                id -> AudioPlayer.getAudioPlayerForGuild(bot.getClient().getGuildByID(id)));
        try {
            AudioInputStream input = AudioSystem.getAudioInputStream(new File("cached" + File.separator + musicFile));
            //FileProvider file = new FileProvider("cached" + File.separator + musicFile);
            AudioPlayer.Track track = new AudioPlayer.Track(input);
            // I need to remove 11 for the YouTube ID and 4 for the ".mp3" and finally the joiner "-" = 16
            track.getMetadata().put("name", trackName);
            //track.getMetadata().put("duration", duration);
            player.queue(track);
        } catch (IOException | UnsupportedAudioFileException e) {
            FlareBot.LOGGER.error("Could not add song", e);
            return false;
        }
        players.put(guildId, player);
        return true;
    }

    public void pause(String guildId){
        if(players.containsKey(guildId))
            players.get(guildId).setPaused(true);
    }

    public void play(String guildId){
        if(players.containsKey(guildId))
            players.get(guildId).setPaused(false);
    }

    public void skip(String guildId){
        if(players.containsKey(guildId))
            players.get(guildId).skip();
    }

    public void stop(String guildId){
        if(players.containsKey(guildId)) {
            players.get(guildId).setPaused(true);
            players.get(guildId).getPlaylist().clear();
        }
    }

    public void shuffle(String guildId){
        if(players.containsKey(guildId)) {
            players.get(guildId).shuffle();
        }
    }

    public void setVolume(String guildId, int i){
        if(i >= 0 && i <= 100){
            if(!players.containsKey(guildId)){
                return;
            }
            players.get(guildId).setVolume((float) i / 100);
        }
    }
<commit_msg>Default volume<commit_after>package com.bwfcwalshy.flarebot.music;

import com.bwfcwalshy.flarebot.FlareBot;
import sx.blah.discord.util.audio.AudioPlayer;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class MusicManager {

    // Guild ID | Queue
    private Map<String, AudioPlayer> players;

    private FlareBot bot;

    public MusicManager(FlareBot flareBot) {
        players = new ConcurrentHashMap<>();
        this.bot = flareBot;
    }

    public boolean addSong(String guildId, String musicFile, String trackName) {
        AudioPlayer player = players.computeIfAbsent(guildId, id -> {
            AudioPlayer playa = AudioPlayer.getAudioPlayerForGuild(bot.getClient().getGuildByID(id));
            playa.setVolume(20);
            return playa;
        });
        try {
            AudioInputStream input = AudioSystem.getAudioInputStream(new File("cached" + File.separator + musicFile));
            //FileProvider file = new FileProvider("cached" + File.separator + musicFile);
            AudioPlayer.Track track = new AudioPlayer.Track(input);
            // I need to remove 11 for the YouTube ID and 4 for the ".mp3" and finally the joiner "-" = 16
            track.getMetadata().put("name", trackName);
            //track.getMetadata().put("duration", duration);
            player.queue(track);
        } catch (IOException | UnsupportedAudioFileException e) {
            FlareBot.LOGGER.error("Could not add song", e);
            return false;
        }
        players.put(guildId, player);
        return true;
    }

    public void pause(String guildId) {
        if (players.containsKey(guildId))
            players.get(guildId).setPaused(true);
    }

    public void play(String guildId) {
        if (players.containsKey(guildId))
            players.get(guildId).setPaused(false);
    }

    public void skip(String guildId) {
        if (players.containsKey(guildId))
            players.get(guildId).skip();
    }

    public void stop(String guildId) {
        if (players.containsKey(guildId)) {
            players.get(guildId).setPaused(true);
            players.get(guildId).getPlaylist().clear();
        }
    }

    public void shuffle(String guildId) {
        if (players.containsKey(guildId)) {
            players.get(guildId).shuffle();
        }
    }

    public void setVolume(String guildId, int i) {
        if (i >= 0 && i <= 100) {
            if (!players.containsKey(guildId)) {
                return;
            }
            players.get(guildId).setVolume((float) i / 100);
        }
    }

{'fraction_non_alphanumeric': 0.11196628183983874, 'fraction_numerical': 0.005131024372365769, 'mean_word_length': 2.5144880875724405, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1216832', 'n_tokens_mistral': 1650, 'n_tokens_neox': 1588, 'n_words': 325}