README.md 3.34 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
### media query

    https://media.memobase.k8s.unibas.ch/memo/<signature>/<command>
  
Juergen Enge's avatar
Juergen Enge committed
38
39
40
Token Subject: ```<signature>``` 

With fallback additional token claim: ```fb = <fallback-signature>```
Juergen Enge's avatar
Juergen Enge committed
41
42
43
44
45
  
* 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
46
    
Juergen Enge's avatar
Juergen Enge committed
47
48
* viewer

Juergen Enge's avatar
Juergen Enge committed
49
50
51
   Displays viewer which is iFrame embeddable  
   Signature of Poster Image for Video/Audio-Player: `<signature>-poster`
      
Juergen Enge's avatar
Juergen Enge committed
52
    
Juergen Enge's avatar
Juergen Enge committed
53
54
55
56
57
* 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
58
        http://localhost:88/memo/sig-5005/resize/size800x200/stretch/formatJPEG/fallbacksig-5006      
Juergen Enge's avatar
Juergen Enge committed
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
           
Juergen Enge's avatar
Juergen Enge committed
66
67
68
69
70
71
* manifest
  return predefined iiif manifest if available
  
        http://localhost:88/memo/sig-5005/manifest/v2
        http://localhost:88/memo/sig-5005/manifest/v3
               
Juergen Enge's avatar
Juergen Enge committed
72
73
## Syntax

Juergen Enge's avatar
Juergen Enge committed
74
### Notational Conventions and Generic Grammar
Juergen Enge's avatar
Juergen Enge committed
75
76
77
78
79
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
80
81
   serverCommand = command-Base "/" (clearcache) token
   command-Base = TEXT
Juergen Enge's avatar
Juergen Enge committed
82
83
84
85
   clearcache = "clearcache"
   dataRequest = data-Base "/" signature "/" media-Command [token]
   data-Base = TEXT
   signature = TEXT
Juergen Enge's avatar
Juergen Enge committed
86
   media-Command = master | resize | iiif | viewer | manifest
Juergen Enge's avatar
Juergen Enge committed
87
88
89
   viewer = "viewer" ["/" fallback] 
   master = "master" ["/" fallback]
   resize = "resize" "/" size ["/" (stretch | crop)] ["/" flip] ["/" format] ["/" fallback]
Juergen Enge's avatar
Juergen Enge committed
90
   manifest = "manifest" "/" ("v2" | "v3") ["/" fallback]
Juergen Enge's avatar
Juergen Enge committed
91
92
93
94
95
96
   size = "size" width "x" height
   width = 1*DIGIT
   height = 1*DIGIT
   stretch = "stretch"
   crop = "crop"
   flip = "flip"
Juergen Enge's avatar
Juergen Enge committed
97
98
   format = "format" ("PNG" | "JPEG")
   fallback = "fallback" signature
Juergen Enge's avatar
Juergen Enge committed
99
100
101
102
103
104
105
   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
106
    
107
### Docker
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
108
109

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