Skip to content

Commit

Permalink
Update to 1.11.4
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
deeffest committed Oct 16, 2024
1 parent cdea134 commit c24225f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 25 deletions.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 3 additions & 2 deletions core/js/ytmusic_observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
33 changes: 14 additions & 19 deletions core/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions core/ytmusic_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ 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()
stream.download(output_path=self.download_folder, filename=f"{sanitized_title}.mp3",
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)
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c24225f

Please sign in to comment.