-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
191 lines (151 loc) · 8.21 KB
/
README.Rmd
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
---
output: github_document
---
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/JamendoR?color=brightgreen)](https://cran.r-project.org/package=JamendoR)
![](http://cranlogs.r-pkg.org/badges/JamendoR?color=brightgreen)
![](http://cranlogs.r-pkg.org/badges/grand-total/JamendoR)
[![R-CMD-check](https://github.com/MaxGreil/JamendoR/workflows/R-CMD-check/badge.svg)](https://github.com/MaxGreil/JamendoR/actions)
# JamendoR
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
## Overview
JamendoR is a R wrapper for pulling track audio features and other information from Jamendo's Web API. You can pull song and playlist information for a given Jamendo user (including yourself!) or enter an artist's -, album's -, or track's name and retrieve the available information in seconds.
## Installation
CRAN Version 0.1.1 (recommended)
```r
install.packages('JamendoR')
```
Development version
```r
devtools::install_github('MaxGreil/JamendoR')
```
## Authentication
First, set up an account with Jamendo to access their Web API [here](https://devportal.jamendo.com/signup). This will give you your `Client ID` and `Client Secret`. Once you have those, you can pull your access token into R with `jamendoOAuth(app_name)`.
The easiest way to authenticate is to set your credentials to the System Environment variables `JAMENDO_CLIENT_ID` and `JAMENDO_CLIENT_SECRET`. The default arguments to `jamendoOAuth(app_name)` (and all other functions in this package) will refer to those. Alternatively, you can set them manually and make sure to explicitly refer to your access token in each subsequent function call.
```{r, eval = FALSE}
Sys.setenv(JAMENDO_CLIENT_ID = 'xxxxxxxxxxxxxxxxxxxxx')
Sys.setenv(JAMENDO_CLIENT_SECRET = 'xxxxxxxxxxxxxxxxxxxxx')
token <- jamendoOAuth(app_name="xxxx")
filedir <- tempdir()
save(token, file=file.path(filedir, "token"))
```
#### Authorization code flow
For certain functions and applications, you'll need to be logged in. To do this, your Jamendo application needs to have a callback url. You can set this to whatever you want, but a good default option is `http://localhost:1410/` (see image below).
For more information on authorization, visit the offical [Jamendo Developer Guide](https://developer.jamendo.com/v3.0/authentication).
```{r, out.width = "50%", echo = FALSE}
knitr::include_graphics('man/figures/JamendoR_auth_screenshot.PNG')
```
## Usage
### Get information about a specific user:
```{r, eval = FALSE}
user <- getUserProfile(user_name = "claudod")
# id dispname lang creationdate
#1 972174 claudod it 2010-10-17
```
### Search for an artist:
```{r, eval = FALSE}
artists <- getArtistsLocation("GRC", limit=3)
# id name website joindate shorturl
#1 1510 Judas Priestley http://myspace.com/judaspriestley 2006-03-21 http://jamen.do/a/1510
#2 338873 nasos 2008-03-25 http://jamen.do/a/338873
#3 348714 e.k.m. http://epithesikatametopo.blogspot.com 2009-03-16 http://jamen.do/a/348714
# shareurl
#1 http://www.jamendo.com/artist/1510
#2 http://www.jamendo.com/artist/338873
#3 http://www.jamendo.com/artist/348714
```
### Get information about an artist using the artist id:
```{r, eval = FALSE}
artist <- getArtist(artist_id = "1510")
# id name website joindate shorturl
#1 1510 Judas Priestley http://myspace.com/judaspriestley 2006-03-21 http://jamen.do/a/1510
# shareurl
#1 http://www.jamendo.com/artist/1510
info <- getArtistMusicinfo(artist_name = "Judas Priestley")
# tags
#1 glitch
#2 electronic
#3 ambient
```
### Get information about albums available from a specific artist:
```{r, eval = FALSE}
albums <- getArtistAlbums(artist_id = "1510")
# id name releasedate image
#1 14866 Deuteranopia Utopia 2007-12-04 https://imgjam1.jamendo.com/albums/s14/14866/covers/1.200.jpg
```
### Get songs from a specific album:
```{r, eval = FALSE}
tracks <- getAlbumTracks(album_id = "14866")
# id position name duration license_ccurl
#1 114069 1 Deuteranopia 0 19 http://creativecommons.org/licenses/by-nc-sa/3.0/
#2 113885 2 Deuteranopia 1 402 http://creativecommons.org/licenses/by-nc-sa/3.0/
#3 114063 3 Deuteranopia 2 416 http://creativecommons.org/licenses/by-nc-sa/3.0/
#4 113926 4 Deuteranopia 3 277 http://creativecommons.org/licenses/by-nc-sa/3.0/
#5 113953 5 Deuteranopia 4 387 http://creativecommons.org/licenses/by-nc-sa/3.0/
#6 114050 6 Deuteranopia 6 323 http://creativecommons.org/licenses/by-nc-sa/3.0/
#7 114067 7 Deuteranopia 7 384 http://creativecommons.org/licenses/by-nc-sa/3.0/
#8 114052 8 Deuteranopia 8 93 http://creativecommons.org/licenses/by-nc-sa/3.0/
# audio
#1 https://mp3l.jamendo.com/?trackid=114069&format=mp31&from=app-77b5b682
#2 https://mp3l.jamendo.com/?trackid=113885&format=mp31&from=app-77b5b682
#3 https://mp3l.jamendo.com/?trackid=114063&format=mp31&from=app-77b5b682
#4 https://mp3l.jamendo.com/?trackid=113926&format=mp31&from=app-77b5b682
#5 https://mp3l.jamendo.com/?trackid=113953&format=mp31&from=app-77b5b682
#6 https://mp3l.jamendo.com/?trackid=114050&format=mp31&from=app-77b5b682
#7 https://mp3l.jamendo.com/?trackid=114067&format=mp31&from=app-77b5b682
#8 https://mp3l.jamendo.com/?trackid=114052&format=mp31&from=app-77b5b682
# audiodownload
#1 https://mp3d.jamendo.com/download/track/114069/mp32/
#2 https://mp3d.jamendo.com/download/track/113885/mp32/
#3 https://mp3d.jamendo.com/download/track/114063/mp32/
#4 https://mp3d.jamendo.com/download/track/113926/mp32/
#5 https://mp3d.jamendo.com/download/track/113953/mp32/
#6 https://mp3d.jamendo.com/download/track/114050/mp32/
#7 https://mp3d.jamendo.com/download/track/114067/mp32/
#8 https://mp3d.jamendo.com/download/track/114052/mp32/
info <- getAlbumMusicinfo(album_id = "14866")
# tags
#1 glitch
#2 ambient
#3 triphop
#4 peaceful
ids <- tracks$id
reviews <- getReviewsTracks(ids)
# NULL
```
### Get information about a specific song:
```{r, eval = FALSE}
track <- getTrack(track_name = "Deuteranopia 0")
# id name duration artist_id artist_name album_name album_id
#1 114069 Deuteranopia 0 19 1510 Judas Priestley Deuteranopia Utopia 14866
# license_ccurl position releasedate
#1 http://creativecommons.org/licenses/by-nc-sa/3.0/ 1 2007-12-04
# audio
#1 https://mp3l.jamendo.com/?trackid=114069&format=mp31&from=app-77b5b682
# audiodownload prourl shorturl
#1 https://mp3d.jamendo.com/download/track/114069/mp32/ http://jamen.do/t/114069
# shareurl
#1 http://www.jamendo.com/track/114069
```
### Search Jamendo database for playlists with certain name:
```{r, eval = FALSE}
playlists <- getPlaylistsNamesearch("chill", limit = 3)
# id name creationdate user_id user_name
#1 100086550 Ambiente, Lunge, Chillout 2014-12-03 4014817 mundofascinante.viajes@gmail.com
#2 100268 Chillin 2009-01-19 555416 jdhall75
#3 100276 chillout 2009-01-19 69982 sleeva
# zip shorturl
#1 https://mp3d.jamendo.com/download/p100086550/mp32/ http://jamen.do/l/p100086550
#2 https://mp3d.jamendo.com/download/p100268/mp32/ http://jamen.do/l/p100268
#3 https://mp3d.jamendo.com/download/p100276/mp32/ http://jamen.do/l/p100276
# shareurl
#1 http://www.jamendo.com/list/p100086550
#2 http://www.jamendo.com/list/p100268
#3 http://www.jamendo.com/list/p100276
```