Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from src.models.users.user import User
from src.tasks.entity_manager.utils import (
CHARACTER_LIMIT_DESCRIPTION,
CHARACTER_LIMIT_GENRE,
TRACK_ID_OFFSET,
Action,
EntityType,
Expand All @@ -45,7 +46,6 @@
)
from src.tasks.task_helpers import generate_slug_and_collision_id
from src.utils import helpers
from src.utils.hardcoded_data import genre_allowlist
from src.utils.structured_logger import StructuredLogger

logger = StructuredLogger(__name__)
Expand Down Expand Up @@ -534,9 +534,9 @@ def validate_track_tx(params: ManageEntityParameters):
)
track_bio = params.metadata.get("description")
track_genre = params.metadata.get("genre")
if track_genre is not None and track_genre not in genre_allowlist:
if track_genre is not None and len(track_genre) > CHARACTER_LIMIT_GENRE:
raise IndexingValidationError(
f"Track {track_id} attempted to be placed in genre '{track_genre}' which is not in the allow list"
f"Track {track_id} genre exceeds character limit {CHARACTER_LIMIT_GENRE}"
)
if track_bio is not None and len(track_bio) > CHARACTER_LIMIT_DESCRIPTION:
raise IndexingValidationError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
# limits
CHARACTER_LIMIT_USER_BIO = 256
CHARACTER_LIMIT_DESCRIPTION = 2500
CHARACTER_LIMIT_GENRE = 100
PLAYLIST_TRACK_LIMIT = 5000
COMMENT_BODY_LIMIT = 400

Expand Down
4 changes: 4 additions & 0 deletions packages/discovery-provider/src/utils/hardcoded_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def has_badwords(s: str) -> bool:
return any(badword in f for badword in handle_badwords_lower)


