Files
wp-amnp/README.MD
2025-06-23 15:15:42 -07:00

86 lines
1.9 KiB
Markdown

# AmNP For Wordpress
---
## Features
* REST API endpoint for now playing data & separate endpoint for artwork updates
* Bearer authentication
* Admin panel for key management
* Shortcode: `[now-playing-widget]`
* Sidebar/Footer widget support
* Graceful fallback for NoScript peeps
---
## REST API Endpoints
| Endpoint | Method | Description |
| --------------------------------------- | ------ | ---------------------------- |
| `/wp-json/nowplaying/v1/update` | `POST` | Updates now playing metadata |
| `/wp-json/nowplaying/v1/update/artwork` | `POST` | Updates album artwork |
All requests must include an `Authorization` header in the format:
```
Authorization: Bearer 73757065725f7365637572655f746f6b656e
```
---
## Admin Setup
After installing the plugin:
1. Go to **Settings -> Now Playing API**
2. Set or generate a secure 64-character API key
3. Use the displayed endpoint URLs for POST requests from the [AmNP Extention](https://git.oldgate.org/amnp/ext-amnp)
---
## Usage
### Shortcode
Add the widget to any post or page using:
```
[now-playing-widget]
```
### Widget
Go to **Appearance → Widgets**, then drag the **Now Playing Widget** into your sidebar or footer.
### Example of Widget
![Widget showing from my website playing: Misician by Porter Robinson ](https://share.aatkinson.org/nirO5/wuQAWePU81.png/raw)
---
## Output
The widget displays:
* Album artwork (and when you hover over it, it shows the album name!)
* Song title
* Artist name
* Playback status
* Progress bar and time
If JavaScript is disabled, a static fallback will display the last known song and artwork.
---
## File Output
Two JSON files are saved to the plugin directory:
* `nowplaying.json` -> song metadata
* `nowplaying-art.json` -> album artwork (base64 or URL)
---
## License
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).