Closed Aresiel closed 3 years ago
NOTE: The command will error unless the variable GENIUSTOKEN
in config.py
is set to a valid genius.com token.
I agree with this.
SRA is incredibly inconsistent.
The issue with lyricsgenius is it uses requests
, which is not asynchronous, to make its API calls.
You can read about why this is an issue here: https://discordpy.readthedocs.io/en/stable/faq.html#what-does-blocking-mean
The library blocks the heartbeat connection to Discord, and it could cause latency issues.
You can solve this issue by directly calling to the API using aiohttp.
I'm going to remove my review on this as this is not a critical issue, but it's a recommendation since it could cause issues with the bot in the future.
The issue with lyricsgenius is it uses
requests
, which is not asynchronous, to make its API calls. You can read about why this is an issue here: https://discordpy.readthedocs.io/en/stable/faq.html#what-does-blocking-mean The library blocks the heartbeat connection to Discord, and it could cause latency issues. You can solve this issue by directly calling to the API using aiohttp.I'm going to remove my review on this as this is not a critical issue, but it's a recommendation since it could cause issues with the bot in the future.
Commands are asynchronous functions, do asynchronous functions not run in their own threads?
The issue with lyricsgenius is it uses
requests
, which is not asynchronous, to make its API calls. You can read about why this is an issue here: https://discordpy.readthedocs.io/en/stable/faq.html#what-does-blocking-mean The library blocks the heartbeat connection to Discord, and it could cause latency issues. You can solve this issue by directly calling to the API using aiohttp.I'm going to remove my review on this as this is not a critical issue, but it's a recommendation since it could cause issues with the bot in the future.
What if I fork the module and edit it to use aiohttp?
Using SRA is very difficult and it would be a pain to work with.
The issue with lyricsgenius is it uses
requests
, which is not asynchronous, to make its API calls. You can read about why this is an issue here: https://discordpy.readthedocs.io/en/stable/faq.html#what-does-blocking-mean The library blocks the heartbeat connection to Discord, and it could cause latency issues. You can solve this issue by directly calling to the API using aiohttp. I'm going to remove my review on this as this is not a critical issue, but it's a recommendation since it could cause issues with the bot in the future.What if I fork the module and edit it to use aiohttp?
Using SRA is very difficult and it would be a pain to work with.
That would solve the problem
I have made an async version of lyricsgenius: https://github.com/soulrika/LyricsGenius
Just replace genius.search_song(title)
with await genius.search_song(title)
This reverts commit 253b13d5e5dfe1a6327fa54bccdab677e6da085a, the commit Duck made that switched over from lyricsgenius to SRA. We cannot use SRA because SRA yields seemingly random inconsistent responses.
Details The algorithm used to paginate the lyrics splits the lyrics by verses. It does this in order to provide a nice reading experience to the user. Verses are identified by the double-newline "\n\n" formation separating them. SRA sometimes returns different song lyrics not featuring these double-newlines. These poorly-formatted lyrics cannot be split using our algorithm, and even unsplit, provide a terrible reading experience. Example below.
API Request: https://some-random-api.ml/lyrics?title=pi%20song Reponse 1:
Response 2:
Where instead of newlines, there is no whitespace at all, merely concatenating the different lines together. Both responses vary with no discernable pattern. If you wish to verify this, simply go to https://some-random-api.ml/lyrics?title=pi%20song and refresh a few times.