Skip to content

Commit

Permalink
edit README
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Jan 19, 2024
1 parent f90a356 commit f885336
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
^docs$
^pkgdown$
^CODE_OF_CONDUCT\.md$
^.*\.Rproj$
^\.Rproj\.user$
^_pkgdown\.yaml$
73 changes: 29 additions & 44 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,21 @@ knitr::opts_chunk$set(
```


omdbr <img src="man/figures/logo.png" height="170" align="right"/>
omdbr <img src="man/figures/logo.png" height="170px" align="right" style="float:right; height:170px;"/>
=======================

<!-- badges: start -->
[![R build status](https://github.com/inSileco/omdbr/workflows/R-CMD-check/badge.svg)](https://github.com/inSileco/omdbr/actions)
[![Project Status: Stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/omdbr)](https://cran.r-project.org/package=omdbr)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
[![r-universe](https://insileco.r-universe.dev/badges/omdbr)](https://insileco.r-universe.dev/ui#builds)
<!-- badges: end -->

The package `omdbr` is an R client to the [OMDb API](http://www.omdbapi.com).
User can retrieve informations about movies (title, actors, year, genres, etc.)
and download poster (if available) using the [YTS API](https://yts.mx/api/v2/).
User can retrieve information on movies (title, actors, year, genres, etc.)
and download cover (if available) using the [YTS API](https://yts.mx/api/v2/).


<br />

## Prerequisites

Expand All @@ -40,26 +38,25 @@ When you'll use the package `omdbr` for the first time, you'll be guided on
how to store your personal API key.


<br />

## Installation

To install the `omdbr` package, run the following command:

```{r echo = TRUE, eval = FALSE}
```{r echo=TRUE, eval=FALSE}
remotes::install_github("inSileco/omdbr")
```

and load the package:

```{r echo = TRUE, eval = TRUE}
```{r echo=TRUE, eval=TRUE}
library(omdbr)
```

<br />

<p align="center">
```{r echo = FALSE, eval = TRUE, out.width = "12.5%"}
```{r echo=FALSE, eval=TRUE, out.width="12.5%"}
knitr::include_graphics("man/figures/tt0128445.jpg")
knitr::include_graphics("man/figures/tt0265666.jpg")
knitr::include_graphics("man/figures/tt0362270.jpg")
Expand All @@ -72,114 +69,103 @@ knitr::include_graphics("man/figures/tt5104604.jpg")
```
</p>

<br />


## Example

> **Objective**: Getting informations and cover for
> **Objective**: Getting information and cover for
[_The Darjeeling Limited_](https://imdb.com/title/tt0838221) movie directed by
[Wes Anderson](https://en.wikipedia.org/wiki/Wes_Anderson).

<br />

**STEP 1**: Finding the IMDb identifier of the movie
**STEP 1**: Find the IMDb identifier of the movie

The package `omdbr` uses the IMDb ID the retrieves informations and cover movie.
The package `omdbr` uses the IMDb ID the retrieves information and cover of a movie.
The function `find_imdb_id()` tries to find this ID.

```{r echo = TRUE, eval = TRUE}
```{r echo=TRUE, eval=TRUE}
x <- find_imdb_id("The Darjeeling Limited")
```

```{r echo = TRUE, eval = TRUE}
```{r echo=TRUE, eval=TRUE}
str(x)
```

```{r echo = FALSE, eval = TRUE}
```{r echo=FALSE, eval=TRUE}
x
```

:bulb: The argument `year` can be used to reduce results.

<br />

:bulb: You can also find this ID by searching the movie title on the
[IMDb website](https://imdb.com) and extract it from the URL.
The URL of _The Darjeeling Limited_ is:
[https://imdb.com/title/tt0838221](https://imdb.com/title/tt0838221).

<br />

**STEP 2**: Getting movie informations
**STEP 2**: Get movie information

```{r echo = FALSE, eval = TRUE}
```{r echo=FALSE, eval=TRUE}
imdb_id <- "tt0838221"
path <- "README_files/"
```

To retrieve informations about the movie we will use the function `get_details()`:
To retrieve information about the movie we will use the function `get_details()`:

```{r echo = TRUE, eval = FALSE}
```{r echo=TRUE, eval=FALSE}
x <- get_details(imdb_id = "tt0838221")
```

```{r echo = FALSE, eval = TRUE}
```{r echo=FALSE, eval=TRUE}
x <- get_details(imdb_id = "tt0838221", path = path)
```

```{r echo = TRUE, eval = TRUE}
```{r echo=TRUE, eval=TRUE}
class(x)
```

```{r echo = FALSE, eval = TRUE}
```{r echo=FALSE, eval=TRUE}
x
```

:bulb: Results are stored in `data/tt0838221.yml` (path can be changed
by using the argument `path`).

<br />

If you want to get access to these data you can use the function `read_details()`:


```{r echo = TRUE, eval = TRUE}
```{r echo=TRUE, eval=TRUE}
x <- read_details(imdb_id = "tt0838221")
```

```{r echo = FALSE, eval = TRUE}
```{r echo=FALSE, eval=TRUE}
x
```

<br />

**STEP 3**: Getting movie poster
**STEP 3**: Get movie cover

Now, we can try to download the movie poster with the function `get_cover()`:
Now, we can try to download the movie cover with the function `get_cover()`:

```{r echo = TRUE, eval = FALSE}
```{r echo=TRUE, eval=FALSE}
get_cover(imdb_id = "tt0838221")
```

```{r echo = FALSE, eval = TRUE}
```{r echo=FALSE, eval=TRUE}
get_cover(imdb_id = "tt0838221", path = path)
```


<br />

<p align="center">
```{r echo = FALSE, eval = TRUE, out.width = "50%"}
```{r echo=FALSE, eval=TRUE, out.width = "50%"}
covers <- list.files("man/figures", full.names = TRUE)
knitr::include_graphics("man/figures/tt0838221.jpg")
```
</p>

<br />

:bulb: Results are stored as follow:

```{r echo = TRUE, eval = FALSE}
```{r echo=TRUE, eval=FALSE}
.
├── covers
│   └──tt0838221.jpg
Expand All @@ -189,7 +175,6 @@ knitr::include_graphics("man/figures/tt0838221.jpg")
2 directories, 2 files
```

<br />

## Code of Conduct

Expand Down
50 changes: 12 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# omdbr <img src="man/figures/logo.png" height="170" align="right"/>
# omdbr <img src="man/figures/logo.png" height="170px" align="right" style="float:right; height:170px;"/>

<!-- badges: start -->

[![R build
status](https://github.com/inSileco/omdbr/workflows/R-CMD-check/badge.svg)](https://github.com/inSileco/omdbr/actions)
[![Project Status:
Stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/omdbr)](https://cran.r-project.org/package=omdbr)
[![License: GPL
v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Contributor
Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
[![r-universe](https://insileco.r-universe.dev/badges/omdbr)](https://insileco.r-universe.dev/ui#builds)
<!-- badges: end -->

The package `omdbr` is an R client to the [OMDb
API](http://www.omdbapi.com). User can retrieve informations about
movies (title, actors, year, genres, etc.) and download poster (if
available) using the [YTS API](https://yts.mx/api/v2/).

<br />
API](http://www.omdbapi.com). User can retrieve information on movies
(title, actors, year, genres, etc.) and download cover (if available)
using the [YTS API](https://yts.mx/api/v2/).

## Prerequisites

Expand All @@ -32,8 +26,6 @@ an **API Key**. You can freely obtain your own
`omdbr` for the first time, you’ll be guided on how to store your
personal API key.

<br />

## Installation

To install the `omdbr` package, run the following command:
Expand All @@ -54,20 +46,16 @@ library(omdbr)
<img src="man/figures/tt0128445.jpg" width="12.5%" /><img src="man/figures/tt0265666.jpg" width="12.5%" /><img src="man/figures/tt0362270.jpg" width="12.5%" /><img src="man/figures/tt0838221.jpg" width="12.5%" /><img src="man/figures/tt0432283.jpg" width="12.5%" /><img src="man/figures/tt1748122.jpg" width="12.5%" /><img src="man/figures/tt2278388.jpg" width="12.5%" /><img src="man/figures/tt5104604.jpg" width="12.5%" />
</p>

<br />

## Example

> **Objective**: Getting informations and cover for [*The Darjeeling
> **Objective**: Getting information and cover for [*The Darjeeling
> Limited*](https://imdb.com/title/tt0838221) movie directed by [Wes
> Anderson](https://en.wikipedia.org/wiki/Wes_Anderson).
<br />

**STEP 1**: Finding the IMDb identifier of the movie
**STEP 1**: Find the IMDb identifier of the movie

The package `omdbr` uses the IMDb ID the retrieves informations and
cover movie. The function `find_imdb_id()` tries to find this ID.
The package `omdbr` uses the IMDb ID the retrieves information and cover
of a movie. The function `find_imdb_id()` tries to find this ID.

``` r
x <- find_imdb_id("The Darjeeling Limited")
Expand All @@ -92,17 +80,13 @@ str(x)

:bulb: The argument `year` can be used to reduce results.

<br />

:bulb: You can also find this ID by searching the movie title on the
[IMDb website](https://imdb.com) and extract it from the URL. The URL of
*The Darjeeling Limited* is: <https://imdb.com/title/tt0838221>.

<br />

**STEP 2**: Getting movie informations
**STEP 2**: Get movie information

To retrieve informations about the movie we will use the function
To retrieve information about the movie we will use the function
`get_details()`:

``` r
Expand Down Expand Up @@ -167,8 +151,6 @@ class(x)
:bulb: Results are stored in `data/tt0838221.yml` (path can be changed
by using the argument `path`).

<br />

If you want to get access to these data you can use the function
`read_details()`:

Expand Down Expand Up @@ -198,11 +180,9 @@ x <- read_details(imdb_id = "tt0838221")
## 1 7.2 the-darjeeling-limited-2007
## 2 7.2 the-darjeeling-limited-2007

<br />

**STEP 3**: Getting movie poster
**STEP 3**: Get movie cover

Now, we can try to download the movie poster with the function
Now, we can try to download the movie cover with the function
`get_cover()`:

``` r
Expand All @@ -211,14 +191,10 @@ get_cover(imdb_id = "tt0838221")

## ✔ Cover found for 'tt0838221' !

<br />

<p align="center">
<img src="man/figures/tt0838221.jpg" width="50%" />
</p>

<br />

:bulb: Results are stored as follow:

``` r
Expand All @@ -231,8 +207,6 @@ get_cover(imdb_id = "tt0838221")
2 directories, 2 files
```

<br />

## Code of Conduct

Please note that the `omdbr` project is released with a [Contributor
Expand Down
Binary file modified README_files/tt0838221.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions omdbr.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source

0 comments on commit f885336

Please sign in to comment.