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"
}
}

