[ExecString] combine SplitParameters with identical function of CUtil
[xbmc.git] / xbmc / PartyModeManager.h
blob4acb496f2d76630a8e7de37024b32ecda54faf47
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include <memory>
12 #include <string>
13 #include <utility>
14 #include <vector>
16 class CFileItem; typedef std::shared_ptr<CFileItem> CFileItemPtr;
17 class CFileItemList;
18 namespace PLAYLIST
20 using Id = int;
21 class CPlayList;
24 typedef enum
26 PARTYMODECONTEXT_UNKNOWN,
27 PARTYMODECONTEXT_MUSIC,
28 PARTYMODECONTEXT_VIDEO
29 } PartyModeContext;
31 class CPartyModeManager final
33 public:
34 CPartyModeManager(void);
36 bool Enable(PartyModeContext context=PARTYMODECONTEXT_MUSIC, const std::string& strXspPath = "");
37 void Disable();
38 void Play(int iPos);
39 void OnSongChange(bool bUpdatePlayed = false);
40 void AddUserSongs(PLAYLIST::CPlayList& tempList, bool bPlay = false);
41 void AddUserSongs(CFileItemList& tempList, bool bPlay = false);
42 bool IsEnabled(PartyModeContext context=PARTYMODECONTEXT_UNKNOWN) const;
43 int GetSongsPlayed();
44 int GetMatchingSongs();
45 int GetMatchingSongsPicked();
46 int GetMatchingSongsLeft();
47 int GetRelaxedSongs();
48 int GetRandomSongs();
49 PartyModeContext GetType() const;
51 private:
52 void Process();
53 bool AddRandomSongs();
54 void Add(CFileItemPtr &pItem);
55 bool ReapSongs();
56 bool MovePlaying();
57 void SendUpdateMessage();
58 void OnError(int iError, const std::string& strLogMessage);
59 void ClearState();
60 void UpdateStats();
61 void Announce();
62 PLAYLIST::Id GetPlaylistId() const;
64 // state
65 bool m_bEnabled;
66 bool m_bIsVideo;
67 int m_iLastUserSong;
68 std::string m_type;
70 // statistics
71 int m_iSongsPlayed;
72 int m_iMatchingSongs;
73 int m_iMatchingSongsPicked;
74 int m_iMatchingSongsLeft;
75 int m_iRelaxedSongs;
76 int m_iRandomSongs;
78 // history
79 std::vector<std::pair<int, int>> m_songIDCache;
82 extern CPartyModeManager g_partyModeManager;