README.md 3.06 KB
Newer Older
Jürgen Enge's avatar
Jürgen Enge committed
1
2
# Streaming Server

Jürgen Enge's avatar
Jürgen Enge committed
3
Memoriav Media Streaming Server
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
4

Jürgen Enge's avatar
Jürgen Enge committed
5
## Installation
6
7
    go get gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server
    go build gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/cmd/server
8
9

## Test
10
    go test gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/cmd/server
Jürgen Enge's avatar
Jürgen Enge committed
11
12
13
    
## Prerequsites

Jürgen Enge's avatar
Jürgen Enge committed
14
MariaDB/MySQL Server with table structure of [table.sql](tables.sql) 
15
  
Juergen Enge's avatar
Juergen Enge committed
16
## Server Commands
Jürgen Enge's avatar
Jürgen Enge committed
17

Juergen Enge's avatar
Juergen Enge committed
18
19
20
21
22
23
24
### clearcache    
    https://media.memobase.k8s.unibas.ch/command/clearcache?token=XXX

Token Subject: ```cmd:clearcache```
        
Clears the internal media cache of the server. 
should be done after changeing database contents.
Juergen Enge's avatar
Juergen Enge committed
25
26
27
28
29
30
31
32

### testdata    
    https://media.memobase.k8s.unibas.ch/command/testdata?type=[image|video]&access=[public|closed]&lifetime=<seconds>&num=<anzahl>&token=XXX

Token Subject: ```cmd:testdata```
        
delivers json file with testdata (including available metadata)

33
    
Juergen Enge's avatar
Juergen Enge committed
34
35
36
37
38
39
40
41
42
43
### media query

    https://media.memobase.k8s.unibas.ch/memo/<signature>/<command>
  
Token Subject: ```<signature>```
  
* master
   
   Delivers the mediaserver's master object without any transformation.
   Mainly used for audio and video objects.
Jürgen Enge's avatar
Jürgen Enge committed
44
    
Juergen Enge's avatar
Juergen Enge committed
45
46
* viewer

Juergen Enge's avatar
Juergen Enge committed
47
48
49
   Displays viewer which is iFrame embeddable  
   Signature of Poster Image for Video/Audio-Player: `<signature>-poster`
      
Juergen Enge's avatar
Juergen Enge committed
50
    
Juergen Enge's avatar
Juergen Enge committed
51
52
53
54
55
* resize
  
  Default command for image retrieval. Needs obligatory size parameter.
  
        http://localhost:88/memo/sig-5005/resize/size800x200/stretch/formatJPEG      
Juergen Enge's avatar
Juergen Enge committed
56
        http://localhost:88/memo/sig-5005/resize/size800x200/stretch/formatJPEG/fallbacksig-5006      
Juergen Enge's avatar
Juergen Enge committed
57
58
59
60
61
62
63
64
65
* iiif

  sends parameters directly to iiif image server
  
        http://localhost:88/memo/sig-5005/iiif/full/800,200/0/default.jpg
        http://localhost:88/memo/sig-5005/iiif/info.json
           
## Syntax

Juergen Enge's avatar
Juergen Enge committed
66
### Notational Conventions and Generic Grammar
Juergen Enge's avatar
Juergen Enge committed
67
68
69
70
71
Grammar is based on the Grammar used in RFC1616
https://tools.ietf.org/html/rfc2616#page-14

~~~~   
   memo_Url = serverBase "/" (dataReqest | serverCommand) 
Juergen Enge's avatar
Juergen Enge committed
72
73
   serverCommand = command-Base "/" (clearcache) token
   command-Base = TEXT
Juergen Enge's avatar
Juergen Enge committed
74
75
76
77
   clearcache = "clearcache"
   dataRequest = data-Base "/" signature "/" media-Command [token]
   data-Base = TEXT
   signature = TEXT
Juergen Enge's avatar
Juergen Enge committed
78
   media-Command = master | resize | iiif | viewer
Juergen Enge's avatar
Juergen Enge committed
79
80
81
82
   viewer = "viewer" ["/" fallback] 
   master = "master" ["/" fallback]
   resize = "resize" "/" size ["/" (stretch | crop)] ["/" flip] ["/" format] ["/" fallback]
   manifest = "manifest" ["/" fallback]
Juergen Enge's avatar
Juergen Enge committed
83
84
85
86
87
88
   size = "size" width "x" height
   width = 1*DIGIT
   height = 1*DIGIT
   stretch = "stretch"
   crop = "crop"
   flip = "flip"
Juergen Enge's avatar
Juergen Enge committed
89
90
   format = "format" ("PNG" | "JPEG")
   fallback = "fallback" signature
Juergen Enge's avatar
Juergen Enge committed
91
92
93
94
95
96
97
   iiif = "iiif" "/" (iiif-ImageRequest | iiif-InformationRequest)
   iiif-InformationRequest = "info.json"
   iiif-ImageRequest = iiifregion "/" iiifsize "/" iiifrotation "/" iiifquality "." iiifformat
      ; please refer to iiif api - https://iiif.io/api/image/2.0/#uri-syntax
   token = "?token=" HEX
~~~~    

Jürgen Enge's avatar
Jürgen Enge committed
98
    
99
### Docker
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
100
101

```sh
102
103
docker run -v<path_to_config>:/app/memostream.toml <image_name>
```