Need Help with Firbase DB

Hey, Im kind of knew to this. I watched a tutorial on how to create lists and sync them to a specified user id using a Realtime Database from Firebase. However I ran into a problem when trying to create a player list. I had no issues saving the player’s first name, last name, and the name of their song file however I am having issues saving the actual file itself.

Here is the system, whenever the user clicks the add player button it syncs the songs in a list to allow the user to assign a song to their player when saving. The song name and song file already exist as they were saved in another screen. You can see in the create object block I was able to assign the player a first name, last name and walkUpName(name of the song file).

Here is an image of how everything is stored in the database, you can see each userid has a list of teams and songs, the song list contains all the info needed for the song file. But in the list of players the player “Kaila DeCarvalho” should have an additional property which is the file. I just need to find a way to fetch the file from the correct song in the list. I do have the name of the current selected song except its not the exact same as is it in the database as firebase doesn’t like periods so I created a system to change all “.” to “^”. So the “CurrentSongItem” variable should look like this - “Kaila DeCarvalho.mp3” and I need to fetch the file from the “Kaila DeCarvalho^mp3” object.

If this makes any sense or if this is sounds dumb just know I am pretty new to this all and any help would be greatly appreciated :slight_smile:

Silly question first. Is this supposed to be blank?

If it is then what I might suggest is remove the .mp3 portion when saving. So instead of ‘dogwalkinghits.mp3’ it would just be saved as ‘dogwalkinghits’. It will eliminate the need to change anything and then when you call that data from firebase just use a join block with the json joined with .mp3. If that isnt what youre trying to figure out I am just as confused on what your need is?

I see what your saying with the removing the .mp3, basically in my media page you are able to add songs to a list, this is where its done.
It creates a new object with the file, song name, and the helper just helps me with finding the file right here.
The problem is simply I just don’t know how to fetch the file based on the file name. For example lets say the file name is “dogwalkinghits.mp3” I have this name, the only problem is that I just don’t know how to use this to find the file which is saved in another list.

This is the entire system on how I save the media.

You can see here that the name of the “walkupName”(Name of the file saved under the players database) matches the name accociated with the file itself minus the “.mp3” which I can simply remove after.

Ok I think I get what youre asking ( I hope). Are the able to save ANY song or just songs from a list you’ve provided within the app? That will determine how best to lay it out.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.