# Known/canonical genres. No longer enforced as an allowlist at write time —
# track genres can be arbitrary strings (capped at CHARACTER_LIMIT_GENRE).
# Still used by trending (index_trending.py) and genre metrics
# (get_genre_metrics.py) to scope read-side aggregations to canonical values.
genre_allowlist = {
"Acoustic",
"Alternative",
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/src/sdk/api/albums/AlbumsApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
import { SolanaClient } from '../../services/Solana/programs/SolanaClient'
import { Storage } from '../../services/Storage'
import { StorageNodeSelector } from '../../services/StorageNodeSelector'
import { Configuration, Genre, Mood } from '../generated/default'
import { Genre } from '../../types/Genre'
import { Configuration, Mood } from '../generated/default'
import { PlaylistsApi as GeneratedPlaylistsApi } from '../generated/default/apis/PlaylistsApi'
import type { PlaylistResponse } from '../generated/default/models/PlaylistResponse'
import { TrackUploadHelper } from '../tracks/TrackUploadHelper'
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/sdk/api/albums/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { PublicKeySchema } from '../../services/Solana'
import { DDEXResourceContributor, DDEXCopyright } from '../../types/DDEX'
import { AudioFile, ImageFile } from '../../types/File'
import { HashId } from '../../types/HashId'
import { Mood, Genre } from '../generated/default'
import { Mood } from '../generated/default'
import type {
CreatePlaylistRequestBody,
UpdatePlaylistRequestBody
Expand Down Expand Up @@ -159,7 +159,7 @@ export const CreateAlbumSchema = z
export type EntityManagerCreateAlbumRequest = z.input<typeof CreateAlbumSchema>

export const UploadAlbumMetadataSchema = CreateAlbumMetadataSchema.extend({
genre: z.enum(Object.values(Genre) as [Genre, ...Genre[]]),
genre: z.string().min(1).max(100),
mood: z.optional(z.enum(Object.values(Mood) as [Mood, ...Mood[]])),
tags: z.optional(z.string())
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ models/FollowNotificationAction.ts
models/FollowNotificationActionData.ts
models/FollowersResponse.ts
models/FollowingResponse.ts
models/Genre.ts
models/GetChallenges.ts
models/GetSupportedUsers.ts
models/GetSupporter.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ import {
DdexResourceContributorFromJSONTyped,
DdexResourceContributorToJSON,
} from './DdexResourceContributor';
import type { Genre } from './Genre';
import {
GenreFromJSON,
GenreFromJSONTyped,
GenreToJSON,
} from './Genre';
import type { Mood } from './Mood';
import {
MoodFromJSON,
Expand Down Expand Up @@ -93,11 +87,20 @@ export interface CreatePlaylistRequestBody {
*/
isAlbum?: boolean;
/**
* Music genre. Any string up to 100 characters is accepted. Known/canonical
* values (shown as autocomplete suggestions in clients): Electronic, Rock,
* Metal, Alternative, Hip-Hop/Rap, Experimental, Punk, Folk, Pop, Ambient,
* Soundtrack, World, Jazz, Acoustic, Funk, R&B/Soul, Devotional, Classical,
* Reggae, Podcasts, Country, Spoken Word, Comedy, Blues, Kids, Audiobooks,
* Latin, Lo-Fi, Hyperpop, Dancehall, Techno, Trap, House, Tech House,
* Deep House, Disco, Electro, Jungle, Progressive House, Hardstyle,
* Glitch Hop, Trance, Future Bass, Future House, Tropical House, Downtempo,
* Drum & Bass, Dubstep, Jersey Club, Vaporwave, Moombahton.
*
* @type {Genre}
* @type {string}
* @memberof CreatePlaylistRequestBody
*/
genre?: Genre;
genre?: string;
/**
*
* @type {Mood}
Expand Down Expand Up @@ -227,7 +230,7 @@ export function CreatePlaylistRequestBodyFromJSONTyped(json: any, ignoreDiscrimi
'description': !exists(json, 'description') ? undefined : json['description'],
'isPrivate': !exists(json, 'is_private') ? undefined : json['is_private'],
'isAlbum': !exists(json, 'is_album') ? undefined : json['is_album'],
'genre': !exists(json, 'genre') ? undefined : GenreFromJSON(json['genre']),
'genre': !exists(json, 'genre') ? undefined : json['genre'],
'mood': !exists(json, 'mood') ? undefined : MoodFromJSON(json['mood']),
'tags': !exists(json, 'tags') ? undefined : json['tags'],
'license': !exists(json, 'license') ? undefined : json['license'],
Expand Down Expand Up @@ -262,7 +265,7 @@ export function CreatePlaylistRequestBodyToJSON(value?: CreatePlaylistRequestBod
'description': value.description,
'is_private': value.isPrivate,
'is_album': value.isAlbum,
'genre': GenreToJSON(value.genre),
'genre': value.genre,
'mood': MoodToJSON(value.mood),
'tags': value.tags,
'license': value.license,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ import {
FieldVisibilityFromJSONTyped,
FieldVisibilityToJSON,
} from './FieldVisibility';
import type { Genre } from './Genre';
import {
GenreFromJSON,
GenreFromJSONTyped,
GenreToJSON,
} from './Genre';
import type { Mood } from './Mood';
import {
MoodFromJSON,
Expand Down Expand Up @@ -93,11 +87,20 @@ export interface CreateTrackRequestBody {
*/
title: string;
/**
* Music genre. Any string up to 100 characters is accepted. Known/canonical
* values (shown as autocomplete suggestions in clients): Electronic, Rock,
* Metal, Alternative, Hip-Hop/Rap, Experimental, Punk, Folk, Pop, Ambient,
* Soundtrack, World, Jazz, Acoustic, Funk, R&B/Soul, Devotional, Classical,
* Reggae, Podcasts, Country, Spoken Word, Comedy, Blues, Kids, Audiobooks,
* Latin, Lo-Fi, Hyperpop, Dancehall, Techno, Trap, House, Tech House,
* Deep House, Disco, Electro, Jungle, Progressive House, Hardstyle,
* Glitch Hop, Trance, Future Bass, Future House, Tropical House, Downtempo,
* Drum & Bass, Dubstep, Jersey Club, Vaporwave, Moombahton.
*
* @type {Genre}
* @type {string}
* @memberof CreateTrackRequestBody
*/
genre: Genre;
genre: string;
/**
* Track description
* @type {string}
Expand Down Expand Up @@ -370,7 +373,7 @@ export function CreateTrackRequestBodyFromJSONTyped(json: any, ignoreDiscriminat

'trackId': !exists(json, 'track_id') ? undefined : json['track_id'],
'title': json['title'],
'genre': GenreFromJSON(json['genre']),
'genre': json['genre'],
'description': !exists(json, 'description') ? undefined : json['description'],
'mood': !exists(json, 'mood') ? undefined : MoodFromJSON(json['mood']),
'bpm': !exists(json, 'bpm') ? undefined : json['bpm'],
Expand Down Expand Up @@ -426,7 +429,7 @@ export function CreateTrackRequestBodyToJSON(value?: CreateTrackRequestBody | nu

'track_id': value.trackId,
'title': value.title,
'genre': GenreToJSON(value.genre),
'genre': value.genre,
'description': value.description,
'mood': MoodToJSON(value.mood),
'bpm': value.bpm,
Expand Down
87 changes: 0 additions & 87 deletions packages/sdk/src/sdk/api/generated/default/models/Genre.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ import {
DdexResourceContributorFromJSONTyped,
DdexResourceContributorToJSON,
} from './DdexResourceContributor';
import type { Genre } from './Genre';
import {
GenreFromJSON,
GenreFromJSONTyped,
GenreToJSON,
} from './Genre';
import type { Mood } from './Mood';
import {
MoodFromJSON,
Expand Down Expand Up @@ -87,11 +81,20 @@ export interface UpdatePlaylistRequestBody {
*/
isAlbum?: boolean;
/**
* Music genre. Any string up to 100 characters is accepted. Known/canonical
* values (shown as autocomplete suggestions in clients): Electronic, Rock,
* Metal, Alternative, Hip-Hop/Rap, Experimental, Punk, Folk, Pop, Ambient,
* Soundtrack, World, Jazz, Acoustic, Funk, R&B/Soul, Devotional, Classical,
* Reggae, Podcasts, Country, Spoken Word, Comedy, Blues, Kids, Audiobooks,
* Latin, Lo-Fi, Hyperpop, Dancehall, Techno, Trap, House, Tech House,
* Deep House, Disco, Electro, Jungle, Progressive House, Hardstyle,
* Glitch Hop, Trance, Future Bass, Future House, Tropical House, Downtempo,
* Drum & Bass, Dubstep, Jersey Club, Vaporwave, Moombahton.
*
* @type {Genre}
* @type {string}
* @memberof UpdatePlaylistRequestBody
*/
genre?: Genre;
genre?: string;
/**
*
* @type {Mood}
Expand Down Expand Up @@ -219,7 +222,7 @@ export function UpdatePlaylistRequestBodyFromJSONTyped(json: any, ignoreDiscrimi
'description': !exists(json, 'description') ? undefined : json['description'],
'isPrivate': !exists(json, 'is_private') ? undefined : json['is_private'],
'isAlbum': !exists(json, 'is_album') ? undefined : json['is_album'],
'genre': !exists(json, 'genre') ? undefined : GenreFromJSON(json['genre']),
'genre': !exists(json, 'genre') ? undefined : json['genre'],
'mood': !exists(json, 'mood') ? undefined : MoodFromJSON(json['mood']),
'tags': !exists(json, 'tags') ? undefined : json['tags'],
'license': !exists(json, 'license') ? undefined : json['license'],
Expand Down Expand Up @@ -253,7 +256,7 @@ export function UpdatePlaylistRequestBodyToJSON(value?: UpdatePlaylistRequestBod
'description': value.description,
'is_private': value.isPrivate,
'is_album': value.isAlbum,
'genre': GenreToJSON(value.genre),
'genre': value.genre,
'mood': MoodToJSON(value.mood),
'tags': value.tags,
'license': value.license,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ import {
FieldVisibilityFromJSONTyped,
FieldVisibilityToJSON,
} from './FieldVisibility';
import type { Genre } from './Genre';
import {
GenreFromJSON,
GenreFromJSONTyped,
GenreToJSON,
} from './Genre';
import type { Mood } from './Mood';
import {
MoodFromJSON,
Expand Down Expand Up @@ -63,11 +57,20 @@ export interface UpdateTrackRequestBody {
*/
title?: string;
/**
* Music genre. Any string up to 100 characters is accepted. Known/canonical
* values (shown as autocomplete suggestions in clients): Electronic, Rock,
* Metal, Alternative, Hip-Hop/Rap, Experimental, Punk, Folk, Pop, Ambient,
* Soundtrack, World, Jazz, Acoustic, Funk, R&B/Soul, Devotional, Classical,
* Reggae, Podcasts, Country, Spoken Word, Comedy, Blues, Kids, Audiobooks,
* Latin, Lo-Fi, Hyperpop, Dancehall, Techno, Trap, House, Tech House,
* Deep House, Disco, Electro, Jungle, Progressive House, Hardstyle,
* Glitch Hop, Trance, Future Bass, Future House, Tropical House, Downtempo,
* Drum & Bass, Dubstep, Jersey Club, Vaporwave, Moombahton.
*
* @type {Genre}
* @type {string}
* @memberof UpdateTrackRequestBody
*/
genre?: Genre;
genre?: string;
/**
* Track description
* @type {string}
Expand Down Expand Up @@ -264,7 +267,7 @@ export function UpdateTrackRequestBodyFromJSONTyped(json: any, ignoreDiscriminat
return {

'title': !exists(json, 'title') ? undefined : json['title'],
'genre': !exists(json, 'genre') ? undefined : GenreFromJSON(json['genre']),
'genre': !exists(json, 'genre') ? undefined : json['genre'],
'description': !exists(json, 'description') ? undefined : json['description'],
'mood': !exists(json, 'mood') ? undefined : MoodFromJSON(json['mood']),
'bpm': !exists(json, 'bpm') ? undefined : json['bpm'],
Expand Down Expand Up @@ -307,7 +310,7 @@ export function UpdateTrackRequestBodyToJSON(value?: UpdateTrackRequestBody | nu
return {

'title': value.title,
'genre': GenreToJSON(value.genre),
'genre': value.genre,
'description': value.description,
'mood': MoodToJSON(value.mood),
'bpm': value.bpm,
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/sdk/api/generated/default/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export * from './FollowNotificationAction';
export * from './FollowNotificationActionData';
export * from './FollowersResponse';
export * from './FollowingResponse';
export * from './Genre';
export * from './GetChallenges';
export * from './GetSupportedUsers';
export * from './GetSupporter';
Expand Down
Loading
Loading