Refactored to use database
#5 Switched to use maria database to store song information #7 Added spring and hibernate support #8 Added song upload functionality
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Project: Eight Track, File: DiscordEventHandler.java
|
||||
*
|
||||
* Copyright 2019 Locusworks LLC.
|
||||
* Copyright 2019-2019 Locusworks LLC.
|
||||
* All rights reserved. Federal copyright law prohibits unauthorized reproduction by
|
||||
* any means and imposes fines up to $25,000 for violation. No part of this material
|
||||
* may be reproduced, transmitted, transcribed, stored in a retrieval system, copied,
|
||||
@@ -43,6 +43,7 @@ import net.locusworks.discord.eighttrack.database.entities.DiscordGuild;
|
||||
import net.locusworks.discord.eighttrack.database.repos.GuildRepository;
|
||||
import net.locusworks.discord.eighttrack.services.ConfigurationService;
|
||||
import net.locusworks.discord.eighttrack.services.GuildMusicService;
|
||||
import net.locusworks.discord.eighttrack.services.GuildSongRepoService;
|
||||
import net.locusworks.logger.ApplicationLogger;
|
||||
import net.locusworks.logger.ApplicationLoggerFactory;
|
||||
|
||||
@@ -64,6 +65,9 @@ public class DiscordEventHandler extends ListenerAdapter {
|
||||
|
||||
@Autowired
|
||||
private Mp3UploadHandler uploadHandler;
|
||||
|
||||
@Autowired
|
||||
private GuildSongRepoService guildSongRepoService;
|
||||
|
||||
@PostConstruct
|
||||
private void init() throws IOException {
|
||||
@@ -106,7 +110,7 @@ public class DiscordEventHandler extends ListenerAdapter {
|
||||
private void onGuildMessageReceivedHelper(GuildMessageReceivedEvent event) throws IOException {
|
||||
|
||||
if (!musicService.containsKey(event.getGuild().getIdLong())) {
|
||||
musicService.put(event.getGuild().getIdLong(), new GuildMusicHandler(musicDir, uploadHandler));
|
||||
musicService.put(event.getGuild().getIdLong(), new GuildMusicHandler(musicDir, uploadHandler, guildSongRepoService));
|
||||
}
|
||||
GuildMusicHandler gmh = musicService.get(event.getGuild().getIdLong());
|
||||
gmh.accept((id) -> musicService.remove(id));
|
||||
|
||||
Reference in New Issue
Block a user