mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Trying to fix issue 32
This commit is contained in:
parent
10e38a8809
commit
a72c4c7d8d
@ -1,6 +1,8 @@
|
||||
<h1 align="center">Configuring Heroku</h1>
|
||||
|
||||
Nobody wants to run the Vulkan process on their machine, so we host the process on Heroku, a cloud platform that contains free accounts.<br>
|
||||
> Heroku doesn't offer free services anymore
|
||||
|
||||
Nobody wants to run the Vulkan process on their machine, so we host the process on Heroku, <s>a cloud platform that contains free</s>.<br>
|
||||
To configure the Vulkan to run in your Heroku account you will need to:
|
||||
|
||||
- Create an application project in Heroku.
|
||||
|
||||
@ -82,6 +82,12 @@ class PlayHandler(AbstractHandler):
|
||||
|
||||
return response
|
||||
else: # If multiple songs added
|
||||
# If more than 10 songs, download and load the first 5 to start the play right away
|
||||
if len(songs) > 10:
|
||||
fiveFirstSongs = songs[0:5]
|
||||
songs = songs[5:]
|
||||
await self.__downloadSongsAndStore(fiveFirstSongs, processInfo)
|
||||
|
||||
# Trigger a task to download all songs and then store them in the process playlist
|
||||
asyncio.create_task(self.__downloadSongsAndStore(songs, processInfo))
|
||||
|
||||
@ -92,13 +98,10 @@ class PlayHandler(AbstractHandler):
|
||||
embed = self.embeds.DOWNLOADING_ERROR()
|
||||
return HandlerResponse(self.ctx, embed, error)
|
||||
except Exception as error:
|
||||
print(f'ERROR IN PLAYHANDLER -> {traceback.format_exc()}', {type(error)})
|
||||
if isinstance(error, VulkanError): # If error was already processed
|
||||
print(
|
||||
f'DEVELOPER NOTE -s> PlayController Error: {traceback.format_exc()}', {type(error)})
|
||||
embed = self.embeds.CUSTOM_ERROR(error)
|
||||
else:
|
||||
print(
|
||||
f'DEVELOPER NOTE -> PlayController Error: {traceback.format_exc()}, {type(error)}')
|
||||
error = UnknownError()
|
||||
embed = self.embeds.UNKNOWN_ERROR()
|
||||
|
||||
@ -108,13 +111,19 @@ class PlayHandler(AbstractHandler):
|
||||
playlist = processInfo.getPlaylist()
|
||||
queue = processInfo.getQueueToPlayer()
|
||||
playCommand = VCommands(VCommandsType.PLAY, None)
|
||||
tooManySongs = len(songs) > 100
|
||||
|
||||
# Trigger a task for each song to be downloaded
|
||||
tasks: List[asyncio.Task] = []
|
||||
for song in songs:
|
||||
for index, song in enumerate(songs):
|
||||
# If there is a lot of songs being downloaded, force a sleep to try resolve the Http Error 429 "To Many Requests"
|
||||
# Trying to fix the issue https://github.com/RafaelSolVargas/Vulkan/issues/32
|
||||
if tooManySongs and index % 3 == 0:
|
||||
await asyncio.sleep(0.5)
|
||||
task = asyncio.create_task(self.__down.download_song(song))
|
||||
tasks.append(task)
|
||||
|
||||
# In the original order, await for the task and then if successfully downloaded add in the playlist
|
||||
# In the original order, await for the task and then, if successfully downloaded, add to the playlist
|
||||
processManager = self.config.getProcessManager()
|
||||
for index, task in enumerate(tasks):
|
||||
await task
|
||||
|
||||
@ -151,6 +151,8 @@ class Downloader:
|
||||
return {}
|
||||
|
||||
if self.__is_multiple_musics(extracted_info):
|
||||
if len(extracted_info['entries']) == 0:
|
||||
return {}
|
||||
return extracted_info['entries'][0]
|
||||
else:
|
||||
print(f'DEVELOPER NOTE -> Failed to extract title {title}')
|
||||
|
||||
@ -6,7 +6,7 @@ class Song:
|
||||
self.__playlist = playlist
|
||||
|
||||
def finish_down(self, info: dict) -> None:
|
||||
if info is None:
|
||||
if info is None or info == {}:
|
||||
self.destroy()
|
||||
return None
|
||||
|
||||
@ -20,7 +20,8 @@ class Song:
|
||||
if key in info.keys():
|
||||
self.__info[key] = info[key]
|
||||
else:
|
||||
print(f'DEVELOPER NOTE -> {key} not found in info of music: {self.identifier}')
|
||||
print(
|
||||
f'DEVELOPER NOTE -> Required information [{key}] was not found in the music: {self.identifier}')
|
||||
self.destroy()
|
||||
return
|
||||
|
||||
@ -64,7 +65,7 @@ class Song:
|
||||
return self.__problematic
|
||||
|
||||
def destroy(self) -> None:
|
||||
print(f'DEVELOPER NOTE -> Music self destroying {self.__identifier}')
|
||||
print(f'MUSIC ERROR -> Music self destroying {self.__identifier}')
|
||||
self.__problematic = True
|
||||
self.__playlist.destroy_song(self)
|
||||
|
||||
|
||||
@ -81,7 +81,9 @@ The config file is located at ```./config/Configs.py```, it doesn't require any
|
||||
<hr>
|
||||
<br>
|
||||
|
||||
## **🚀 Heroku**
|
||||
## **🚀 Heroku (Not free anymore)**
|
||||
> *Heroku doesn't offer free host services anymore.* <br>
|
||||
|
||||
To deploy and run your Bot in Heroku 24/7, follow the instructions in the [Heroku Instructions](HEROKU.md) page.
|
||||
|
||||
## 🧪 Tests
|
||||
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user