summaryrefslogtreecommitdiffstats
path: root/xbmc/dialogs/GUIDialogMediaSource.cpp
blob: 13b13e5fab6e60fb93c4bb52011c1c921d8acc2d (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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
/*
 *  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.
 */

#include "GUIDialogMediaSource.h"
#include "ServiceBroker.h"
#include "guilib/GUIKeyboardFactory.h"
#include "GUIDialogFileBrowser.h"
#include "video/windows/GUIWindowVideoBase.h"
#include "music/windows/GUIWindowMusicBase.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIWindowManager.h"
#include "input/Key.h"
#include "Util.h"
#include "utils/URIUtils.h"
#include "utils/StringUtils.h"
#include "utils/Variant.h"
#include "filesystem/Directory.h"
#include "filesystem/PVRDirectory.h"
#include "GUIDialogYesNo.h"
#include "FileItem.h"
#include "settings/MediaSourceSettings.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "guilib/LocalizeStrings.h"
#include "PasswordManager.h"
#include "URL.h"
#include "pvr/recordings/PVRRecordingsPath.h"

#if defined(TARGET_ANDROID)
#include "utils/FileUtils.h"

#include "platform/android/activity/XBMCApp.h"
#endif

#ifdef TARGET_WINDOWS_STORE
#include "platform/win10/filesystem/WinLibraryDirectory.h"
#endif

using namespace XFILE;

#define CONTROL_HEADING          2
#define CONTROL_PATH            10
#define CONTROL_PATH_BROWSE     11
#define CONTROL_NAME            12
#define CONTROL_PATH_ADD        13
#define CONTROL_PATH_REMOVE     14
#define CONTROL_OK              18
#define CONTROL_CANCEL          19
#define CONTROL_CONTENT         20

CGUIDialogMediaSource::CGUIDialogMediaSource(void)
    : CGUIDialog(WINDOW_DIALOG_MEDIA_SOURCE, "DialogMediaSource.xml")
{
  m_paths = new CFileItemList;
  m_loadType = KEEP_IN_MEMORY;
}

CGUIDialogMediaSource::~CGUIDialogMediaSource()
{
  delete m_paths;
}

bool CGUIDialogMediaSource::OnBack(int actionID)
{
  m_confirmed = false;
  return CGUIDialog::OnBack(actionID);
}

bool CGUIDialogMediaSource::OnMessage(CGUIMessage& message)
{
  switch (message.GetMessage())
  {
  case GUI_MSG_CLICKED:
  {
    int iControl = message.GetSenderId();
    int iAction = message.GetParam1();
    if (iControl == CONTROL_PATH && (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK))
      OnPath(GetSelectedItem());
    else if (iControl == CONTROL_PATH_BROWSE)
      OnPathBrowse(GetSelectedItem());
    else if (iControl == CONTROL_PATH_ADD)
      OnPathAdd();
    else if (iControl == CONTROL_PATH_REMOVE)
      OnPathRemove(GetSelectedItem());
    else if (iControl == CONTROL_NAME)
    {
      OnEditChanged(iControl, m_name);
      UpdateButtons();
    }
    else if (iControl == CONTROL_OK)
      OnOK();
    else if (iControl == CONTROL_CANCEL)
      OnCancel();
    else
      break;
    return true;
  }
  break;
  case GUI_MSG_WINDOW_INIT:
  {
    UpdateButtons();
  }
  break;
  case GUI_MSG_SETFOCUS:
    if (message.GetControlId() == CONTROL_PATH_BROWSE ||
      message.GetControlId() == CONTROL_PATH_ADD ||
      message.GetControlId() == CONTROL_PATH_REMOVE)
    {
      HighlightItem(GetSelectedItem());
    }
    else
      HighlightItem(-1);
    break;
  }
  return CGUIDialog::OnMessage(message);
}

// \brief Show CGUIDialogMediaSource dialog and prompt for a new media source.
// \return True if the media source is added, false otherwise.
bool CGUIDialogMediaSource::ShowAndAddMediaSource(const std::string &type)
{
  CGUIDialogMediaSource *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogMediaSource>(WINDOW_DIALOG_MEDIA_SOURCE);
  if (!dialog) return false;
  dialog->Initialize();
  dialog->SetShare(CMediaSource());
  dialog->SetTypeOfMedia(type);
  dialog->Open();
  bool confirmed(dialog->IsConfirmed());
  if (confirmed)
  {
    // Add this media source
    // Get unique source name
    std::string strName = dialog->GetUniqueMediaSourceName();

    CMediaSource share;
    share.FromNameAndPaths(type, strName, dialog->GetPaths());
    if (dialog->m_paths->Size() > 0)
      share.m_strThumbnailImage = dialog->m_paths->Get(0)->GetArt("thumb");
    CMediaSourceSettings::GetInstance().AddShare(type, share);
    OnMediaSourceChanged(type, "", share);
  }
  dialog->m_paths->Clear();
  return confirmed;
}

bool CGUIDialogMediaSource::ShowAndEditMediaSource(const std::string &type, const std::string&share)
{
  VECSOURCES* pShares = CMediaSourceSettings::GetInstance().GetSources(type);
  if (pShares)
  {
    for (unsigned int i = 0;i<pShares->size();++i)
    {
      if (StringUtils::EqualsNoCase((*pShares)[i].strName, share))
        return ShowAndEditMediaSource(type, (*pShares)[i]);
    }
  }
  return false;
}

bool CGUIDialogMediaSource::ShowAndEditMediaSource(const std::string &type, const CMediaSource &share)
{
  std::string strOldName = share.strName;
  CGUIDialogMediaSource *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogMediaSource>(WINDOW_DIALOG_MEDIA_SOURCE);
  if (!dialog) return false;
  dialog->Initialize();
  dialog->SetShare(share);
  dialog->SetTypeOfMedia(type, true);
  dialog->Open();
  bool confirmed(dialog->IsConfirmed());
  if (confirmed)
  {
    // Update media source
    // Get unique new source name when changed
    std::string strName(dialog->m_name);
    if (!StringUtils::EqualsNoCase(dialog->m_name, strOldName))
      strName = dialog->GetUniqueMediaSourceName();

    CMediaSource newShare;
    newShare.FromNameAndPaths(type, strName, dialog->GetPaths());
    CMediaSourceSettings::GetInstance().UpdateShare(type, strOldName, newShare);

    OnMediaSourceChanged(type, strOldName, newShare);
  }
  dialog->m_paths->Clear();
  return confirmed;
}

std::string CGUIDialogMediaSource::GetUniqueMediaSourceName()
{
  // Get unique source name for this media type
  unsigned int i, j = 2;
  bool bConfirmed = false;
  VECSOURCES* pShares = CMediaSourceSettings::GetInstance().GetSources(m_type);
  std::string strName = m_name;
  while (!bConfirmed)
  {
    for (i = 0; i<pShares->size(); ++i)
    {
      if (StringUtils::EqualsNoCase((*pShares)[i].strName, strName))
        break;
    }
    if (i < pShares->size())
      // found a match -  try next
      strName = StringUtils::Format("{} ({})", m_name, j++);
    else
      bConfirmed = true;
  }
  return strName;
}

void CGUIDialogMediaSource::OnMediaSourceChanged(const std::string& type, const std::string& oldName, const CMediaSource& share)
{
  // Processing once media source added/edited - library scraping and scanning
  if (!StringUtils::StartsWithNoCase(share.strPath, "rss://") &&
    !StringUtils::StartsWithNoCase(share.strPath, "rsss://") &&
    !StringUtils::StartsWithNoCase(share.strPath, "upnp://"))
  {
    if (type == "video" && !URIUtils::IsLiveTV(share.strPath))
      // Assign content to a path, refresh scraper information optionally start a scan
      CGUIWindowVideoBase::OnAssignContent(share.strPath);
    else if (type == "music")
      CGUIWindowMusicBase::OnAssignContent(oldName, share);
  }
}

void CGUIDialogMediaSource::OnPathBrowse(int item)
{
  if (item < 0 || item >= m_paths->Size()) return;
  // Browse is called.  Open the filebrowser dialog.
  // Ignore current path is best at this stage??
  std::string path = m_paths->Get(item)->GetPath();
  bool allowNetworkShares(m_type != "programs");
  VECSOURCES extraShares;

  if (m_name != CUtil::GetTitleFromPath(path))
    m_bNameChanged = true;
  path.clear();

  if (m_type == "music")
  {
    CMediaSource share1;
#if defined(TARGET_ANDROID)
    // add the default android music directory
    std::string path;
    if (CXBMCApp::GetExternalStorage(path, "music") && !path.empty() && CDirectory::Exists(path))
    {
      share1.strPath = path;
      share1.strName = g_localizeStrings.Get(20240);
      share1.m_ignore = true;
      extraShares.push_back(share1);
    }
#endif

#if defined(TARGET_WINDOWS_STORE)
    // add the default UWP music directory
    std::string path;
    if (XFILE::CWinLibraryDirectory::GetStoragePath(m_type, path) && !path.empty() && CDirectory::Exists(path))
    {
      share1.strPath = path;
      share1.strName = g_localizeStrings.Get(20245);
      share1.m_ignore = true;
      extraShares.push_back(share1);
    }
#endif

    // add the music playlist location
    share1.strPath = "special://musicplaylists/";
    share1.strName = g_localizeStrings.Get(20011);
    share1.m_ignore = true;
    extraShares.push_back(share1);

    // add the recordings dir as needed
    if (CPVRDirectory::HasRadioRecordings())
    {
      share1.strPath = PVR::CPVRRecordingsPath::PATH_ACTIVE_RADIO_RECORDINGS;
      share1.strName = g_localizeStrings.Get(19017); // Recordings
      extraShares.push_back(share1);
    }
    if (CPVRDirectory::HasDeletedRadioRecordings())
    {
      share1.strPath = PVR::CPVRRecordingsPath::PATH_DELETED_RADIO_RECORDINGS;
      share1.strName = g_localizeStrings.Get(19184); // Deleted recordings
      extraShares.push_back(share1);
    }

    if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_AUDIOCDS_RECORDINGPATH) != "")
    {
      share1.strPath = "special://recordings/";
      share1.strName = g_localizeStrings.Get(21883);
      extraShares.push_back(share1);
    }
  }
  else if (m_type == "video")
  {
    CMediaSource share1;
#if defined(TARGET_ANDROID)
    // add the default android video directory
    std::string path;
    if (CXBMCApp::GetExternalStorage(path, "videos") && !path.empty() && CFileUtils::Exists(path))
    {
      share1.strPath = path;
      share1.strName = g_localizeStrings.Get(20241);
      share1.m_ignore = true;
      extraShares.push_back(share1);
    }
#endif
#if defined(TARGET_WINDOWS_STORE)
    // add the default UWP music directory
    std::string path;
    if (XFILE::CWinLibraryDirectory::GetStoragePath(m_type, path) && !path.empty() && CDirectory::Exists(path))
    {
      share1.strPath = path;
      share1.strName = g_localizeStrings.Get(20246);
      share1.m_ignore = true;
      extraShares.push_back(share1);
    }
#endif

    // add the video playlist location
    share1.m_ignore = true;
    share1.strPath = "special://videoplaylists/";
    share1.strName = g_localizeStrings.Get(20012);
    extraShares.push_back(share1);

    // add the recordings dir as needed
    if (CPVRDirectory::HasTVRecordings())
    {
      share1.strPath = PVR::CPVRRecordingsPath::PATH_ACTIVE_TV_RECORDINGS;
      share1.strName = g_localizeStrings.Get(19017); // Recordings
      extraShares.push_back(share1);
    }
    if (CPVRDirectory::HasDeletedTVRecordings())
    {
      share1.strPath = PVR::CPVRRecordingsPath::PATH_DELETED_TV_RECORDINGS;
      share1.strName = g_localizeStrings.Get(19184); // Deleted recordings
      extraShares.push_back(share1);
    }
  }
  else if (m_type == "pictures")
  {
    CMediaSource share1;
#if defined(TARGET_ANDROID)
    // add the default android music directory
    std::string path;
    if (CXBMCApp::GetExternalStorage(path, "pictures") && !path.empty() && CFileUtils::Exists(path))
    {
      share1.strPath = path;
      share1.strName = g_localizeStrings.Get(20242);
      share1.m_ignore = true;
      extraShares.push_back(share1);
    }

    path.clear();
    if (CXBMCApp::GetExternalStorage(path, "photos") && !path.empty() && CFileUtils::Exists(path))
    {
      share1.strPath = path;
      share1.strName = g_localizeStrings.Get(20243);
      share1.m_ignore = true;
      extraShares.push_back(share1);
    }
#endif
#if defined(TARGET_WINDOWS_STORE)
    // add the default UWP music directory
    std::string path;
    if (XFILE::CWinLibraryDirectory::GetStoragePath(m_type, path) && !path.empty() && CDirectory::Exists(path))
    {
      share1.strPath = path;
      share1.strName = g_localizeStrings.Get(20247);
      share1.m_ignore = true;
      extraShares.push_back(share1);
    }
    path.clear();
    if (XFILE::CWinLibraryDirectory::GetStoragePath("photos", path) && !path.empty() && CDirectory::Exists(path))
    {
      share1.strPath = path;
      share1.strName = g_localizeStrings.Get(20248);
      share1.m_ignore = true;
      extraShares.push_back(share1);
    }
#endif

    share1.m_ignore = true;
    if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_DEBUG_SCREENSHOTPATH) != "")
    {
      share1.strPath = "special://screenshots/";
      share1.strName = g_localizeStrings.Get(20008);
      extraShares.push_back(share1);
    }
  }
  else if (m_type == "games")
  {
    // nothing to add
  }
  else if (m_type == "programs")
  {
    // nothing to add
  }
  if (CGUIDialogFileBrowser::ShowAndGetSource(path, allowNetworkShares, extraShares.size() == 0 ? NULL : &extraShares))
  {
    if (item < m_paths->Size()) // if the skin does funky things, m_paths may have been cleared
      m_paths->Get(item)->SetPath(path);
    if (!m_bNameChanged || m_name.empty())
    {
      CURL url(path);
      m_name = url.GetWithoutUserDetails();
      URIUtils::RemoveSlashAtEnd(m_name);
      m_name = CUtil::GetTitleFromPath(m_name);
    }
    UpdateButtons();
  }
}

