in app/model/commands/PublishAtomCommand.scala [161:185]
private def updateYouTube(publishedAtom: Option[MediaAtom], previewAtom: MediaAtom, asset: Asset): Future[MediaAtom] = {
previewAtom.channelId match {
case Some(channel) if youtube.allChannels.contains(channel) =>
if (youtube.usePartnerApi) {
createOrUpdateYoutubeClaim(publishedAtom, previewAtom, asset)
}
updateYoutubeMetadata(previewAtom, asset)
updateYoutubeThumbnail(previewAtom, asset).recover {
case e: Throwable =>
log.error("failed to update thumbnail; skipping", e)
previewAtom
}
case Some(_) =>
// third party YouTube video that we do not have permission to edit
Future.successful(previewAtom)
case None if youtube.cannotReachYoutube =>
// the atom will be missing a channel because we couldn't query YouTube at all
Future.successful(previewAtom)
case None =>
AtomPublishFailed("Atom missing YouTube channel")
}
}