1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #1328 from MrTimscampi/epub-format-detection

Add format checking to EPUB player
This commit is contained in:
dkanada 2020-05-31 13:59:30 +09:00 committed by GitHub
commit 3abb89463f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 22 deletions

View file

@ -215,24 +215,7 @@ export class BookPlayer {
Id: item.Id Id: item.Id
} }
}; };
if (!item.Path.endsWith('.epub')) {
return new Promise((resolve, reject) => {
let errorDialog = dialogHelper.createDialog({
size: 'small',
autoFocus: false,
removeOnClose: true
});
errorDialog.innerHTML = '<h1 class="bookplayerErrorMsg">This book type is not supported yet</h1>';
this.stop();
dialogHelper.open(errorDialog);
loading.hide();
return resolve();
});
}
let serverId = item.ServerId; let serverId = item.ServerId;
let apiClient = connectionManager.getApiClient(serverId); let apiClient = connectionManager.getApiClient(serverId);
@ -283,6 +266,13 @@ export class BookPlayer {
canPlayMediaType(mediaType) { canPlayMediaType(mediaType) {
return (mediaType || '').toLowerCase() === 'book'; return (mediaType || '').toLowerCase() === 'book';
} }
canPlayItem(item) {
if (item.Path && (item.Path.endsWith('epub'))) {
return true;
}
return false;
}
} }
export default BookPlayer; export default BookPlayer;

View file

@ -229,7 +229,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
var options = { var options = {
Limit: limit, Limit: limit,
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo', Fields: 'PrimaryImageAspectRatio,BasicSyncInfo,Path',
ImageTypeLimit: 1, ImageTypeLimit: 1,
EnableImageTypes: 'Primary,Backdrop,Thumb', EnableImageTypes: 'Primary,Backdrop,Thumb',
ParentId: parentId ParentId: parentId
@ -667,7 +667,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
var apiClient = connectionManager.getApiClient(serverId); var apiClient = connectionManager.getApiClient(serverId);
return apiClient.getNextUpEpisodes({ return apiClient.getNextUpEpisodes({
Limit: enableScrollX() ? 24 : 15, Limit: enableScrollX() ? 24 : 15,
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo', Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
UserId: apiClient.getCurrentUserId(), UserId: apiClient.getCurrentUserId(),
ImageTypeLimit: 1, ImageTypeLimit: 1,
EnableImageTypes: 'Primary,Backdrop,Banner,Thumb', EnableImageTypes: 'Primary,Backdrop,Banner,Thumb',

View file

@ -1129,7 +1129,6 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
} }
self.canPlay = function (item) { self.canPlay = function (item) {
var itemType = item.Type; var itemType = item.Type;
if (itemType === 'PhotoAlbum' || itemType === 'MusicGenre' || itemType === 'Season' || itemType === 'Series' || itemType === 'BoxSet' || itemType === 'MusicAlbum' || itemType === 'MusicArtist' || itemType === 'Playlist') { if (itemType === 'PhotoAlbum' || itemType === 'MusicGenre' || itemType === 'Season' || itemType === 'Series' || itemType === 'BoxSet' || itemType === 'MusicAlbum' || itemType === 'MusicArtist' || itemType === 'Playlist') {
@ -1143,7 +1142,6 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
} }
if (itemType === 'Program') { if (itemType === 'Program') {
if (!item.EndDate || !item.StartDate) { if (!item.EndDate || !item.StartDate) {
return false; return false;
} }

View file

@ -308,7 +308,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
return apiClient.getItems(apiClient.getCurrentUserId(), modifyQueryWithFilters(instance, { return apiClient.getItems(apiClient.getCurrentUserId(), modifyQueryWithFilters(instance, {
StartIndex: startIndex, StartIndex: startIndex,
Limit: limit, Limit: limit,
Fields: 'PrimaryImageAspectRatio,SortName', Fields: 'PrimaryImageAspectRatio,SortName,Path',
ImageTypeLimit: 1, ImageTypeLimit: 1,
ParentId: item.Id, ParentId: item.Id,
SortBy: sortBy SortBy: sortBy