void CGUIDialogMediaSource::OnPath(int item)
{
  if (item < 0 || item >= m_paths->Size()) return;

  std::string path(m_paths->Get(item)->GetPath());
  if (m_name != CUtil::GetTitleFromPath(path))
    m_bNameChanged = true;

  CGUIKeyboardFactory::ShowAndGetInput(path, CVariant{ g_localizeStrings.Get(1021) }, false);
  m_paths->Get(item)->SetPath(path);

  if (!m_bNameChanged || m_name.empty())
  {
    CURL url(m_paths->Get(item)->GetPath());
    m_name = url.GetWithoutUserDetails();
    URIUtils::RemoveSlashAtEnd(m_name);
    m_name = CUtil::GetTitleFromPath(m_name);
  }
  UpdateButtons();
}

void CGUIDialogMediaSource::OnOK()
{
  // Verify the paths by doing a GetDirectory.
  CFileItemList items;

  // Create temp media source to encode path urls as multipath
  // Name of actual source may need to be made unique when saved in sources
  CMediaSource share;
  share.FromNameAndPaths(m_type, m_name, GetPaths());

  if (StringUtils::StartsWithNoCase(share.strPath, "plugin://") ||
    CDirectory::GetDirectory(share.strPath, items, "", DIR_FLAG_NO_FILE_DIRS | DIR_FLAG_ALLOW_PROMPT) ||
    CGUIDialogYesNo::ShowAndGetInput(CVariant{ 1001 }, CVariant{ 1025 }))
  {
    m_confirmed = true;
    Close();
  }
}

