Skip to content

Commit

Permalink
Merge branch 'main' into bigarray
Browse files Browse the repository at this point in the history
  • Loading branch information
smimram authored Dec 13, 2023
2 parents de86536 + c4e6863 commit a910569
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 12 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,35 @@ on:
- main

jobs:
build_doc:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup OCaml
uses: avsm/setup-ocaml@v2
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.14.0
ocaml-compiler: 5.00
- name: Pin locally
run: opam pin -y add -n .
- name: Install locally
run: opam install -y odoc metadata
- name: Build doc
run: opam exec dune build @doc
- name: Deploy doc
uses: JamesIves/github-pages-[email protected]
- name: Upload website artifact
uses: actions/upload-pages-artifact@v2
with:
branch: gh-pages
folder: _build/default/_doc/_html
path: _build/default/_doc/_html
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy website
id: deployment
uses: actions/deploy-pages@v2
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ocaml/setup-ocaml@v2
- name: Checkout
uses: actions/checkout@v4
- name: Setup OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.14.0
ocaml-compiler: 5.00
- name: Install required packages
run: sudo apt install ffmpeg
- name: Pin package
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.3.0 (unreleased)
=====
- Add basic example.
- Add support for bigarray values
- Use `Unix.map_file` to represent large
metadata values.
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,29 @@ supported:
- image formats: jpeg and png
- video formats: mp4 and avi

Usage
-----

Basic usage is

```ocaml
let () =
let filename = "test.mp3" in
let metadata = Metadata.Any.parse_file filename in
List.iter (fun (k,v) -> Printf.printf "- %s: %s\n" k v) metadata
```

In the above example, the function `Metadata.Any.parse_file`{.ocaml} takes a
file name as argument and returns an association list describing its
metadata. It consists of pairs of strings being the name of the metadata and its
value.

Installing
----------

The preferred way is via opam:

```
```bash
opam pin add .
opam install metadata
```
Expand Down
6 changes: 6 additions & 0 deletions examples/basic.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(** Basic usage of the library. *)

let () =
let filename = "test.mp3" in
let metadata = Metadata.Any.parse_file filename in
List.iter (fun (k,v) -> Printf.printf "- %s: %s\n" k v) metadata
6 changes: 6 additions & 0 deletions examples/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
(modules meta)
(libraries str metadata))

(executable
(name basic)
(modules basic)
(libraries metadata))

(executable
(name dump)
(modules dump)
Expand All @@ -28,6 +33,7 @@
(glob_files id3v2/*.mp3))
(action
(progn
(run ./basic.exe)
(run ./test.exe)
(run ./meta.exe %{deps}))))

Expand Down

0 comments on commit a910569

Please sign in to comment.