api/soundcloud: add more metadata support

This commit is contained in:
nexpid 2025-06-02 22:51:11 +02:00
parent 19c036494f
commit 55bcc66cda
No known key found for this signature in database
GPG Key ID: CF60FCAF668E3F3F
4 changed files with 27 additions and 10 deletions

View File

@ -113,9 +113,17 @@ export default async function(obj) {
if (!file) return { error: "fetch.empty" }; if (!file) return { error: "fetch.empty" };
const title = json.title.trim();
const artist = json.user.username.trim();
const fileMetadata = { const fileMetadata = {
title: json.title.trim(), title,
artist: json.user.username.trim(), album: json.publisher_metadata.album_title?.trim() ?? title,
artist,
album_artist: artist,
composer: json.publisher_metadata.writer_composer?.trim(),
genre: json.genre.trim(),
date: json.display_date.slice(0, 4),
copyright: json.license.trim(),
} }
return { return {

View File

@ -17,9 +17,12 @@ const ffmpegArgs = {
const metadataTags = [ const metadataTags = [
"album", "album",
"composer",
"genre",
"copyright", "copyright",
"title", "title",
"artist", "artist",
"album_artist",
"track", "track",
"date", "date",
]; ];

View File

@ -130,13 +130,16 @@ the response will always be a JSON object containing the `status` key, which is
all keys in this table are optional. all keys in this table are optional.
| key | type | description | | key | type | description |
|:------------|:---------|:-------------------------------------------| |:---------------|:---------|:-------------------------------------------|
| `album` | `string` | album name or collection title | | `album` | `string` | album name or collection title |
| `composer` | `string` | composter of the track |
| `genre` | `string` | genre or genres of the track |
| `copyright` | `string` | copyright information or ownership details | | `copyright` | `string` | copyright information or ownership details |
| `title` | `string` | title of the track or media file | | `title` | `string` | title of the track or media file |
| `artist` | `string` | artist or creator name | | `artist` | `string` | artist or creator name |
| `album_artist` | `string` | artist or creator name of the album |
| `track` | `string` | track number or position in album | | `track` | `string` | track number or position in album |
| `date` | `string` | release date or creation date | | `date` | `string` | release year or creation year |
#### audio object #### audio object
| key | type | value | | key | type | value |

View File

@ -45,9 +45,12 @@ type CobaltTunnelResponse = {
export const CobaltFileMetadataKeys = [ export const CobaltFileMetadataKeys = [
'album', 'album',
'composer',
'genre',
'copyright', 'copyright',
'title', 'title',
'artist', 'artist',
'album_artist',
'track', 'track',
'date' 'date'
]; ];