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