[windows] Fix MAC Address Discovery
[xbmc.git] / xbmc / filesystem / PlaylistDirectory.cpp
blobf656c77dab2771803ef66a767f1de42d560dccfc
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 #include "PlaylistDirectory.h"
11 #include "FileItem.h"
12 #include "FileItemList.h"
13 #include "PlayListPlayer.h"
14 #include "ServiceBroker.h"
15 #include "URL.h"
16 #include "playlists/PlayList.h"
18 using namespace XFILE;
20 CPlaylistDirectory::CPlaylistDirectory() = default;
22 CPlaylistDirectory::~CPlaylistDirectory() = default;
24 bool CPlaylistDirectory::GetDirectory(const CURL& url, CFileItemList &items)
26 PLAYLIST::Id playlistId = PLAYLIST::TYPE_NONE;
27 if (url.IsProtocol("playlistmusic"))
28 playlistId = PLAYLIST::TYPE_MUSIC;
29 else if (url.IsProtocol("playlistvideo"))
30 playlistId = PLAYLIST::TYPE_VIDEO;
32 if (playlistId == PLAYLIST::TYPE_NONE)
33 return false;
35 const PLAYLIST::CPlayList& playlist = CServiceBroker::GetPlaylistPlayer().GetPlaylist(playlistId);
36 items.Reserve(playlist.size());
38 for (int i = 0; i < playlist.size(); ++i)
40 CFileItemPtr item = playlist[i];
41 item->SetProperty("playlistposition", i);
42 item->SetProperty("playlisttype", playlistId);
43 //item->m_iprogramCount = i; // the programCount is set as items are added!
44 items.Add(item);
47 return true;