diff --git a/changelog.txt b/changelog.txt index 1d55786..3c63af9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +### Update 1.11.4 🎉 (October 16, 2024) + +- Fixed a download error for children's content. +- Fixed an application crash related to the Discord RPC plugin not being able to update profile information about the currently playing song due to the song/album name exceeding 128 characters. +- Updated pytubefix to version 8.0.0. +- Other minor corrections. + ### Update 1.11.3 🎉 (October 9, 2024) - A small fix for the Discord Rich Presence plugin. diff --git a/core/js/ytmusic_observer.js b/core/js/ytmusic_observer.js index ca2a51f..4d878c0 100644 --- a/core/js/ytmusic_observer.js +++ b/core/js/ytmusic_observer.js @@ -76,12 +76,13 @@ script.onload = function() { var likeButton = document.querySelector('ytmusic-like-button-renderer#like-button-renderer'); if (likeButton) { var likeStatus = likeButton.getAttribute('like-status'); - if (likeStatus !== lastLikeStatus) { + if (likeStatus && likeStatus !== lastLikeStatus) { + likeStatus = likeStatus.toLowerCase().charAt(0).toUpperCase() + likeStatus.slice(1).toLowerCase(); backend.like_status_changed(likeStatus); lastLikeStatus = likeStatus; } } - } + } var likeObserver = new MutationObserver(updateLikeStatus); var likeButton = document.querySelector('ytmusic-like-button-renderer#like-button-renderer'); diff --git a/core/main_window.py b/core/main_window.py index 8907254..5355943 100644 --- a/core/main_window.py +++ b/core/main_window.py @@ -166,16 +166,10 @@ def set_application_proxy(self): if self.proxy_login_setting: proxy.setUser(self.proxy_login_setting) - logging.info("Proxy login set successfully.") if self.proxy_password_setting: proxy.setPassword(self.proxy_password_setting) - logging.info("Proxy password set successfully.") - + QNetworkProxy.setApplicationProxy(proxy) - logging.info(f"Application proxy set successfully. Type: {self.proxy_type_setting}") - - except ValueError as ve: - logging.error(f"QNetworkProxy ValueError: {ve}") except Exception as e: logging.error(f"QNetworkProxy An error occurred: {e}") @@ -285,17 +279,17 @@ def like_status_changed(self, status): def update_tray_icon_like_dislike_controls(self): if self.tray_icon_setting == 1 and self.tray_icon: - if self.like_status == "LIKE": + if self.like_status == "Like": self.tray_icon.like_action.setIcon(QIcon(f"{self.icon_folder}/like-checked.png")) self.tray_icon.dislike_action.setIcon(QIcon(f"{self.icon_folder}/dislike.png")) self.tray_icon.like_action.setEnabled(True) self.tray_icon.dislike_action.setEnabled(True) - elif self.like_status == "DISLIKE": + elif self.like_status == "Dislike": self.tray_icon.like_action.setIcon(QIcon(f"{self.icon_folder}/like.png")) self.tray_icon.dislike_action.setIcon(QIcon(f"{self.icon_folder}/dislike-checked.png")) self.tray_icon.like_action.setEnabled(True) self.tray_icon.dislike_action.setEnabled(True) - elif self.like_status == "INDIFFERENT": + elif self.like_status == "Indifferent": self.tray_icon.like_action.setIcon(QIcon(f"{self.icon_folder}/like.png")) self.tray_icon.dislike_action.setIcon(QIcon(f"{self.icon_folder}/dislike.png")) self.tray_icon.like_action.setEnabled(True) @@ -308,17 +302,17 @@ def update_tray_icon_like_dislike_controls(self): def update_win_thumbnail_buttons_like_dislike_controls(self): if self.win_thumbmail_buttons_setting == 1 and self.win_thumbnail_toolbar: - if self.like_status == "LIKE": + if self.like_status == "Like": self.tool_btn_like.setIcon(QIcon(f"{self.icon_folder}/like-border-checked.png")) self.tool_btn_dislike.setIcon(QIcon(f"{self.icon_folder}/dislike-border.png")) self.tool_btn_like.setEnabled(True) self.tool_btn_dislike.setEnabled(True) - elif self.like_status == "DISLIKE": + elif self.like_status == "Dislike": self.tool_btn_like.setIcon(QIcon(f"{self.icon_folder}/like-border.png")) self.tool_btn_dislike.setIcon(QIcon(f"{self.icon_folder}/dislike-border-checked.png")) self.tool_btn_like.setEnabled(True) self.tool_btn_dislike.setEnabled(True) - elif self.like_status == "INDIFFERENT": + elif self.like_status == "Indifferent": self.tool_btn_like.setIcon(QIcon(f"{self.icon_folder}/like-border.png")) self.tool_btn_dislike.setIcon(QIcon(f"{self.icon_folder}/dislike-border.png")) self.tool_btn_like.setEnabled(True) @@ -331,17 +325,17 @@ def update_win_thumbnail_buttons_like_dislike_controls(self): def update_mini_player_like_dislike_controls(self): if self.mini_player_dialog: - if self.like_status == "LIKE": + if self.like_status == "Like": self.mini_player_dialog.like_button.setIcon(QIcon(f"{self.icon_folder}/like-filled-checked.png")) self.mini_player_dialog.dislike_button.setIcon(QIcon(f"{self.icon_folder}/dislike.png")) self.mini_player_dialog.like_button.setEnabled(True) self.mini_player_dialog.dislike_button.setEnabled(True) - elif self.like_status == "DISLIKE": + elif self.like_status == "Dislike": self.mini_player_dialog.like_button.setIcon(QIcon(f"{self.icon_folder}/like.png")) self.mini_player_dialog.dislike_button.setIcon(QIcon(f"{self.icon_folder}/dislike-filled-checked.png")) self.mini_player_dialog.like_button.setEnabled(True) self.mini_player_dialog.dislike_button.setEnabled(True) - elif self.like_status == "INDIFFERENT": + elif self.like_status == "Indifferent": self.mini_player_dialog.like_button.setIcon(QIcon(f"{self.icon_folder}/like.png")) self.mini_player_dialog.dislike_button.setIcon(QIcon(f"{self.icon_folder}/dislike.png")) self.mini_player_dialog.like_button.setEnabled(True) @@ -386,10 +380,12 @@ def update_discord_rpc(self): {"label": "▶ Play in Browser", "url": url}, {"label": "🌐 YTMDPlayer on GitHub", "url": "https://github.com/deeffest/Youtube-Music-Desktop-Player"} ] + details = self.title[:128] if self.title else "" + state = self.author[:128] if self.author else "" try: self.discord_rpc.update( - details=self.title, - state=self.author, + details=details, + state=state, large_image=self.thumbnail_url, small_image="https://music.youtube.com/img/favicon_48.png", buttons=btn_list @@ -402,7 +398,6 @@ def reconnect_discord_rpc(self, retry_update=False): if self.discord_rpc: try: self.discord_rpc.connect() - logging.info("Reconnected to Discord RPC successfully.") if retry_update: self.update_discord_rpc() diff --git a/core/ytmusic_downloader.py b/core/ytmusic_downloader.py index 5feaadd..1a590f7 100644 --- a/core/ytmusic_downloader.py +++ b/core/ytmusic_downloader.py @@ -28,7 +28,7 @@ def run(self): self.download_finished.emit(self.download_folder, self.title) def download_youtube(self): - yt = YouTube(self.url, proxies=self.get_proxies()) + yt = YouTube(self.url, client="MWEB", proxies=self.get_proxies()) self.title = yt.title sanitized_title = self.sanitize_filename(yt.title) stream = yt.streams.get_audio_only() @@ -36,7 +36,7 @@ def download_youtube(self): timeout=5, skip_existing=False, max_retries=2) def download_playlist(self): - pl = Playlist(self.url, proxies=self.get_proxies()) + pl = Playlist(self.url, client="MWEB", proxies=self.get_proxies()) self.title = self.sanitize_filename(pl.title) playlist_folder = os.path.join(self.download_folder, self.title) os.makedirs(playlist_folder, exist_ok=True) diff --git a/main.py b/main.py index 8356e13..996fb9d 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,7 @@ name = "Youtube-Music-Desktop-Player" author = "deeffest" website = "deeffest.pythonanywhere.com" -version = "1.11.3" +version = "1.11.4" current_dir = os.path.dirname(os.path.abspath(__file__)) def setup_logging(): diff --git a/requirements.txt b/requirements.txt index 2bbc26d..ef0c3fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,6 @@ packaging==24.1 pypresence==4.3.0 PyQt5==5.15.11 PyQt_Fluent_Widgets==1.6.5 -pytubefix==7.2.2 +pytubefix==8.0.0 pywinstyles==1.8 Requests==2.32.3