Adding artwork in TV app

I recently upgraded from Mojave to Big Sur, and am having trouble adding artwork to tracks in the TV app. This script (or variations thereof) worked just fine in iTunes:


set theFile to choose file
set trackArtwork to (read theFile as JPEG picture)
set the clipboard to trackArtwork
tell application "TV"
	set theTrack to item 1 of selection
	set data of artwork 1 of theTrack to trackArtwork
end tell

With TV, I get this error message: error “TV got an error: Unknown object type.” number -1731

I know that the image is being read properly, because I can copy it onto the clipboard (as written above) and paste it manually into the track.

Any help would be greatly appreciated. Thanks.

I don’t have your OS to test, but this may work:

tell application "TV" to set (selection's item 1)'s artwork 1's data to read my (choose file of type "JPG") as «class data»