Type: Package
Title: Download 'Scrobbles' from 'Last.fm'
Version: 1.0.3
Author: Conor Neilson
Maintainer: Conor Neilson <condwanaland@gmail.com>
Description: 'Last.fm'https://www.last.fm is a music platform focussed on building a detailed profile of a users listening habits. It does this by 'scrobbling' (recording) every track you listen to on other platforms ('spotify', 'youtube', 'soundcloud' etc) and transferring them to your 'Last.fm' database. This allows 'Last.fm' to act as a complete record of your entire listening history. 'scrobbler' provides helper functions to download and analyse your listening history in R.
License: GPL-3
Encoding: UTF-8
RoxygenNote: 7.1.2
Suggests: testthat, knitr, rmarkdown
URL: https://github.com/condwanaland/scrobbler
BugReports: https://github.com/condwanaland/scrobbler/issues
Imports: httr, jsonlite
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2023-10-15 06:19:08 UTC; conorneilson
Repository: CRAN
Date/Publication: 2023-10-15 06:40:02 UTC

download_scrobbles

Description

download_scrobbles

Usage

download_scrobbles(
  username = get_lastfm_credentials("username"),
  api_key = get_lastfm_credentials("key")
)

Arguments

username

Your last.fm account username

api_key

Your last.fm account api key

Value

A dataframe of songs and associated metadata

Examples

## Not run: 
download_scrobbles(username = "your_username", api_key = "your_api_key")

## End(Not run)

get_last_timestamp

Description

get_last_timestamp

Usage

get_last_timestamp(scrobbles_df, timestamp_column)

Arguments

scrobbles_df

A dataframe output of 'download_scrobbles'

timestamp_column

The column in 'scrobbles_df' that corresponds to the 'date_unix' column

Value

Numeric vector

Examples

## Not run: 
get_last_timestamp(mydata, 'date_unix')

## End(Not run)

get_lastfm_credentials

Description

get_lastfm_credentials

Usage

get_lastfm_credentials(env)

Arguments

env

One of 'username' or 'key', to return the username or key environment variable respectively

Value

Character string

Examples

## Not run: 
get_lastfm_credentials(env = 'username')
get_lastfm_credentials(env = 'key')

## End(Not run)

update_scrobbles

Description

Companion function to 'download_scrobbles'. Only downloads the scrobbles that have been stored since you ran 'download_scrobbles'.

Usage

update_scrobbles(
  data,
  timestamp_column,
  username = get_lastfm_credentials("username"),
  api_key = get_lastfm_credentials("key")
)

Arguments

data

A dataframe outputted by 'download_scrobbles'

timestamp_column

The 'date_unix' column in your dataframe

username

Last.fm API username

api_key

Last.fm API key

Value

A dataframe

Examples

## Not run: 
mydat <- download_scrobbles(username = "your_username", api_key = "your_api_key")
update_dat <- update_scrobbles(mydat,
    "date_unix",
    username = "your_username",
    api_key = "your_api_key")

## End(Not run)