xref: /MusicPlayer2/MusicPlayer2/LastFMDataArchive.h (revision 7a904577a34af07f5ae4438553a7e362aeb87006)
1 #pragma once
2 #include "SongInfo.h"
3 
4 class LastFMTrack {
5     public:
6         /// The artist name.
7         wstring artist;
8         /// The track name.
9         wstring track;
10         /// The time the track started playing, in UNIX timestamp format (integer number of seconds since 00:00:00, January 1st 1970 UTC). This must be in the UTC time zone.
11         uint64_t timestamp;
12         /// The album name.
13         wstring album;
14         /// The stream id for this track received from the radio.getPlaylist service, if scrobbling Last.fm radio
15         wstring streamId;
16         /// Set to 1 if the user chose this song, or 0 if the song was chosen by someone else (such as a radio station or recommendation service). Assumes 1 if not specified
17         bool chosenByUser = true;
18         /// The track number of the track on the album.
19         uint16_t trackNumber;
20         /// The MusicBrainz Track ID.
21         wstring mbid;
22         /// The album artist - if this differs from the track artist.
23         wstring albumArtist;
24         /// The length of the track in seconds.
25         Time duration;
26         void Clear();
27         void SaveDataTo(CArchive &archive);
28         void ReadDataFrom(CArchive &archive);
29         void ReadDataFrom(const SongInfo& info);
30         bool operator==(const LastFMTrack& track);
31         bool operator==(const SongInfo& info);
32 };
33 
34 class LastFMDataArchive {
35 public:
36     /// The origin track information of current track.
37     LastFMTrack current_track;
38     /// The track information of current track after corrected.
39     LastFMTrack corrected_current_track;
40     /// The list of tracks are not scrobbed.
41     std::list<LastFMTrack> cached_tracks;
42     /// A session key generated by authenticating a user via the authentication protocol.
43     wstring session_key;
44     /// User name
45     wstring user_name;
46     /// The played time for current song in millisecond.
47     int32_t current_played_time;
48     /// The current song is pushed to cache list or not.
49     bool is_pushed;
50     void SaveData(wstring path);
51     void LoadData(wstring path);
52 };
53