2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "MusicFileDirectory.h"
23 #include "guilib/LocalizeStrings.h"
24 #include "utils/URIUtils.h"
25 #include "utils/StringUtils.h"
27 using namespace MUSIC_INFO;
28 using namespace XFILE;
30 CMusicFileDirectory::CMusicFileDirectory(void)
34 CMusicFileDirectory::~CMusicFileDirectory(void)
38 bool CMusicFileDirectory::GetDirectory(const CStdString& strPath1, CFileItemList &items)
40 CStdString strPath=strPath1;
42 CStdString strFileName;
43 strFileName = URIUtils::GetFileName(strPath);
44 URIUtils::RemoveExtension(strFileName);
46 int iStreams = GetTrackCount(strPath1);
48 URIUtils::AddSlashAtEnd(strPath);
50 for (int i=0; i<iStreams; ++i)
52 CStdString strLabel = StringUtils::Format("%s - %s %02.2i", strFileName.c_str(), g_localizeStrings.Get(554).c_str(), i+1);
53 CFileItemPtr pItem(new CFileItem(strLabel));
54 strLabel = StringUtils::Format("%s%s-%i.%s", strPath.c_str(), strFileName.c_str(), i+1, m_strExt.c_str());
55 pItem->SetPath(strLabel);
58 *pItem->GetMusicInfoTag() = m_tag;
60 pItem->GetMusicInfoTag()->SetTrackNumber(i+1);
67 bool CMusicFileDirectory::Exists(const char* strPath)
72 bool CMusicFileDirectory::ContainsFiles(const CStdString& strPath)
74 if (GetTrackCount(strPath) > 1)