Skip to content

Commit

Permalink
[PROTO-1760] Ensure UPC and ISWC are persisted top-level (#8052)
Browse files Browse the repository at this point in the history
  • Loading branch information
theoilie authored Apr 9, 2024
1 parent c31d52f commit 75fc24a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/ddex/ingester/e2e_test/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestRunE2E(t *testing.T) {
PlaylistOwnerName: stringPtr("Theo Random"),
IsAlbum: boolPtr(true),
IsPrivate: nil,
UPC: nil,
UPC: stringPtr("196871335584"),
Tracks: []common.TrackMetadata{
{
Title: "Playing With Fire.",
Expand Down Expand Up @@ -292,6 +292,7 @@ func TestRunE2E(t *testing.T) {
DDEXReleaseIDs: &common.ReleaseIDs{
ICPN: "721620118165",
},
UPC: stringPtr("721620118165"),
CopyrightLine: &common.Copyright{
Year: "2010",
Text: "(C) 2010 Iron Crown Music",
Expand Down
2 changes: 1 addition & 1 deletion packages/ddex/ingester/parser/ern38x.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ func buildAlbumMetadata(release *common.Release, mainRelease *common.ParsedRelea
PlaylistOwnerID: &mainRelease.ArtistID,
PlaylistOwnerName: &mainRelease.ArtistName,
IsAlbum: &isAlbum,
UPC: stringPtr(mainRelease.ReleaseIDs.ICPN), // ICPN is either UPC (USA/Canada) or EAN (rest of world), but we call them both UPC

// Fields we don't know the value for (except IsPrivate should come from parsing DealList)
// Description: "",
// Mood: nil,
// License: nil,
// IsPrivate: nil,
// UPC: nil,
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ddex/publisher/src/services/publisherService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const formatTrackMetadata = (
...(metadata.mood && { mood: metadata.mood as Mood }),
tags: metadata.tags || '',
isrc: metadata.isrc,
iswc: metadata.ddex_release_ids?.iswc,
license: metadata.license,
releaseDate: new Date(metadata.release_date),
ddexReleaseIds: metadata.ddex_release_ids,
Expand All @@ -42,7 +43,6 @@ const formatTrackMetadata = (
producerCopyrightLine: metadata.producer_copyright_line,
parentalWarningType: metadata.parental_warning_type,
// isUnlisted: // TODO: set visibility
// iswc:
// origFilename:
// isOriginalAvailable:
// isStreamGated:
Expand Down
1 change: 1 addition & 0 deletions packages/discovery-provider/src/api/v1/models/playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"user": fields.Nested(user_model, required=True),
"ddex_app": fields.String(allow_null=True),
"access": fields.Nested(access),
"upc": fields.String(allow_null=True),
},
)

Expand Down
4 changes: 4 additions & 0 deletions packages/discovery-provider/src/schemas/playlist_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"ddex_app": {
"type": ["string", "null"],
"default": null
},
"upc": {
"type": ["string", "null"],
"default": null
}
},
"required": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ def create_playlist(params: ManageEntityParameters):
copyright_line=params.metadata.get("copyright_line", None),
producer_copyright_line=params.metadata.get("producer_copyright_line", None),
parental_warning_type=params.metadata.get("parental_warning_type", None),
upc=params.metadata.get("upc", None),
)

update_playlist_routes_table(params, playlist_record, True)
Expand Down
2 changes: 2 additions & 0 deletions packages/discovery-provider/src/tasks/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class PlaylistMetadata(TypedDict):
is_stream_gated: Optional[bool]
stream_conditions: Optional[Any]
ddex_app: Optional[str]
upc: Optional[str]


playlist_metadata_format: PlaylistMetadata = {
Expand All @@ -197,6 +198,7 @@ class PlaylistMetadata(TypedDict):
"is_stream_gated": False,
"stream_conditions": None,
"ddex_app": None,
"upc": None,
}

# Updates cannot directly modify these fields via metadata
Expand Down

0 comments on commit 75fc24a

Please sign in to comment.