-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.R
executable file
·78 lines (49 loc) · 1.96 KB
/
make.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#' @title radiofrance: Get Radio France Podcasts
#'
#' @description
#' Retrieves Radio France (France Inter, France Culture, etc.) podcasts
#' metadata (date, title, mp3 url, and duration). User can easily download
#' metadata for any podcast. The name of the podcast must be extracted from the
#' website URL (e.g. Le Moment Meurice must be written as le-moment-meurice).
#'
#' @author Nicolas Casajus \email{nicolas.casajus@@fondationbiodiversite.fr}
#'
#' @date 2022/06/22
## Install dependencies (listed in DESCRIPTION) ----
install.packages(c("here", "pkgload", "remotes"))
remotes::install_deps(upgrade = "never")
## Load project ----
pkgload::load_all(here::here())
## Path to save results ----
path <- here::here("inst")
## Change system locale ----
locale <- Sys.getlocale("LC_TIME")
Sys.setlocale("LC_TIME", "fr_FR.UTF-8")
## List podcast names ----
podcasts <- c(#"tanguy-pastureau-maltraite-l-info",
#"le-moment-meurice",
"la-chronique-de-waly-dia"
#"la-chanson-de-frederic-fromet",
#"la-chronique-d-aymeric-lompret",
#"le-journal-de-presque-17h17",
#"la-chronique-de-djamil-le-shlag",
#"carbone-14-le-magazine-de-l-archeologie",
#"le-billet-de-matthieu-noel",
#"la-chronique-de-doully",
#"quand-les-dieux-rodaient-sur-la-terre",
#"le-billet-d-alexandre-kominek",
#"geremy-part-en-live",
#"la-chronique-de-yann-marguet"
#"la-chronique-de-djubaka"
)
radios <- c("franceinter")
for (i in 1:length(podcasts)) {
cat("\n*** ", podcasts[i], " ***\n")
## Retrieve Metadata ----
get_metadata(podcasts[i], radio = radios[i], path, na_rm = TRUE)
## Create M3U Playlist ----
tab <- read.csv2(file.path(path, "csv", paste0(podcasts[i], ".csv")))
create_m3u(tab, podcasts[i], path)
}
## Restore system locale ----
Sys.setlocale("LC_TIME", locale)