summaryrefslogtreecommitdiffstats
path: root/xbmc/interfaces/legacy/PlayList.h
blob: 6162945d2b39d5565a3b39a47fc4bf0a061f6ebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "AddonClass.h"
#include "Exception.h"
#include "ListItem.h"
#include "playlists/PlayList.h"

namespace XBMCAddon
{
  namespace xbmc
  {
    XBMCCOMMONS_STANDARD_EXCEPTION(PlayListException);

    //
    /// \defgroup python_PlayList PlayList
    /// \ingroup python_xbmc
    /// @{
    /// @brief **Kodi's Play List class.**
    ///
    /// \python_class{ xbmc.PlayList(playList) }
    ///
    /// To create and edit a playlist which can be handled by the player.
    ///
    /// @param playList              [integer] To define the stream type
    /// | Value | Integer String      | Description                            |
    /// |:-----:|:--------------------|:---------------------------------------|
    /// |   0   | xbmc.PLAYLIST_MUSIC | Playlist for music files or streams    |
    /// |   1   | xbmc.PLAYLIST_VIDEO | Playlist for video files or streams    |
    ///
    ///
    ///
    ///-------------------------------------------------------------------------
    ///
    /// **Example:**
    /// ~~~~~~~~~~~~~{.py}
    /// ...
    /// play=xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    /// ...
    /// ~~~~~~~~~~~~~
    //
    class PlayList : public AddonClass
    {
      int iPlayList;
      PLAYLIST::CPlayList *pPlayList;

    public:
      explicit PlayList(int playList);
      ~PlayList() override;

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ getPlayListId() }
      /// Get the PlayList Identifier
      ///
      /// @return                    Id as an integer.
      ///
      getPlayListId();
#else
      inline int getPlayListId() const { return iPlayList; }
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ add(url[, listitem, index]) }
      /// Adds a new file to the playlist.
      ///
      /// @param url                 string or unicode - filename or url to add.
      /// @param listitem            [opt] listitem - used with setInfo() to set different infolabels.
      /// @param index               [opt] integer - position to add playlist item. (default=end)
      ///
      /// @note You can use the above as keywords for arguments and skip certain optional arguments.\n
      ///       Once you use a keyword, all following arguments require the keyword.
      ///
      ///
      ///--------------------------------------------------------------------------
      ///
      /// **Example:**
      /// ~~~~~~~~~~~~~{.py}
      /// ..
      /// playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
      /// video = 'F:\\movies\\Ironman.mov'
      /// listitem = xbmcgui.ListItem('Ironman', thumbnailImage='F:\\movies\\Ironman.tbn')
      /// listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
      /// playlist.add(url=video, listitem=listitem, index=7)
      /// ..
      /// ~~~~~~~~~~~~~
      ///
      add(...);
#else
      void add(const String& url, XBMCAddon::xbmcgui::ListItem* listitem = NULL, int index = -1);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ load(filename) }
      /// Load a playlist.
      ///
      /// Clear current playlist and copy items from the file to this Playlist
      /// filename can be like .pls or .m3u ...
      ///
      /// @param filename            File with list to play inside
      /// @return                    False if unable to load playlist
      ///
      load(...);
#else
      bool load(const char* filename);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ remove(filename) }
      /// Remove an item with this filename from the playlist.
      ///
      /// @param filename            The file to remove from list.
      ///
      remove(...);
#else
      void remove(const char* filename);
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ clear() }
      /// Clear all items in the playlist.
      ///
      clear();
#else
      void clear();
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ size() }
      /// Returns the total number of PlayListItems in this playlist.
      ///
      /// @return                    Amount of playlist entries.
      ///
      size();
#else
      int size();
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ shuffle() }
      /// Shuffle the playlist.
      ///
      shuffle();
#else
      void shuffle();
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ unshuffle() }
      /// Unshuffle the playlist.
      ///
      unshuffle();
#else
      void unshuffle();
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ getposition() }
      /// Returns the position of the current song in this playlist.
      ///
      /// @return                    Position of the current song
      ///
      getposition();
#else
      int getposition();
#endif

#ifdef DOXYGEN_SHOULD_USE_THIS
      ///
      /// \ingroup python_PlayList
      /// @brief \python_func{ [] }
      /// Retrieve the item at the given position.
      ///
      /// @param i                   Pointer in list
      /// @return                    The selected item on list
      ///
      /// @note A negative index means
      /// from the end rather than from the start.
      ///
      [](...);
#else
      XBMCAddon::xbmcgui::ListItem* operator[](long i);
#endif
    };
    /// @}
  }
}