void CGUIDialogMediaSource::OnCancel()
{
  m_confirmed = false;
  Close();
}

void CGUIDialogMediaSource::UpdateButtons()
{
  if (!m_paths->Size()) // sanity
    return;

  CONTROL_ENABLE_ON_CONDITION(CONTROL_OK, !m_paths->Get(0)->GetPath().empty() && !m_name.empty());
  CONTROL_ENABLE_ON_CONDITION(CONTROL_PATH_ADD, !m_paths->Get(0)->GetPath().empty());
  CONTROL_ENABLE_ON_CONDITION(CONTROL_PATH_REMOVE, m_paths->Size() > 1);
  // name
  SET_CONTROL_LABEL2(CONTROL_NAME, m_name);
  SendMessage(GUI_MSG_SET_TYPE, CONTROL_NAME, 0, 1022);

  int currentItem = GetSelectedItem();
  SendMessage(GUI_MSG_LABEL_RESET, CONTROL_PATH);
  for (int i = 0; i < m_paths->Size(); i++)
  {
    CFileItemPtr item = m_paths->Get(i);
    std::string path;
    CURL url(item->GetPath());
    path = url.GetWithoutUserDetails();
    if (path.empty()) path = "<" + g_localizeStrings.Get(231) + ">"; // <None>
    item->SetLabel(path);
  }
  CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_PATH, 0, 0, m_paths);
  OnMessage(msg);
  SendMessage(GUI_MSG_ITEM_SELECT, CONTROL_PATH, currentItem);

  SET_CONTROL_HIDDEN(CONTROL_CONTENT);
}

