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