pub struct ScrobbleEdit {
pub track_name_original: String,
pub album_name_original: String,
pub artist_name_original: String,
pub album_artist_name_original: String,
pub track_name: String,
pub album_name: String,
pub artist_name: String,
pub album_artist_name: String,
pub timestamp: u64,
pub edit_all: bool,
}Expand description
Represents a scrobble edit operation.
This structure contains all the information needed to edit a specific scrobble on Last.fm, including both the original and new metadata values.
§Examples
use lastfm_edit::ScrobbleEdit;
// Create an edit to fix a track name
let edit = ScrobbleEdit::from_track_info(
"Paranoid Andriod", // original (misspelled)
"OK Computer",
"Radiohead",
1640995200
)
.with_track_name("Paranoid Android"); // corrected
// Create an edit to change artist name
let edit = ScrobbleEdit::from_track_info(
"Creep",
"Pablo Honey",
"Radio Head", // original (wrong)
1640995200
)
.with_artist_name("Radiohead") // corrected
.with_edit_all(true); // update all instancesFields§
§track_name_original: StringOriginal track name as it appears in the scrobble
album_name_original: StringOriginal album name as it appears in the scrobble
artist_name_original: StringOriginal artist name as it appears in the scrobble
album_artist_name_original: StringOriginal album artist name as it appears in the scrobble
track_name: StringNew track name to set
album_name: StringNew album name to set
artist_name: StringNew artist name to set
album_artist_name: StringNew album artist name to set
timestamp: u64Unix timestamp of the scrobble to edit
This identifies the specific scrobble instance to modify.
edit_all: boolWhether to edit all instances or just this specific scrobble
When true, Last.fm will update all scrobbles with matching metadata.
When false, only this specific scrobble (identified by timestamp) is updated.
Implementations§
Source§impl ScrobbleEdit
impl ScrobbleEdit
Sourcepub fn new(
track_name_original: String,
album_name_original: String,
artist_name_original: String,
album_artist_name_original: String,
track_name: String,
album_name: String,
artist_name: String,
album_artist_name: String,
timestamp: u64,
edit_all: bool,
) -> Self
pub fn new( track_name_original: String, album_name_original: String, artist_name_original: String, album_artist_name_original: String, track_name: String, album_name: String, artist_name: String, album_artist_name: String, timestamp: u64, edit_all: bool, ) -> Self
Create a new ScrobbleEdit with all required fields.
This is the most general constructor that allows setting all fields.
For convenience, consider using from_track_info instead.
§Arguments
track_name_original- The current track name in the scrobblealbum_name_original- The current album name in the scrobbleartist_name_original- The current artist name in the scrobblealbum_artist_name_original- The current album artist name in the scrobbletrack_name- The new track name to setalbum_name- The new album name to setartist_name- The new artist name to setalbum_artist_name- The new album artist name to settimestamp- Unix timestamp identifying the scrobbleedit_all- Whether to edit all matching scrobbles or just this one
Sourcepub fn from_track_info(
original_track: &str,
original_album: &str,
original_artist: &str,
timestamp: u64,
) -> Self
pub fn from_track_info( original_track: &str, original_album: &str, original_artist: &str, timestamp: u64, ) -> Self
Create an edit request from track information (convenience constructor).
This constructor creates a ScrobbleEdit with the new values initially
set to the same as the original values. Use the builder methods like
with_track_name to specify what should be changed.
§Arguments
original_track- The current track nameoriginal_album- The current album nameoriginal_artist- The current artist nametimestamp- Unix timestamp identifying the scrobble
§Examples
use lastfm_edit::ScrobbleEdit;
let edit = ScrobbleEdit::from_track_info(
"Highway to Hell",
"Highway to Hell",
"AC/DC",
1640995200
)
.with_track_name("Highway to Hell (Remastered)");Sourcepub fn with_track_name(self, track_name: &str) -> Self
pub fn with_track_name(self, track_name: &str) -> Self
Set the new track name.
§Examples
let edit = ScrobbleEdit::from_track_info("Wrong Name", "Album", "Artist", 1640995200)
.with_track_name("Correct Name");Sourcepub fn with_album_name(self, album_name: &str) -> Self
pub fn with_album_name(self, album_name: &str) -> Self
Set the new album name.
§Examples
let edit = ScrobbleEdit::from_track_info("Track", "Wrong Album", "Artist", 1640995200)
.with_album_name("Correct Album");Sourcepub fn with_artist_name(self, artist_name: &str) -> Self
pub fn with_artist_name(self, artist_name: &str) -> Self
Set the new artist name.
This also sets the album artist name to the same value.
§Examples
let edit = ScrobbleEdit::from_track_info("Track", "Album", "Wrong Artist", 1640995200)
.with_artist_name("Correct Artist");Sourcepub fn with_edit_all(self, edit_all: bool) -> Self
pub fn with_edit_all(self, edit_all: bool) -> Self
Set whether to edit all instances of this track.
When true, Last.fm will update all scrobbles with the same metadata.
When false (default), only the specific scrobble is updated.
§Examples
let edit = ScrobbleEdit::from_track_info("Track", "Album", "Artist", 1640995200)
.with_track_name("New Name")
.with_edit_all(true); // Update all instancesTrait Implementations§
Source§impl Clone for ScrobbleEdit
impl Clone for ScrobbleEdit
Source§fn clone(&self) -> ScrobbleEdit
fn clone(&self) -> ScrobbleEdit
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more