void CGUIDialogMediaSource::SetShare(const CMediaSource &share)
{
  m_paths->Clear();
  for (unsigned int i = 0; i < share.vecPaths.size(); i++)
  {
    CFileItemPtr item(new CFileItem(share.vecPaths[i], true));
    m_paths->Add(item);
  }
  if (0 == share.vecPaths.size())
  {
    CFileItemPtr item(new CFileItem("", true));
    m_paths->Add(item);
  }
  m_name = share.strName;
  UpdateButtons();
}

void CGUIDialogMediaSource::SetTypeOfMedia(const std::string &type, bool editNotAdd)
{
  m_type = type;
  std::string heading;
  if (editNotAdd)
  {
    if (type == "video")
      heading = g_localizeStrings.Get(10053);
    else if (type == "music")
      heading = g_localizeStrings.Get(10054);
    else if (type == "pictures")
      heading = g_localizeStrings.Get(10055);
    else if (type == "games")
      heading = g_localizeStrings.Get(35252); // "Edit game source"
    else if (type == "programs")
      heading = g_localizeStrings.Get(10056);
    else
      heading = g_localizeStrings.Get(10057);
  }
  else
  {
    if (type == "video")
      heading = g_localizeStrings.Get(10048);
    else if (type == "music")
      heading = g_localizeStrings.Get(10049);
    else if (type == "pictures")
      heading = g_localizeStrings.Get(13006);
    else if (type == "games")
      heading = g_localizeStrings.Get(35251); // "Add game source"
    else if (type == "programs")
      heading = g_localizeStrings.Get(10051);
    else
      heading = g_localizeStrings.Get(10052);
  }
  SET_CONTROL_LABEL(CONTROL_HEADING, heading);
}

