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>
|
<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:
|
To configure the Vulkan to run in your Heroku account you will need to:
|
||||||
|
|
||||||
- Create an application project in Heroku.
|
- Create an application project in Heroku.
|
||||||
|
|||||||
@ -82,6 +82,12 @@ class PlayHandler(AbstractHandler):
|
|||||||
|
|
||||||
return response
|
return response
|
||||||
else: # If multiple songs added
|
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
|
# Trigger a task to download all songs and then store them in the process playlist
|
||||||
asyncio.create_task(self.__downloadSongsAndStore(songs, processInfo))
|
asyncio.create_task(self.__downloadSongsAndStore(songs, processInfo))
|
||||||
|
|
||||||
@ -92,13 +98,10 @@ class PlayHandler(AbstractHandler):
|
|||||||
embed = self.embeds.DOWNLOADING_ERROR()
|
embed = self.embeds.DOWNLOADING_ERROR()
|
||||||
return HandlerResponse(self.ctx, embed, error)
|
return HandlerResponse(self.ctx, embed, error)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
print(f'ERROR IN PLAYHANDLER -> {traceback.format_exc()}', {type(error)})
|
||||||
if isinstance(error, VulkanError): # If error was already processed
|
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)
|
embed = self.embeds.CUSTOM_ERROR(error)
|
||||||
else:
|
else:
|
||||||
print(
|
|
||||||
f'DEVELOPER NOTE -> PlayController Error: {traceback.format_exc()}, {type(error)}')
|
|
||||||
error = UnknownError()
|
error = UnknownError()
|
||||||
embed = self.embeds.UNKNOWN_ERROR()
|
embed = self.embeds.UNKNOWN_ERROR()
|
||||||
|
|
||||||
@ -108,13 +111,19 @@ class PlayHandler(AbstractHandler):
|
|||||||
playlist = processInfo.getPlaylist()
|
playlist = processInfo.getPlaylist()
|
||||||
queue = processInfo.getQueueToPlayer()
|
queue = processInfo.getQueueToPlayer()
|
||||||
playCommand = VCommands(VCommandsType.PLAY, None)
|
playCommand = VCommands(VCommandsType.PLAY, None)
|
||||||
|
tooManySongs = len(songs) > 100
|
||||||
|
|
||||||
# Trigger a task for each song to be downloaded
|
# Trigger a task for each song to be downloaded
|
||||||
tasks: List[asyncio.Task] = []
|
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))
|
task = asyncio.create_task(self.__down.download_song(song))
|
||||||
tasks.append(task)
|
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()
|
processManager = self.config.getProcessManager()
|
||||||
for index, task in enumerate(tasks):
|
for index, task in enumerate(tasks):
|
||||||
await task
|
await task
|
||||||
|
|||||||
@ -151,6 +151,8 @@ class Downloader:
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
if self.__is_multiple_musics(extracted_info):
|
if self.__is_multiple_musics(extracted_info):
|
||||||
|
if len(extracted_info['entries']) == 0:
|
||||||
|
return {}
|
||||||
return extracted_info['entries'][0]
|
return extracted_info['entries'][0]
|
||||||
else:
|
else:
|
||||||
print(f'DEVELOPER NOTE -> Failed to extract title {title}')
|
print(f'DEVELOPER NOTE -> Failed to extract title {title}')
|
||||||
|
|||||||
@ -6,7 +6,7 @@ class Song:
|
|||||||
self.__playlist = playlist
|
self.__playlist = playlist
|
||||||
|
|
||||||
def finish_down(self, info: dict) -> None:
|
def finish_down(self, info: dict) -> None:
|
||||||
if info is None:
|
if info is None or info == {}:
|
||||||
self.destroy()
|
self.destroy()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -20,7 +20,8 @@ class Song:
|
|||||||
if key in info.keys():
|
if key in info.keys():
|
||||||
self.__info[key] = info[key]
|
self.__info[key] = info[key]
|
||||||
else:
|
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()
|
self.destroy()
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ class Song:
|
|||||||
return self.__problematic
|
return self.__problematic
|
||||||
|
|
||||||
def destroy(self) -> None:
|
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.__problematic = True
|
||||||
self.__playlist.destroy_song(self)
|
self.__playlist.destroy_song(self)
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,9 @@ The config file is located at ```./config/Configs.py```, it doesn't require any
|
|||||||
<hr>
|
<hr>
|
||||||
<br>
|
<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.
|
To deploy and run your Bot in Heroku 24/7, follow the instructions in the [Heroku Instructions](HEROKU.md) page.
|
||||||
|
|
||||||
## 🧪 Tests
|
## 🧪 Tests
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user