akka-vidispine-components


License

License

Categories

Categories

Akka Container Microservices Reactive libraries
GroupId

GroupId

com.gu
ArtifactId

ArtifactId

akka-vidispine-components_2.12
Last Version

Last Version

1.0.0-RC1
Release Date

Release Date

Type

Type

jar
Description

Description

akka-vidispine-components
akka-vidispine-components
Project URL

Project URL

https://github.com/guardian/akka-vidispine-components
Project Organization

Project Organization

com.gu
Source Code Management

Source Code Management

https://github.com/guardian/akka-vidispine-components

Download akka-vidispine-components_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.gu/akka-vidispine-components_2.12/ -->
<dependency>
    <groupId>com.gu</groupId>
    <artifactId>akka-vidispine-components_2.12</artifactId>
    <version>1.0.0-RC1</version>
</dependency>
// https://jarcasting.com/artifacts/com.gu/akka-vidispine-components_2.12/
implementation 'com.gu:akka-vidispine-components_2.12:1.0.0-RC1'
// https://jarcasting.com/artifacts/com.gu/akka-vidispine-components_2.12/
implementation ("com.gu:akka-vidispine-components_2.12:1.0.0-RC1")
'com.gu:akka-vidispine-components_2.12:jar:1.0.0-RC1'
<dependency org="com.gu" name="akka-vidispine-components_2.12" rev="1.0.0-RC1">
  <artifact name="akka-vidispine-components_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.gu', module='akka-vidispine-components_2.12', version='1.0.0-RC1')
)
libraryDependencies += "com.gu" % "akka-vidispine-components_2.12" % "1.0.0-RC1"
[com.gu/akka-vidispine-components_2.12 "1.0.0-RC1"]

Dependencies

compile (14)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.10
io.circe : circe-core_2.12 jar 0.13.0
io.circe : circe-generic_2.12 jar 0.13.0
io.circe : circe-parser_2.12 jar 0.13.0
com.typesafe.akka : akka-stream_2.12 jar 2.5.31
com.typesafe.akka : akka-agent_2.12 jar 2.5.31
org.slf4j : slf4j-api jar 1.7.25
com.softwaremill.sttp : core_2.12 jar 1.7.2
com.softwaremill.sttp : async-http-client-backend-future_2.12 jar 1.7.2
org.asynchttpclient : async-http-client jar 2.12.2
com.softwaremill.sttp : akka-http-backend_2.12 jar 1.7.2
org.scala-lang.modules : scala-xml_2.12 jar 1.3.0
io.netty : netty-codec-http jar 4.1.59.Final
io.netty : netty-handler jar 4.1.59.Final

test (3)

Group / Artifact Type Version
com.typesafe.akka : akka-testkit_2.12 jar 2.5.31
org.specs2 : specs2-core_2.12 jar 4.6.0
org.specs2 : specs2-mock_2.12 jar 4.6.0

Project Modules

There are no modules declared in this project.

#akka-vidispine-components

What is it?

This library brings together a few Akka Stream components that I have been using across a couple of projects to interface with the Vidispine (https://www.vidispine.com) asset management system.

The aim is not to provide a full-featured interface but rather to keep re-usable code in one place. If you find it useful, please do contribute!

Setup

The components use the provided class VSCommunicator to manage communication with the app server, and normally expect an instance to be provided as an implicit argument. For example:

import com.gu.vidispineakka.vidispine.VSCommunicator

.
.
.


implicit comm:VSCommunicator = new VSCommunicator("https://vidispine-uri","username","password")

What is provided?

Sources

  • VSItemSearchSource

Performs an item search, paginates/caches internally and yields the results as a stream of VSLazyItem objects. For example:

import com.gu.vidispineakka.streamcomponents.VSGenericSearchSource
import com.gu.vidispineakka.vidispine.VSCommunicator
import akka.stream.scaladsl.GraphDSL._
import akka.stream.scaladsl.GraphDSL
import scala.xml._

val interestingMetadataFields = Seq("title","originalFormat","duration")  //etc. etc.; any valid Vidispine field names here, or empty.
val xmlSearchDoc = <ItemSearchDocument xmlns="http://xml.vidispine.com/schema/vidispine">.....</ItemSearchDocument>

GraphDSL.create() { implicit builder=>
  val src = builder.add(new VSGenericSearchSource(interestingMetadataFields, xmlSearchDoc.toString, includeShape=true))
  SourceShape(src.out)
}
  • VSStorageScanSource

Performs a file search optionally limited to a given storage or a given file status and yields the results as a stream of VSFile objects. For example:

import com.gu.vidispineakka.streamcomponents.VSStorageScanSource
import com.gu.vidispineakka.vidispine.VSCommunicator
import akka.stream.scaladsl.GraphDSL._
import akka.stream.scaladsl.GraphDSL
import scala.xml._


GraphDSL.create() { implicit builder=>
  val src = builder.add(new VSStorageScanSource(Some("storage-id-here"),Some("file-status-here")))
  SourceShape(src.out)
}

Flows

  • VSGetItem

Receives a VSFile objects (that must contain shape data) and looks up the associated item as a VSLazyItem object. The output is a tuple of (VSFile, Option(VSLazyItem)) where VSFile is the VSFile object that was input and the VSLazyItem is set if an item was found. If there is no membership then None is returned.

  • VSFileIdInList

Fanout shape that pushes an incoming VSFile to a "YES" output if the ID of the incoming file is in a string list provided at construction or to a "NO" output if it isn't.

  • VSDeleteFile

Receives a VSFile object and tells Vidispine to delete the File with the corresponding ID (not the item). It then passes on the incoming VSFile object for further processing. It can also be constituted as a Sink by using VSDeleteFile.asSink(reallyDelete=true)

com.gu

The Guardian

The source code of the world's leading liberal voice

Versions

Version
1.0.0-RC1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1