int CGUIDialogMediaSource::GetSelectedItem()
{
  CGUIMessage message(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_PATH);
  OnMessage(message);
  int value = message.GetParam1();
  if (value < 0 || value >= m_paths->Size()) return 0;
  return value;
}

void CGUIDialogMediaSource::HighlightItem(int item)
{
  for (int i = 0; i < m_paths->Size(); i++)
    m_paths->Get(i)->Select(false);
  if (item >= 0 && item < m_paths->Size())
    m_paths->Get(item)->Select(true);
  CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), CONTROL_PATH, item);
  OnMessage(msg);
}

void CGUIDialogMediaSource::OnPathRemove(int item)
{
  m_paths->Remove(item);
  UpdateButtons();
  if (item >= m_paths->Size())
    HighlightItem(m_paths->Size() - 1);
  else
    HighlightItem(item);
  if (m_paths->Size() <= 1)
  {
    SET_CONTROL_FOCUS(CONTROL_PATH_ADD, 0);
  }
}

void CGUIDialogMediaSource::OnPathAdd()
{
  // add a new item and select it as well
  CFileItemPtr item(new CFileItem("", true));
  m_paths->Add(item);
  UpdateButtons();
  HighlightItem(m_paths->Size() - 1);
}

std::vector<std::string> CGUIDialogMediaSource::GetPaths() const
{
  std::vector<std::string> paths;
  for (int i = 0; i < m_paths->Size(); i++)
  {
    if (!m_paths->Get(i)->GetPath().empty())
    { // strip off the user and password for supported paths (anything that the password manager can auth)
      // and add the user/pass to the password manager - note, we haven't confirmed that it works
      // at this point, but if it doesn't, the user will get prompted anyway in implementation.
      CURL url(m_paths->Get(i)->GetPath());
      if (CPasswordManager::GetInstance().IsURLSupported(url) && !url.GetUserName().empty())
      {
        CPasswordManager::GetInstance().SaveAuthenticatedURL(url);
        url.SetPassword("");
        url.SetUserName("");
        url.SetDomain("");
      }
      paths.push_back(url.Get());
    }
  }
  return paths;
}

void CGUIDialogMediaSource::OnDeinitWindow(int nextWindowID)
{
  CGUIDialog::OnDeinitWindow(nextWindowID);

  // clear paths container
  CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PATH, 0);
  OnMessage(msg);
}