Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5379be6c11 | ||
|
|
c6fe895334 |
@@ -1,4 +1,4 @@
|
|||||||
"""Playtube - ein eigenstaendiger YouTube- & YouTube-Music-Player mit Discord Rich Presence."""
|
"""Playtube - ein eigenstaendiger YouTube- & YouTube-Music-Player mit Discord Rich Presence."""
|
||||||
|
|
||||||
__app_name__ = "Playtube"
|
__app_name__ = "Playtube"
|
||||||
__version__ = "2.2.0"
|
__version__ = "2.2.1"
|
||||||
|
|||||||
@@ -259,9 +259,10 @@ class DiscordRPCWorker(QThread):
|
|||||||
payload = build_presence_payload(item, self._session_start, start_ts, end_ts)
|
payload = build_presence_payload(item, self._session_start, start_ts, end_ts)
|
||||||
self._presence.update(**payload)
|
self._presence.update(**payload)
|
||||||
log_line(
|
log_line(
|
||||||
"[send] title=%r thumbnail=%r large_image=%r start=%s end=%s"
|
"[send] title=%r url=%r thumbnail=%r large_image=%r start=%s end=%s"
|
||||||
% (
|
% (
|
||||||
item.get("title"),
|
item.get("title"),
|
||||||
|
item.get("url"),
|
||||||
item.get("thumbnail"),
|
item.get("thumbnail"),
|
||||||
payload.get("large_image"),
|
payload.get("large_image"),
|
||||||
start_ts,
|
start_ts,
|
||||||
|
|||||||
+10
-2
@@ -82,10 +82,18 @@ MEDIA_PROBE_JS = r"""
|
|||||||
var videoId = videoIdFromUrl(location.href);
|
var videoId = videoIdFromUrl(location.href);
|
||||||
var title = null, subtitle = null, thumbnail = null;
|
var title = null, subtitle = null, thumbnail = null;
|
||||||
|
|
||||||
|
// WICHTIG: die Video-ID aus der URL ist die zuverlaessigste Thumbnail-Quelle - sie
|
||||||
|
// wechselt garantiert synchron mit dem Titel. Das <img> in der YT-Music-Playerleiste
|
||||||
|
// (fruehere Praeferenz) wird von YouTube per Crossfade/Shadow-DOM animiert und
|
||||||
|
// aktualisiert sein src-Attribut dabei nachweislich NICHT zuverlaessig pro Titel -
|
||||||
|
// empirisch bestaetigt: dieselbe Thumbnail-URL blieb ueber mehrere komplett
|
||||||
|
// unterschiedliche Songs hinweg stehen, obwohl Titel/Zeit schon laengst gewechselt
|
||||||
|
// hatten. Das DOM-<img> dient nur noch als Fallback, falls keine Video-ID in der
|
||||||
|
// URL steckt.
|
||||||
if (isMusic) {
|
if (isMusic) {
|
||||||
title = txt('.title.ytmusic-player-bar') || txt('ytmusic-player-bar .title');
|
title = txt('.title.ytmusic-player-bar') || txt('ytmusic-player-bar .title');
|
||||||
subtitle = txt('.byline.ytmusic-player-bar') || txt('ytmusic-player-bar .byline');
|
subtitle = txt('.byline.ytmusic-player-bar') || txt('ytmusic-player-bar .byline');
|
||||||
thumbnail = imgSrc('ytmusic-player-bar img, .image.ytmusic-player-bar img') || ytThumbnailUrl(videoId);
|
thumbnail = ytThumbnailUrl(videoId) || imgSrc('ytmusic-player-bar img, .image.ytmusic-player-bar img');
|
||||||
} else {
|
} else {
|
||||||
var t = document.title.replace(/ - YouTube$/, '');
|
var t = document.title.replace(/ - YouTube$/, '');
|
||||||
title = t || null;
|
title = t || null;
|
||||||
@@ -94,7 +102,7 @@ MEDIA_PROBE_JS = r"""
|
|||||||
|| txt('#channel-name a')
|
|| txt('#channel-name a')
|
||||||
|| txt('ytd-channel-name#channel-name a');
|
|| txt('ytd-channel-name#channel-name a');
|
||||||
var imgY = document.querySelector('link[rel="image_src"]');
|
var imgY = document.querySelector('link[rel="image_src"]');
|
||||||
thumbnail = (imgY ? imgY.href : null) || ytThumbnailUrl(videoId);
|
thumbnail = ytThumbnailUrl(videoId) || (imgY ? imgY.href : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeInfo = isMusic ? musicTimeInfo() : youtubeTimeInfo();
|
var timeInfo = isMusic ? musicTimeInfo() : youtubeTimeInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user