Skip to main content

Model reference

Namespace: WebRadioFM.Models.

Local application models​

Track : INotifyPropertyChanged​

PropertyTypeDescription
TitlestringLocal title; setter notifies
ArtiststringLocal artist; setter notifies
AlbumstringLocal album; setter notifies
FilePathstringDeclared but not populated by current loader
DurationTimeSpanLocal media duration; setter notifies
AlbumArtstringDeclared but not populated by current loader
DisplayTextstring (get)Artist + " - " + Title

PropertyChanged is raised with caller member name by protected OnPropertyChanged. Changing Artist/Title does not additionally notify DisplayText.

LastFmSession​

PropertyTypeDescription
SessionKeystringLast.fm sk value
UsernamestringAuthorized account name
IsAuthenticatedbool (get)True when session key is non-empty

Authentication/error contracts​

Defined in LastFmResponses.cs.

ClassJSON shape / members
TokenResponsetoken : string
SessionResponsesession : SessionData
SessionDataname : string, key : string, subscriber : int
ErrorResponseerror : int, message : string

All are [DataContract] with [DataMember(Name = ...)] properties.

Scrobble response contracts​

The following types model Last.fm's detailed scrobble response but current ScrobbleAsync only checks generic API errors and does not deserialize them:

ClassMembers
ScrobbleResponsescrobbles : ScrobblesData
ScrobblesDataattr : ScrobbleAttr mapped from @attr; scrobble : ScrobbleItem[]
ScrobbleAttraccepted : int, ignored : int
ScrobbleItemartist, track, album, timestamp as ScrobbleElement; ignoredMessage
ScrobbleElementtext mapped from #text; corrected : string
IgnoredMessagetext mapped from #text; code : string

Recent tracks​

Defined in LastFmStats.cs.

Wrappers​

ClassMembers
RecentTracksResponserecenttracks : RecentTracksData
RecentTracksDatatrack : List<RecentTrackItem>, attr : PageAttr from @attr

RecentTrackItem​

PropertyType / mapping
artistStatsArtist
namestring
albumStatsAlbum
imageList<StatsImage>
dateStatsDate
attrNowPlayingAttr from @attr
lovedstring
IsNowPlayingderived true when attr.nowplaying == "true"

Shared statistics values​

ClassMembers
StatsArtisttext from #text, mbid
StatsAlbumtext from #text, mbid
StatsDateuts, text from #text
NowPlayingAttrnowplaying string
StatsImagetext from #text, size
PageAttrpage, perPage, totalPages, total — all strings

Top artists​

ClassMembers
TopArtistsResponsetopartists : TopArtistsData
TopArtistsDataartist : List<TopArtistItem>, attr : PageAttr
TopArtistItemname, playcount, listeners, mbid, url, image : List<StatsImage>

Numeric API fields such as play count remain strings.

Top tracks​

ClassMembers
TopTracksResponsetoptracks : TopTracksData
TopTracksDatatrack : List<TopTrackItem>, attr : PageAttr
TopTrackItemname, playcount, listeners, mbid, url, artist : StatsArtist, image

Track information​

ClassMembers
TrackInfoResponsetrack : TrackInfoData
TrackInfoDataname, duration, mbid, url, artist : StatsArtist, album : TrackAlbum
TrackAlbumartist, title, mbid, url, image : List<StatsImage>

The app requests TrackInfoData when album-art fetching is enabled but currently discards the successful callback value.

Serialization guidance​

  • Keep the parameterless public types/properties available to DataContractJsonSerializer.
  • Preserve DataMember names for special keys such as #text and @attr.
  • Model members can be absent/null in real responses; XAML nested bindings generally tolerate null, but code consumers need guards.
  • Add new response variants defensively; Last.fm sometimes varies shapes based on context/cardinality.