Browse Source

Replace placeholder with png

master
jeffvli 3 years ago
parent
commit
36792f777d
  1. 6
      src/api/api.ts
  2. 2
      src/api/jellyfinApi.ts
  3. 2
      src/components/player/PlayerBar.tsx
  4. 4
      src/components/playlist/PlaylistView.tsx
  5. BIN
      src/img/placeholder.jpg
  6. BIN
      src/img/placeholder.png

6
src/api/api.ts

@ -85,7 +85,7 @@ axiosRetry(api, {
const getCoverArtUrl = (item: any, useLegacyAuth: boolean, size?: number) => { const getCoverArtUrl = (item: any, useLegacyAuth: boolean, size?: number) => {
if (!item.coverArt && !item.artistImageUrl) { if (!item.coverArt && !item.artistImageUrl) {
return 'img/placeholder.jpg'; return 'img/placeholder.png';
} }
if (!item.coverArt && !item.artistImageUrl?.match('2a96cbd8b46e442fc41c2b86b821562f')) { if (!item.coverArt && !item.artistImageUrl?.match('2a96cbd8b46e442fc41c2b86b821562f')) {
@ -93,7 +93,7 @@ const getCoverArtUrl = (item: any, useLegacyAuth: boolean, size?: number) => {
} }
if (item.artistImageUrl?.match('2a96cbd8b46e442fc41c2b86b821562f')) { if (item.artistImageUrl?.match('2a96cbd8b46e442fc41c2b86b821562f')) {
return 'img/placeholder.jpg'; return 'img/placeholder.png';
} }
if (useLegacyAuth) { if (useLegacyAuth) {
@ -256,7 +256,7 @@ const normalizePlaylist = (item: any) => {
duration: item.duration, duration: item.duration,
created: item.created, created: item.created,
changed: item.changed, changed: item.changed,
image: item.songCount > 0 ? getCoverArtUrl(item, legacyAuth, 350) : 'img/placeholder.jpg', image: item.songCount > 0 ? getCoverArtUrl(item, legacyAuth, 350) : 'img/placeholder.png',
type: Item.Playlist, type: Item.Playlist,
uniqueId: nanoid(), uniqueId: nanoid(),
song: (item.entry || []).map((entry: any) => normalizeSong(entry)), song: (item.entry || []).map((entry: any) => normalizeSong(entry)),

2
src/api/jellyfinApi.ts

@ -71,7 +71,7 @@ const getStreamUrl = (id: string) => {
const getCoverArtUrl = (item: any, size?: number) => { const getCoverArtUrl = (item: any, size?: number) => {
if (!item.ImageTags?.Primary) { if (!item.ImageTags?.Primary) {
return 'img/placeholder.jpg'; return 'img/placeholder.png';
} }
return ( return (

2
src/components/player/PlayerBar.tsx

@ -28,7 +28,7 @@ import { setStatus, resetPlayer } from '../../redux/playerSlice';
import { useAppDispatch, useAppSelector } from '../../redux/hooks'; import { useAppDispatch, useAppSelector } from '../../redux/hooks';
import Player from './Player'; import Player from './Player';
import CustomTooltip from '../shared/CustomTooltip'; import CustomTooltip from '../shared/CustomTooltip';
import placeholderImg from '../../img/placeholder.jpg'; import placeholderImg from '../../img/placeholder.png';
import DebugWindow from '../debug/DebugWindow'; import DebugWindow from '../debug/DebugWindow';
import { CoverArtWrapper } from '../layout/styled'; import { CoverArtWrapper } from '../layout/styled';
import { getCurrentEntryList, isCached } from '../../shared/utils'; import { getCurrentEntryList, isCached } from '../../shared/utils';

4
src/components/playlist/PlaylistView.tsx

@ -99,7 +99,7 @@ const PlaylistView = ({ ...rest }) => {
); );
const [customPlaylistImage, setCustomPlaylistImage] = useState<string | string[]>( const [customPlaylistImage, setCustomPlaylistImage] = useState<string | string[]>(
'img/placeholder.jpg' 'img/placeholder.png'
); );
const [editName, setEditName] = useState(''); const [editName, setEditName] = useState('');
const [editDescription, setEditDescription] = useState(''); const [editDescription, setEditDescription] = useState('');
@ -477,7 +477,7 @@ const PlaylistView = ({ ...rest }) => {
const uniqueAlbums: any = _.uniqBy(data?.song, 'albumId'); const uniqueAlbums: any = _.uniqBy(data?.song, 'albumId');
if (uniqueAlbums.length === 0) { if (uniqueAlbums.length === 0) {
setCustomPlaylistImage('img/placeholder.jpg'); setCustomPlaylistImage('img/placeholder.png');
} // If less than 4 images, we'll just set a single random image } // If less than 4 images, we'll just set a single random image
else if (uniqueAlbums.length > 0 && uniqueAlbums.length < 4) { else if (uniqueAlbums.length > 0 && uniqueAlbums.length < 4) {
setCustomPlaylistImage(uniqueAlbums[_.random(0, uniqueAlbums.length - 1)]?.image); setCustomPlaylistImage(uniqueAlbums[_.random(0, uniqueAlbums.length - 1)]?.image);

BIN
src/img/placeholder.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

BIN
src/img/placeholder.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Loading…
Cancel
Save