diff --git a/Music/Downloader.py b/Music/Downloader.py index 97a22d0..ecdebf5 100644 --- a/Music/Downloader.py +++ b/Music/Downloader.py @@ -15,21 +15,24 @@ class Downloader: 'playliststart': 0, 'extract_flat': False, 'playlistend': config.MAX_PLAYLIST_LENGTH, - 'quiet': True + 'quiet': True, + 'ignore_no_formats_error': True } __YDL_OPTIONS_EXTRACT = {'format': 'bestaudio/best', 'default_search': 'auto', 'playliststart': 0, 'extract_flat': True, 'playlistend': config.MAX_PLAYLIST_LENGTH, - 'quiet': True + 'quiet': True, + 'ignore_no_formats_error': True } __YDL_OPTIONS_FORCE_EXTRACT = {'format': 'bestaudio/best', 'default_search': 'auto', 'playliststart': 0, 'extract_flat': False, 'playlistend': config.MAX_PLAYLIST_LENGTH, - 'quiet': True + 'quiet': True, + 'ignore_no_formats_error': True } __BASE_URL = 'https://www.youtube.com/watch?v={}' @@ -110,7 +113,7 @@ class Downloader: return result except Exception as e: # Any type of error in download - print(f'DEVELOPER NOTE -> Error Downloading URL {e}') + print(f'DEVELOPER NOTE -> Error Downloading {url} -> {e}') return None async def download_song(self, song: Song) -> None: @@ -118,12 +121,15 @@ class Downloader: return None def __download_func(song: Song) -> None: - if Utils.is_url(song.identifier): - song_info = self.__download_url(song.identifier) - else: - song_info = self.__download_title(song.identifier) + try: + if Utils.is_url(song.identifier): + song_info = self.__download_url(song.identifier) + else: + song_info = self.__download_title(song.identifier) - song.finish_down(song_info) + song.finish_down(song_info) + except Exception as e: + print(f'DEVELOPER NOTE -> Error Downloading {song.identifier} -> {e}') # Creating a loop task to download each song loop = asyncio.get_event_loop() diff --git a/Music/Song.py b/Music/Song.py index eab512b..0fa9971 100644 --- a/Music/Song.py +++ b/Music/Song.py @@ -28,6 +28,12 @@ class Song: if key in info.keys(): self.__info[key] = info[key] + self.__cleanTitle() + + def __cleanTitle(self) -> None: + self.__info['title'] = ''.join(char if char.isalnum() or char == + ' ' else ' ' for char in self.__info['title']) + @property def source(self) -> str: if 'url' in self.__info.keys(): diff --git a/README.md b/README.md index 2739248..135dad6 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Vulkan uses multiprocessing and asynchronous Python modules to maximize Music Pl - Manage the loop of one or all playing musics. - Manage the order and remove musics from the queue. - Shuffle the musics queue order. +- Automatically clean the sended messages so it doesn't fill up your server.
@@ -37,7 +38,9 @@ Vulkan uses multiprocessing and asynchronous Python modules to maximize Music Pl
### **Requirements**
-Installation of Python 3.8+ and the dependencies in the requirements.txt file, creation of your own Bot in Discord and Spotify Keys.
+Installation of ``Python 3.10+`` and the dependencies in the requirements.txt file, creation of your own Bot in Discord and Spotify Keys.
+To install the dependencies type this command in the terminal, in the project root folder.
+
```
pip install -r requirements.txt
```
diff --git a/UI/Buttons/PlaylistDropdown.py b/UI/Buttons/PlaylistDropdown.py
index b8ad7a4..02205ee 100644
--- a/UI/Buttons/PlaylistDropdown.py
+++ b/UI/Buttons/PlaylistDropdown.py
@@ -21,7 +21,8 @@ class PlaylistDropdown(Select, AbstractItem):
values = [str(x) for x in range(1, len(songs) + 1)]
# Get the title of each of the 20 first songs, the pycord library doesn't accept more
songsNames: List[str] = []
- for x in range(20):
+ songsLength = min(20, len(songs))
+ for x in range(songsLength):
songsNames.append(f'{x + 1} - {songs[x].title[:80]}')
selectOptions: List[SelectOption] = []
diff --git a/requirements.txt b/requirements.txt
index b6d030b..2d88d47 100644
Binary files a/requirements.txt and b/requirements.txt differ