in ProxyStatsGathering/src/main/scala/StreamComponents/FileTypeWantProxyBranch.scala [25:100]
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic =
new GraphStageLogic(shape) {
setHandler(in, new AbstractInHandler {
override def onPush(): Unit = {
val elem = grab(in)
println(s"${elem.path} has file extension ${elem.file_extension.map(_.toLowerCase)}")
elem.file_extension.map(_.toLowerCase) match {
case None=>
push(outNo, ProxyVerifyResult(elem.id, ProxyType.UNKNOWN,esRecordSays=elem.proxied, wantProxy = false))
case Some(xtn)=>
if(shouldProxyExtensionsVideo.contains(xtn)){
push(outVideo, ProxyVerifyResult(elem.id, ProxyType.VIDEO,esRecordSays=elem.proxied, wantProxy = true))
push(outAudio, ProxyVerifyResult(elem.id, ProxyType.AUDIO, esRecordSays=elem.proxied, wantProxy = false))
push(outThumb, ProxyVerifyResult(elem.id, ProxyType.THUMBNAIL, esRecordSays=elem.proxied, wantProxy = true))
} else if(shouldProxyExtensionsAudio.contains(xtn)){
push(outVideo, ProxyVerifyResult(elem.id, ProxyType.VIDEO,esRecordSays=elem.proxied, wantProxy = false))
push(outAudio, ProxyVerifyResult(elem.id, ProxyType.AUDIO, esRecordSays=elem.proxied, wantProxy = true))
push(outThumb, ProxyVerifyResult(elem.id, ProxyType.THUMBNAIL,esRecordSays=elem.proxied, wantProxy = true))
} else if(shouldProxyExtensionsThumb.contains(xtn)){
push(outVideo, ProxyVerifyResult(elem.id, ProxyType.VIDEO, esRecordSays=elem.proxied, wantProxy = false))
push(outAudio, ProxyVerifyResult(elem.id, ProxyType.AUDIO, esRecordSays=elem.proxied, wantProxy = false))
push(outThumb, ProxyVerifyResult(elem.id, ProxyType.THUMBNAIL, esRecordSays=elem.proxied, wantProxy = true))
} else {
push(outNo, ProxyVerifyResult(elem.id, ProxyType.UNKNOWN, esRecordSays=elem.proxied, wantProxy = false))
}
}
}
})
setHandler(outNo, new AbstractOutHandler {
override def onPull(): Unit = {
println("fileTypeWantProxyBranch NO: pullFromDownstream")
if(!hasBeenPulled(in)) {
pull(in)
} else {
println("input port not available")
}
}
})
setHandler(outVideo, new AbstractOutHandler {
override def onPull(): Unit = {
//println("fileTypeWantProxyBranch VIDEO: pullFromDownstream")
if(!hasBeenPulled(in)){
pull(in)
} else {
//println("input port not available")
}
}
})
setHandler(outAudio, new AbstractOutHandler {
override def onPull(): Unit = {
//println("fileTypeWantProxyBranch AUDIO: pullFromDownstream")
if(!hasBeenPulled(in)){
pull(in)
} else {
//println("input port not available")
}
}
})
setHandler(outThumb, new AbstractOutHandler {
override def onPull(): Unit = {
//println("fileTypeWantProxyBranch THUMB: pullFromDownstream")
if(!hasBeenPulled(in)){
pull(in)
} else {
//println("input port not available")
}
}
})
}