jagrosh / jagrosh/MusicBot

Playlists using UTF-16 encoding sometimes don't load

Open
#883 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
5.8k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

### Bug Description

As mentioned on discord, the MusicBot seems unable to handle more than 128 .txt files in the Playlists folder.

### Steps to Reproduce

1. Add more than 128 files to Playlists folder
2. Run playlist command on Discord
3. Only returns 128 Playlists, also can't play playlists outside this range

Example Files in Explorer:
![explorer](https://user-images.githubusercontent.com/70651100/134049045-97511c4e-d894-405a-9bfd-fd5a90a14746.png)

Example Playlist Command:
![playlist](https://user-images.githubusercontent.com/70651100/134049111-0fdb07a7-7cf6-42a6-b7b5-2269edaf1528.png)

Example Error when trying to play a playlist outside of the 128 range:
![error](https://user-images.githubusercontent.com/70651100/134049147-48243d82-0a52-4257-89d4-8000488d0309.png)

### Expected Result

I expect to be able to play any playlist regardless of the quantity of playlists in the playlist folder.

### Debug Output

```shell
System Properties:
java.version = 17
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.version = 17
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 17+35-LTS-2724
java.specification.version = 17
os.arch = amd64
os.name = Windows 10

JMusicBot Information:
Version = 0.3.5
Owner = 209240452371578880
Prefix = !
AltPrefix = null
MaxSeconds = 0
NPImages = false
SongInStatus = true
StayInChannel = true
UseEval = false
UpdateAlerts = true

Dependency Information:
JDA Version = 4.3.0_312
JDA-Utilities Version = 3.0.5
Lavaplayer Version = 1.3.78

Runtime Information:
Total Memory = 56
Used Memory = 16

Discord Information:
ID = 888173169964355604
Guilds = 1
Users = 2
```
```

### Additional Info

The playlists seem to be loaded alphabetically. I have also tried creating new playlists that fall at the start of the list e.g. "01 Test.txt". Adding these reduces the playlists discovered, always maintaining 128.

### Checklist

- [X] I have looked for information about this [within the documentation](https://jmusicbot.com/)
- [X] I have searched for similar issues [on the issues page](https://github.com/jagrosh/MusicBot/issues?q=is%3Aissue)
- [X] I am running the latest version of the bot: ![Release](https://img.shields.io/github/release/jagrosh/MusicBot.svg)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the playlist command and the code that loads .txt files from the Playlists folder; the issue does not name specific files or tests. Reproduce the problem with more than 128 playlists, then verify that every playlist is listed and playable regardless of filename or position.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.