-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature proposal: Song cache #75
Comments
@anoadragon453 Let me know what you think of this when you get the chance |
I think at this point we're starting to exhaust the amount of information we can easily encode in a filename, and we may want to start looking at more structured data on disk in order to make this easier on ourselves. What about adding a {
"attachments": {
"<message snowflake>.<attachment id>": {
"filename": "<song filename>",
"busts_ago": 0
},
...
} This could also exist as an in-memory dictionary, but this way the data persists across restarts. Filenames would still be the original filenames from Discord, but we could just truncate them if >255 chars. Every time a song is queued for download, create a new entry in "attachments". If a matching entry already exists, reset If a user deletes and re-uploads their track between two While this does involve adding a new file to manage, I think it's simpler to reason about. |
The reason I suggested using
Maybe this is a nitpick but remember that we might have to cache two files w the same name, which is why I think naming files by their unique discord IDs is simpler. An external database definitely seems like the best way to implement it if we do the "busts ago" culling, but I'm not sure I like that the best. For ex, it seems weird that re-listing the same cached files on the same channel twice in a row without actually downloading anything new to the cache might cause a purge, especially given how often i repeatedly When I think it over again, both the modified date culling and the json database culling sound somewhat complicated for busty's actually simple use case, where there is just one channel per two weeks we ever want to
This is equivalent to X = 1 in your proposal. Considering in the real server that we basically only ever want to run |
Ah yeah indeed. You would end up with naming collisions.
Note that we'd reset the Regardless though, I agree that we don't need anything very fancy right now.
sgtm |
We tend to run
!list
more than once per bust, to do things like get Google Form info, make sure everything looks good, etc. We also run it a lot locally when testing. On a large number of songs there can be significant delay and bandwidth consumption from downloading all of the files. It would be nice to have a feature which allows songs to be "cached" so that runs of!list
occurring close in time don't both need to download everything.Despite my feature proposal being sort of long, this wouldn't actually be all that complicated to code. It just involves a lot of arbitrary choices for which I'd like to make recommendations, and I want to hear what others think before implementing it.
More concrete feature proposal:
<discord_filename>
as<discord_message_id>.<attachment_num>.<discord_fileext>
<attachment_num>
because discord messages can have multiple attachments<index>.<discord_filename>
!list
:attachments/
(as<message_id>.<file_ext>
)max(X, # of songs in current !list)
newest files and delete all others, where X is say 50?The text was updated successfully, but these errors were encountered: