diff --git a/DESCRIPTION b/DESCRIPTION index baae88e..9e1a656 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,9 @@ License: GPL (>= 3) Encoding: UTF-8 LazyData: true Imports: + dplyr, magrittr, + purrr, spotifyr RoxygenNote: 7.3.1 Suggests: diff --git a/R/search_tracks_by_term.R b/R/search_tracks_by_term.R index 5362861..63daf27 100644 --- a/R/search_tracks_by_term.R +++ b/R/search_tracks_by_term.R @@ -62,7 +62,7 @@ search_tracks_by_term <- function(search_term, wasAssociatedWith) { #Selecting year of reference all_tracks_df$isrc_year <- substr(all_tracks_df$isrc, 6, 7) - prov <- provenance_statement(startedAtTime = startedAtTime, endedAtTime = Sys.time(), wasAssociatedWith = ) + prov <- provenance_statement(startedAtTime = startedAtTime, endedAtTime = Sys.time(), wasAssociatedWith = wasAssociatedWith) attr(all_tracks_df, "provenance") <- prov diff --git a/vignettes/search_tracks_by_term.Rmd b/vignettes/search_tracks_by_term.Rmd new file mode 100644 index 0000000..dc1d097 --- /dev/null +++ b/vignettes/search_tracks_by_term.Rmd @@ -0,0 +1,51 @@ +--- +title: "search_track_by_term" +author: "Fabio Vieira" +date: "2024-09-12" +output: html_document +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +## The function + +The function search_track_by_terms is supposed to search Spotify API for tracks that contain the term being search. The function only takes on two parameters + +- **search_term**: a string containing the term being search (ex: "Olho") +- **wasAssociatedWith**: the ORCID of the person performing the query. + +## Example + +# Loading packages + +```{r} +library(here) +library(spotifyr) +library(openmusesampling) +if (file.exists(here("_not_included", "myenviron.R"))) { + source(here("_not_included", "myenviron.R")) +} +``` + +Running a query (this might take several minutes to run) + +```{r} +df <- search_tracks_by_term(search_term = "Olho", + wasAssociatedWith = "https://orcid.org/0000-0003-4253-1953") +``` + +## Output + +Checking the results + +```{r} +head(df) +``` + +Additional information about the query (i.e. who perform the query, at what time, and so on) + +```{r} +attr(df, "prov") +```