Struct ScrobbleEdit

Source
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 instances

Fields§

§track_name_original: String

Original track name as it appears in the scrobble

§album_name_original: String

Original album name as it appears in the scrobble

§artist_name_original: String

Original artist name as it appears in the scrobble

§album_artist_name_original: String

Original album artist name as it appears in the scrobble

§track_name: String

New track name to set

§album_name: String

New album name to set

§artist_name: String

New artist name to set

§album_artist_name: String

New album artist name to set

§timestamp: u64

Unix timestamp of the scrobble to edit

This identifies the specific scrobble instance to modify.

§edit_all: bool

Whether 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

Source

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 scrobble
  • album_name_original - The current album name in the scrobble
  • artist_name_original - The current artist name in the scrobble
  • album_artist_name_original - The current album artist name in the scrobble
  • track_name - The new track name to set
  • album_name - The new album name to set
  • artist_name - The new artist name to set
  • album_artist_name - The new album artist name to set
  • timestamp - Unix timestamp identifying the scrobble
  • edit_all - Whether to edit all matching scrobbles or just this one
Source

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 name
  • original_album - The current album name
  • original_artist - The current artist name
  • timestamp - 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)");
Source

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");
Source

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");
Source

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");
Source

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 instances

Trait Implementations§

Source§

impl Clone for ScrobbleEdit

Source§

fn clone(&self) -> ScrobbleEdit

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScrobbleEdit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,