henkelmax / audio-player

Put your own audio files on music discs!
54 stars 17 forks source link

Feature: filename Subcommand #73

Closed BJTMastermind closed 3 months ago

BJTMastermind commented 3 months ago

This pull request introduces a new filename subcommand to /audioplayer.

Overview

It operates by utilizing a new file named filename_mappings.dat, which resides in the existing audio_player_data folder of the world. This file is structured as a GZipped NBT file, containing a list of mappings between original filenames and their corresponding UUID names.

File Structure

The structure of filename_mappings.dat is as follows:

TAG_Compound(): {
    TAG_List("mappings"): {
        TAG_Compound(): {
            TAG_String("filename"): "<Original filename>.<extension>",
            TAG_String("uuid"): "<UUID>.<extension>"
        },
        ...
    }
}

Functionality

Whenever a new audio file is uploaded, regardless of the method used, an entry is added to filename_mappings.dat. Conversely, if a file is deleted the mappings associated with that file will be removed the next time the filename command is ran or when another audio file is uploaded.

Motivation

I implemented this feature to enhance the usability and maintainability of the users audio files. By introducing the filename subcommand and associated functionality, users can easily manage audio file mappings, whether its with the command itself for a couple of files or externally with user made scripts for a larger number of files.

BJTMastermind commented 3 months ago

Fixed conflicts.

henkelmax commented 3 months ago

Can you combine all your changes into a single commit, so I can properly review the changes you made?

BJTMastermind commented 3 months ago

Having a hard time getting these into 1 commit. So im going to just remake the PR which would be easier for me right now.

new PR: #74