Skip to content

Commit

Permalink
polish up
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Oct 12, 2024
1 parent edbd603 commit b8ae81b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: lint-test-build-push
on:
push:
paths-ignore:
- '*.md'
- '**/*.md'
- '.github/**'
- 'ci/**'

Expand Down
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
# scyllaridae

Any command that takes some input and prints an output can use scyllaridae.
Any command that takes a file as input and prints a result as output can use scyllaridae.

Both `GET` and `POST` requests are supported.

`GET` supports Islandora's alpaca/event spec, which sends a URL of a file as an HTTP header `Apix-Ldp-Resource` and prints the result. e.g. to create a VTT file from an audio file:

```
curl -H "Apix-Ldp-Resource: https://github.com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav" \
http://localhost:8080
WEBVTT
00:00:00.000 --> 00:00:11.000
And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.
```

`POST` supports directly uploading a file to the service

```
curl -H "Content-Type: audio/x-wav" \
--data-binary "@output.wav" \
http://localhost:8080/
WEBVTT
00:00:00.000 --> 00:00:02.960
Lehigh University Library Technology.
```

## Adding a new microservice

Expand Down
4 changes: 2 additions & 2 deletions internal/config/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func GetPassedArgs(args string) ([]string, error) {

func (c *ServerConfig) GetFileStream(r *http.Request, message api.Payload, auth string) (io.ReadCloser, int, error) {
if r.Method == http.MethodPost {
return r.Body, 200, nil
return r.Body, http.StatusOK, nil
}
req, err := http.NewRequest("GET", message.Attachment.Content.SourceURI, nil)
if err != nil {
Expand All @@ -305,5 +305,5 @@ func (c *ServerConfig) GetFileStream(r *http.Request, message api.Payload, auth
return nil, http.StatusFailedDependency, fmt.Errorf("failed dependency")
}

return sourceResp.Body, 200, nil
return sourceResp.Body, http.StatusOK, nil
}

0 comments on commit b8ae81b

Please sign in to comment.