Page 1 of 1

[Script] Set Jellyfin DateCreated property

Posted: 29 Sep 2025, 12:23
by rednoah
This post-processing script will set the DateCreated property via the Jellyfin API after moving / renaming files with FileBot:

Groovy: Select all

def host = '127.0.0.1'
def port = 8096
def auth = 'YOUR_API_KEY'

// refresh and wait
curl "http://${host}:${port}/Library/Refresh", [:], Authorization: "MediaBrowser Token=$auth"
sleep 15000

// get all items
def r = curl "http://$host:$port/Items?Recursive=true&Fields=Path,Genres,SortName,Studios,Writer,Taglines,LocalTrailerCount,OfficialRating,CumulativeRunTimeTicks,ItemCounts,Metascore,AirTime,DateCreated,People,Overview,CriticRating,CriticRatingSummary,Etag,ShortOverview,ProductionLocations,Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers,MediaSources,VoteCount,RecursiveItemCount,PrimaryImageAspectRatio", Authorization: "MediaBrowser Token=$auth"

// index items by folder name / file name
def index = r.Items.findAll{ it.MediaType == 'Video' }.groupBy{ it.Path.toFile().getRelativePathTail(2) }

model.each{ source, target ->
	// lookup item by folder name / file name
	index[target.getRelativePathTail(2)].each{
		it.DateCreated = d.format(/yyyy-MM-dd/)
		// update item
		curl "http://$host:$port/Items/$it.Id", it, Authorization: "MediaBrowser Token=$auth"
	}
}



:idea: Updating tags with API fails and corrupts item until rescan

:idea: jellyfin_apiclient_python/api.py#L24