mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-12 13:42:34 +00:00
RTFM
This commit is contained in:
parent
f65addee9b
commit
5808028494
19 changed files with 276 additions and 1 deletions
1
rtfm
1
rtfm
|
@ -1 +0,0 @@
|
|||
Subproject commit 4bd7654f0c3e0164c78a990104e0fc242ee5252c
|
40
rtfm/01-intro.Rmd
Normal file
40
rtfm/01-intro.Rmd
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Start Simple
|
||||
|
||||
The following example shows how you can read an audio file, parse, set, and save its metadata:
|
||||
|
||||
```rust
|
||||
use audiotags::{MimeType, Picture, Tag, TagType};
|
||||
|
||||
const MP3_FILE: &'static str = "assets/a.mp3";
|
||||
|
||||
fn main() {
|
||||
// using `default()` so that the metadata format is guessed
|
||||
// (from the file extension) (in this case, Id3v2 tag is read)
|
||||
let mut tag = Tag::default().read_from_path(MP3_FILE).unwrap();
|
||||
// You can also specify the metadata format (tag type):
|
||||
let _tag = Tag::with_tag_type(TagType::Id3v2)
|
||||
.read_from_path(MP3_FILE)
|
||||
.expect("Fail to read!");
|
||||
|
||||
tag.set_title("foo title");
|
||||
assert_eq!(tag.title(), Some("foo title"));
|
||||
tag.remove_title();
|
||||
assert!(tag.title().is_none());
|
||||
tag.remove_title();
|
||||
// trying to remove a field that's already empty won't hurt
|
||||
|
||||
let cover = Picture {
|
||||
mime_type: MimeType::Jpeg,
|
||||
data: &vec![0u8; 10],
|
||||
};
|
||||
|
||||
tag.set_album_cover(cover.clone());
|
||||
assert_eq!(tag.album_cover(), Some(cover));
|
||||
tag.remove_album_cover();
|
||||
assert!(tag.album_cover().is_none());
|
||||
tag.remove_album_cover();
|
||||
|
||||
tag.save_to_path(MP3_FILE).expect("Fail to save");
|
||||
// TASK: reload the file and prove the data have been saved
|
||||
}
|
||||
```
|
3
rtfm/05-summary.Rmd
Normal file
3
rtfm/05-summary.Rmd
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Final Words
|
||||
|
||||
We have finished a nice book.
|
3
rtfm/06-references.Rmd
Normal file
3
rtfm/06-references.Rmd
Normal file
|
@ -0,0 +1,3 @@
|
|||
`r if (knitr::is_html_output()) '
|
||||
# References {-}
|
||||
'`
|
5
rtfm/README.md
Normal file
5
rtfm/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# **audiotags**: The Manual
|
||||
|
||||
This is the manual of the crate **audiotags** based on [**bookdown**](https://github.com/rstudio/bookdown) (I know it's uncommon in the Rust community not to use **mdbook**, but trust me, **bookdown** is just so much powerful and you should definitely try it; at the minimum, it automatically generates LaTeX output by default).
|
||||
|
||||
Navigate to https://tianyishi2001.github.io/audiotags to read online. Alternatively, you can download the [PDF](https://tianyishi2001.github.io/audiotags/audiotags.pdf) or [epub](https://tianyishi2001.github.io/audiotags/audiotags.epub) formats.
|
6
rtfm/_bookdown.yml
Normal file
6
rtfm/_bookdown.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
book_filename: "audiotags"
|
||||
output_dir: "../docs"
|
||||
delete_merged_file: true
|
||||
language:
|
||||
ui:
|
||||
chapter_name: "Chapter "
|
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
18
rtfm/_output.yml
Normal file
18
rtfm/_output.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
bookdown::gitbook:
|
||||
css: style.css
|
||||
# split_by: section
|
||||
config:
|
||||
toc:
|
||||
# collapse: subsection
|
||||
before: |
|
||||
<li><strong><a href="https://tianyishi2001.github.io/audiotags">audiotags Manual</a></strong></li>
|
||||
after: |
|
||||
<li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
|
||||
download: ["pdf", "epub"]
|
||||
bookdown::pdf_book:
|
||||
includes:
|
||||
in_header: preamble.tex
|
||||
latex_engine: xelatex
|
||||
citation_package: natbib
|
||||
keep_tex: yes
|
||||
bookdown::epub_book: default
|
10
rtfm/book.bib
Normal file
10
rtfm/book.bib
Normal file
|
@ -0,0 +1,10 @@
|
|||
@Book{xie2015,
|
||||
title = {Dynamic Documents with {R} and knitr},
|
||||
author = {Yihui Xie},
|
||||
publisher = {Chapman and Hall/CRC},
|
||||
address = {Boca Raton, Florida},
|
||||
year = {2015},
|
||||
edition = {2nd},
|
||||
note = {ISBN 978-1498716963},
|
||||
url = {http://yihui.org/knitr/},
|
||||
}
|
BIN
rtfm/fonts/lato-v11-latin-regular.woff
Normal file
BIN
rtfm/fonts/lato-v11-latin-regular.woff
Normal file
Binary file not shown.
BIN
rtfm/fonts/lato-v11-latin-regular.woff2
Normal file
BIN
rtfm/fonts/lato-v11-latin-regular.woff2
Normal file
Binary file not shown.
BIN
rtfm/fonts/merriweather-v13-latin-regular.woff
Normal file
BIN
rtfm/fonts/merriweather-v13-latin-regular.woff
Normal file
Binary file not shown.
BIN
rtfm/fonts/merriweather-v13-latin-regular.woff2
Normal file
BIN
rtfm/fonts/merriweather-v13-latin-regular.woff2
Normal file
Binary file not shown.
24
rtfm/index.Rmd
Normal file
24
rtfm/index.Rmd
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
title: "audiotags Manual"
|
||||
author: "Tianyi Shi"
|
||||
date: "`r Sys.Date()`"
|
||||
site: bookdown::bookdown_site
|
||||
documentclass: book
|
||||
bibliography: [book.bib, packages.bib]
|
||||
biblio-style: apalike
|
||||
link-citations: yes
|
||||
description: "This is the manual of the Rust crate 'audiotags'"
|
||||
---
|
||||
|
||||
# Preface {-}
|
||||
|
||||
Thank you for considering **audiotags**!
|
||||
|
||||
`r if (knitr::is_html_output()) '
|
||||
Before you start, please let me introduce to you some great features of **bookdown**:
|
||||
|
||||
- use left and right arrow keys to navigate to the previous/next page
|
||||
- click the "font" (big "A") button on the top-left and change to a serif font if you happen to hate sans-serif fonts as I do.
|
||||
- If you believe that serious stuff must be rendered by LaTeX as I do, there is a LaTex-rendered PDF for you to download (click the download button on the top)
|
||||
- If you love to read on a Kindle, there is also an epub output (click the download button on the top).
|
||||
'`
|
85
rtfm/packages.bib
Normal file
85
rtfm/packages.bib
Normal file
|
@ -0,0 +1,85 @@
|
|||
@Manual{R-base,
|
||||
title = {R: A Language and Environment for Statistical Computing},
|
||||
author = {{R Core Team}},
|
||||
organization = {R Foundation for Statistical Computing},
|
||||
address = {Vienna, Austria},
|
||||
year = {2020},
|
||||
url = {https://www.R-project.org/},
|
||||
}
|
||||
|
||||
@Manual{R-bookdown,
|
||||
title = {bookdown: Authoring Books and Technical Documents with R Markdown},
|
||||
author = {Yihui Xie},
|
||||
year = {2020},
|
||||
note = {R package version 0.21},
|
||||
url = {https://github.com/rstudio/bookdown},
|
||||
}
|
||||
|
||||
@Manual{R-knitr,
|
||||
title = {knitr: A General-Purpose Package for Dynamic Report Generation in R},
|
||||
author = {Yihui Xie},
|
||||
year = {2020},
|
||||
note = {R package version 1.30},
|
||||
url = {https://yihui.org/knitr/},
|
||||
}
|
||||
|
||||
@Manual{R-rmarkdown,
|
||||
title = {rmarkdown: Dynamic Documents for R},
|
||||
author = {JJ Allaire and Yihui Xie and Jonathan McPherson and Javier Luraschi and Kevin Ushey and Aron Atkins and Hadley Wickham and Joe Cheng and Winston Chang and Richard Iannone},
|
||||
year = {2020},
|
||||
note = {R package version 2.4},
|
||||
url = {https://github.com/rstudio/rmarkdown},
|
||||
}
|
||||
|
||||
@Book{bookdown2016,
|
||||
title = {bookdown: Authoring Books and Technical Documents with {R} Markdown},
|
||||
author = {Yihui Xie},
|
||||
publisher = {Chapman and Hall/CRC},
|
||||
address = {Boca Raton, Florida},
|
||||
year = {2016},
|
||||
note = {ISBN 978-1138700109},
|
||||
url = {https://github.com/rstudio/bookdown},
|
||||
}
|
||||
|
||||
@Book{knitr2015,
|
||||
title = {Dynamic Documents with {R} and knitr},
|
||||
author = {Yihui Xie},
|
||||
publisher = {Chapman and Hall/CRC},
|
||||
address = {Boca Raton, Florida},
|
||||
year = {2015},
|
||||
edition = {2nd},
|
||||
note = {ISBN 978-1498716963},
|
||||
url = {https://yihui.org/knitr/},
|
||||
}
|
||||
|
||||
@InCollection{knitr2014,
|
||||
booktitle = {Implementing Reproducible Computational Research},
|
||||
editor = {Victoria Stodden and Friedrich Leisch and Roger D. Peng},
|
||||
title = {knitr: A Comprehensive Tool for Reproducible Research in {R}},
|
||||
author = {Yihui Xie},
|
||||
publisher = {Chapman and Hall/CRC},
|
||||
year = {2014},
|
||||
note = {ISBN 978-1466561595},
|
||||
url = {http://www.crcpress.com/product/isbn/9781466561595},
|
||||
}
|
||||
|
||||
@Book{rmarkdown2018,
|
||||
title = {R Markdown: The Definitive Guide},
|
||||
author = {Yihui Xie and J.J. Allaire and Garrett Grolemund},
|
||||
publisher = {Chapman and Hall/CRC},
|
||||
address = {Boca Raton, Florida},
|
||||
year = {2018},
|
||||
note = {ISBN 9781138359338},
|
||||
url = {https://bookdown.org/yihui/rmarkdown},
|
||||
}
|
||||
|
||||
@Book{rmarkdown2020,
|
||||
title = {R Markdown Cookbook},
|
||||
author = {Yihui Xie and Christophe Dervieux and Emily Riederer},
|
||||
publisher = {Chapman and Hall/CRC},
|
||||
address = {Boca Raton, Florida},
|
||||
year = {2020},
|
||||
note = {ISBN 9780367563837},
|
||||
url = {https://bookdown.org/yihui/rmarkdown-cookbook},
|
||||
}
|
||||
|
1
rtfm/preamble.tex
Normal file
1
rtfm/preamble.tex
Normal file
|
@ -0,0 +1 @@
|
|||
\usepackage{booktabs}
|
15
rtfm/rtfm.Rproj
Normal file
15
rtfm/rtfm.Rproj
Normal file
|
@ -0,0 +1,15 @@
|
|||
Version: 1.0
|
||||
|
||||
RestoreWorkspace: Default
|
||||
SaveWorkspace: Default
|
||||
AlwaysSaveHistory: Default
|
||||
|
||||
EnableCodeIndexing: Yes
|
||||
UseSpacesForTab: Yes
|
||||
NumSpacesForTab: 2
|
||||
Encoding: UTF-8
|
||||
|
||||
RnwWeave: Sweave
|
||||
LaTeX: pdfLaTeX
|
||||
|
||||
BuildType: Website
|
66
rtfm/style.css
Normal file
66
rtfm/style.css
Normal file
|
@ -0,0 +1,66 @@
|
|||
p.caption {
|
||||
color: #777;
|
||||
margin-top: 10px;
|
||||
}
|
||||
p code {
|
||||
white-space: inherit;
|
||||
}
|
||||
pre {
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
}
|
||||
pre code {
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'Merriweather';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Merriweather'), local('Merriweather-Regular'),
|
||||
url('https://tianyishi2001.github.io/ox/fonts/merriweather-v13-latin-regular.woff2') format('woff2'),
|
||||
url('https://tianyishi2001.github.io/ox/fonts/merriweather-v13-latin-regular.woff') format('woff');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Lato Regular'), local('Lato-Regular'),
|
||||
url('https://tianyishi2001.github.io/ox/fonts/lato-v11-latin-regular.woff2') format('woff2'),
|
||||
url('https://tianyishi2001.github.io/ox/fonts/lato-v11-latin-regular.woff') format('woff');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "nexus-serif";
|
||||
src: url("https://tianyishi2001.github.io/ox/fonts/nexus-serif/NexusSerifWebPro-Regular.woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "nexus-serif";
|
||||
src: url("https://tianyishi2001.github.io/ox/fonts/nexus-serif/NexusSerifWebPro-Bold.woff");
|
||||
font-weight: bold;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "nexus-serif";
|
||||
src: url("https://tianyishi2001.github.io/ox/fonts/nexus-serif/NexusSerifWebPro-Italic.woff");
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "nexus-serif";
|
||||
src: url("https://tianyishi2001.github.io/ox/fonts/nexus-serif/NexusSerifWebPro-BoldItalic.woff");
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: 'Lato', sans-serif;
|
||||
}
|
||||
.book.font-family-0 {
|
||||
font-family: nexus-serif;
|
||||
}
|
||||
|
||||
.book.font-family-1 {
|
||||
font-family: 'Lato', sans-serif;
|
||||
}
|
Loading…
Reference in a new issue