forked from MiczFlor/RPi-Jukebox-RFID
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow to enable/disable Cover Art in Web App & load from filesy…
…stem (MiczFlor#2352) * feat: Introduce Web App Settings * feat: Allow to enable/disable Cover Art in Web App * fix: handle Falsy mimetype and data even when APIC tag has been found my mutagen * feat: Try to load cover from filesystem when not found in audio file * fix: flake8 linting error * docs: Add documentation for Cover Art * feat: Allow show_covers setting to be managed in Web App * fix: again flake8 linting errors
- Loading branch information
Showing
16 changed files
with
283 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Cover Art | ||
|
||
## Enable/Disable Cover Art | ||
|
||
The Web App automatically searches for cover art for albums and songs. If it finds cover art, it displays it; if not, it shows a placeholder image. However, you may prefer to disable cover art (e.g. in situations where device performance is low; screen space is limited; etc). There are two ways to do this: | ||
|
||
1. **Web App Settings**: Go to the "Settings" tab. Under the "General" section, find and toggle the "Show Cover Art" option. | ||
1. **Configuration File**: Open the `jukebox.yaml` file. Navigate to `webapp` -> `show_covers`. Set this value to `true` to enable or `false` to disable cover art display. If this option does not exist, it assumes `true` as a default. | ||
|
||
## Providing Additional Cover Art | ||
|
||
Cover art can be provided in two ways: 1) embedded within the audio file itself, or 2) as a separate image file in the same directory as the audio file. The software searches for cover art in the order listed. | ||
|
||
To add cover art using the file system, place a file named `cover.jpg` in the same folder as your audio file or album. Accepted image file types are `jpg` and `png`. | ||
|
||
### Example | ||
|
||
Suppose none of your files currently include embedded cover art, the example below demonstrates how to enable cover art for an entire folder, applying the same cover art to all files within that folder. | ||
|
||
> [!IMPORTANT] | ||
> You cannot assign different cover arts to different tracks within the same folder. | ||
#### Example Folder Structure | ||
|
||
```text | ||
└── audiofolders | ||
├── Simone Sommerland | ||
│ ├── 01 Aramsamsam.mp3 | ||
│ ├── 02 Das Rote Pferd.mp3 | ||
│ ├── 03 Hoch am Himmel.mp3 | ||
│ └── cover.jpg <- Cover Art file as JPG | ||
└── Bibi und Tina | ||
├── 01 Bibi und Tina Song.mp3 | ||
├── 02 Alles geht.mp3 | ||
├── 03 Solange dein Herz spricht.mp3 | ||
└── cover.png <- Cover Art file as PNG | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { useTheme } from '@mui/material/styles'; | ||
|
||
import { | ||
Card, | ||
CardContent, | ||
CardHeader, | ||
Divider, | ||
Grid, | ||
} from '@mui/material'; | ||
import ShowCovers from './show-covers'; | ||
|
||
const SettingsGeneral = () => { | ||
const { t } = useTranslation(); | ||
const theme = useTheme(); | ||
const spacer = { marginBottom: theme.spacing(2) } | ||
|
||
return ( | ||
<Card> | ||
<CardHeader | ||
title={t('settings.general.title')} | ||
/> | ||
<Divider /> | ||
<CardContent> | ||
<Grid | ||
container | ||
direction="column" | ||
sx={{ '& > .MuiGrid-root:not(:last-child)': spacer }} | ||
> | ||
<ShowCovers /> | ||
</Grid> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default SettingsGeneral; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { useContext } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { | ||
Box, | ||
Grid, | ||
Switch, | ||
Typography, | ||
} from '@mui/material'; | ||
|
||
import AppSettingsContext from '../../../context/appsettings/context'; | ||
import request from '../../../utils/request'; | ||
|
||
const ShowCovers = () => { | ||
const { t } = useTranslation(); | ||
|
||
const { | ||
settings, | ||
setSettings, | ||
} = useContext(AppSettingsContext); | ||
|
||
const { | ||
show_covers, | ||
} = settings; | ||
|
||
const updateShowCoversSetting = async (show_covers) => { | ||
await request('setAppSettings', { settings: { show_covers }}); | ||
} | ||
|
||
const handleSwitch = (event) => { | ||
setSettings({ show_covers: event.target.checked}); | ||
updateShowCoversSetting(event.target.checked); | ||
} | ||
|
||
return ( | ||
<Grid container direction="column" justifyContent="center"> | ||
<Grid container direction="row" justifyContent="space-between" alignItems="center"> | ||
<Typography> | ||
{t(`settings.general.show_covers.title`)} | ||
</Typography> | ||
<Box sx={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
marginLeft: '0', | ||
}}> | ||
<Switch | ||
checked={show_covers} | ||
onChange={handleSwitch} | ||
/> | ||
</Box> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default ShowCovers; |
Oops, something went wrong.