Skip to content

Commit

Permalink
Add a web page to ease the YouTube titleing of Videos
Browse files Browse the repository at this point in the history
  • Loading branch information
nicmarti committed Apr 17, 2023
1 parent 0fc0854 commit c8beb63
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 4 deletions.
20 changes: 16 additions & 4 deletions app/controllers/Publisher.scala
Expand Up @@ -37,7 +37,7 @@ object Publisher extends Controller {
def homePublisher = Action {
implicit request =>
val result = views.html.Publisher.homePublisher()
val eTag:String = Crypt.md5(result.toString() + "dvx")
val eTag: String = Crypt.md5(result.toString() + "dvx")
val maybeETag = request.headers.get(IF_NONE_MATCH)

maybeETag match {
Expand All @@ -64,6 +64,7 @@ object Publisher extends Controller {
Ok(views.html.Publisher.showAllSpeakers(speakers)).withHeaders(ETAG -> eTag)
}
}

def showSpeaker(uuid: String, name: String) = Action {
implicit request =>
val maybeSpeaker = Speaker.findByUUID(uuid)
Expand Down Expand Up @@ -132,6 +133,17 @@ object Publisher extends Controller {
}
}

def showOneRoom(room: String) = Action {
implicit request =>
Room.parse(room) match {
case Room.OTHER => NotFound("Room not found")
case roomValid => {
val allSlots = Slot.fillWithFillers(ScheduleConfiguration.getPublishedScheduleByRoom(roomValid.id, None))
Ok(views.html.Publisher.showOneRoom(allSlots, Room.allAsId, roomValid))
}
}
}

def showDetailsForProposal(proposalId: String, proposalTitle: String, secretPublishKey: Option[String] = None) =
Action {
implicit request =>
Expand All @@ -157,17 +169,17 @@ object Publisher extends Controller {

import play.api.libs.concurrent.Execution.Implicits.defaultContext

ElasticSearchPublisher.doPublisherSearch(q, p).map{
ElasticSearchPublisher.doPublisherSearch(q, p).map {
case Left(failure) => InternalServerError("Unable to search on ElasticSearch " + failure.error)
case Right(results) =>
import library.search.ProposalSearchResult.ProposalHitReader

val total=results.totalHits
val total = results.totalHits
Ok(views.html.Publisher.searchResult(total, results.to[ProposalSearchResult], q, p)).as("text/html")
}
}

def committee()= Action {
def committee() = Action {
implicit request =>
val allMembers = Speaker.allCFPMembers()
Ok(views.html.Publisher.committee(allMembers))
Expand Down
13 changes: 13 additions & 0 deletions app/models/ScheduleConfiguration.scala
Expand Up @@ -164,6 +164,19 @@ object ScheduleConfiguration {
listOfSlots.sortBy(_.from.getMillis)
}

def getPublishedScheduleByRoom(roomId: String, secretPublishKey: Option[String] = None): List[Slot] = {

def extractSlot(allSlots: List[Slot]) = {
val configured = loadSlots(secretPublishKey).filter(_.roomId == roomId)
val filtered = allSlots.filterNot(s => s.isAllocatableSlot)
configured ++ filtered
}

val listOfSlots = extractSlot(ConferenceDescriptor.ConferenceSlots.all)

listOfSlots.sortBy(_.from.getMillis)
}

def loadSlots(secretPublishKey: Option[String]): List[Slot] = {
ConferenceDescriptor.ConferenceProposalTypes.ALL.flatMap {
t: ProposalType => loadSlotsForConfType(t.id, secretPublishKey)
Expand Down
65 changes: 65 additions & 0 deletions app/views/Publisher/showOneRoom.scala.html
@@ -0,0 +1,65 @@
@(slots: List[Slot], rooms: Seq[(String, String)], room: Room)(implicit lang: Lang, req: RequestHeader, flash: Flash)
@import org.apache.commons.lang3.StringUtils
@views.html.Publisher.devoxxFR2020(Messages(s"Details for $room")) {

<div class="large-12 columns">
<h1 class="entry-title">Room @room.name</h1>

<p class="breadcrumb hide-on-print"><a href="@routes.Publisher.homePublisher()">@Messages("sw.home")</a> &gt;
@rooms.map { currentRoom =>
<a href="@routes.Publisher.showOneRoom(currentRoom._1)">@currentRoom._2</a> -
}

</p>
</div>

<div class="columns large-12 woocommerce">
<table class="agendaTable skip-mb-on-print">
@slots.groupBy(s => s.from.getMillis).toList.sortWith(_._1 < _._1).map { case (_, subSlots) =>
<tr>
<th class="timeSlot">
@subSlots.head.from.toDateTime(ConferenceDescriptor.current().timezone).toString("EEE HH:mm")
- @subSlots.head.to.toDateTime(ConferenceDescriptor.current().timezone).toString("EEE HH:mm")
</th>

@subSlots.map { zeSlot =>
@if(zeSlot.notAllocated && !zeSlot.isFiller) {
<td class="proposal tba">&nbsp;</td>
}
@if(zeSlot.break.isDefined || zeSlot.isFiller) {
@* nothing to do.. we're on a filler *@
} else {
@zeSlot.proposal.map { p: Proposal =>
<td class="skip-max-width-on-divs proposal">
<div class="content">

<h4>@StringUtils.abbreviate(p.title, 99)</h4>
<h5>@Messages(p.talkType.id)</h5>

<div class="text-sm text-left">
@if(p.title.length>99) { Titre complet : @p.title } <br>
@p.allSpeakers.map { speaker =>
<strong>@speaker.cleanFirstName @speaker.cleanLastName</strong>
@if(speaker.company.isDefined) { @speaker.company.get}
}
<br>
@p.summary

</div>
<div class="mt-5">
<br>
<br>
Début du code Viparis pour retrouver le bon fichier vidéo : <br>
DEVOXX-2023-@room.name.replaceAll(" ", "_")_2023@subSlots.head.from.toDateTime(ConferenceDescriptor.current().timezone).toString("MMdd-HHmm")
</div>
</div>
</td>
}
}
}
</tr>
}
</table>
</div>

}
1 change: 1 addition & 0 deletions conf/routes
Expand Up @@ -221,6 +221,7 @@ GET /2023/talk/:proposalId/:proposalTitle
GET /2023/talks controllers.Publisher.homePublisher()
GET /2023/index.html controllers.Publisher.homePublisher()
GET /2023/byday/:day controllers.Publisher.showByDay(day:String, secretPublishKey:Option[String] ?=None, hideUselessRooms:Boolean ?=true, includeTypes:Option[String] ?=None, excludeTypes:Option[String] ?=Some("bof"))
GET /2023/byroom controllers.Publisher.showOneRoom(room:String ?="b_amphi")
GET /2023/search controllers.Publisher.search(q:Option[String] ?=None,p:Option[Int] ?=None)
GET /2023/committee.html controllers.Publisher.committee()

Expand Down

0 comments on commit c8beb63

Please sign in to comment.