Skip to content

Commit

Permalink
fix: jellyfin 10.10 cannot get item info
Browse files Browse the repository at this point in the history
  • Loading branch information
lonzzi committed Oct 28, 2024
1 parent daf12f8 commit 94a0aa4
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions ede.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@
const mediaContainerQueryStr = "div[data-type='video-osd']";
const mediaQueryStr = 'video';

let itemId = '';

// Intercept XMLHttpRequest
const originalOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (_, url) {
this.addEventListener('load', function () {
console.log('XMLHttpRequest to:', url);
if (url.endsWith('PlaybackInfo')) {
const res = JSON.parse(this.responseText);
itemId = res.MediaSources[0].Id;
}
});
originalOpen.apply(this, arguments);
};

const displayButtonOpts = {
title: '弹幕开关',
id: 'displayDanmaku',
Expand Down Expand Up @@ -836,15 +851,8 @@
let playingInfo = null;
while (!playingInfo) {
await new Promise((resolve) => setTimeout(resolve, 200));
let sessionInfo = await ApiClient.getSessions({
userId: ApiClient.getCurrentUserId(),
deviceId: ApiClient.deviceId(),
});
if (!sessionInfo[0].NowPlayingItem) {
await new Promise(resolve => setTimeout(resolve, 150));
continue;
}
playingInfo = sessionInfo[0].NowPlayingItem;
// params: userId, itemId
playingInfo = await ApiClient.getItem("", itemId);
}
showDebugInfo('获取Item信息成功: ' + (playingInfo.SeriesName || playingInfo.Name));
return playingInfo;
Expand Down

0 comments on commit 94a0aa4

Please sign in to comment.