/// \brief Save current playlist to playlist folder void CGUIWindowVideoPlaylist::SavePlayList() { CStdString strNewFileName; if (CGUIKeyboardFactory::ShowAndGetInput(strNewFileName, g_localizeStrings.Get(16012), false)) { // need 2 rename it CStdString strFolder = URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "video"); strNewFileName = CUtil::MakeLegalFileName(strNewFileName); strNewFileName += ".m3u"; CStdString strPath = URIUtils::AddFileToFolder(strFolder, strNewFileName); CPlayListM3U playlist; playlist.Add(*m_vecItems); CLog::Log(LOGDEBUG, "Saving video playlist: [%s]", strPath.c_str()); playlist.Save(strPath); } }
/// \brief Save current playlist to playlist folder void CGUIWindowVideoPlaylist::SavePlayList() { std::string strNewFileName; if (CGUIKeyboardFactory::ShowAndGetInput(strNewFileName, CVariant{g_localizeStrings.Get(16012)}, false)) { // need 2 rename it std::string strFolder = URIUtils::AddFileToFolder(CSettings::GetInstance().GetString(CSettings::SETTING_SYSTEM_PLAYLISTSPATH), "video"); strNewFileName = CUtil::MakeLegalFileName(strNewFileName); strNewFileName += ".m3u"; std::string strPath = URIUtils::AddFileToFolder(strFolder, strNewFileName); CPlayListM3U playlist; playlist.Add(*m_vecItems); CLog::Log(LOGDEBUG, "Saving video playlist: [%s]", strPath.c_str()); playlist.Save(strPath); } }
void CGUIWindowMusicPlayList::SavePlayList() { CStdString strNewFileName; if (CGUIKeyboardFactory::ShowAndGetInput(strNewFileName, g_localizeStrings.Get(16012), false)) { // need 2 rename it CStdString strFolder, strPath; URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "music", strFolder); strNewFileName= CUtil::MakeLegalFileName( strNewFileName ); strNewFileName += ".m3u"; URIUtils::AddFileToFolder(strFolder, strNewFileName, strPath); // get selected item int iItem = m_viewControl.GetSelectedItem(); CStdString strSelectedItem = ""; if (iItem >= 0 && iItem < m_vecItems->Size()) { CFileItemPtr pItem = m_vecItems->Get(iItem); if (!pItem->IsParentFolder()) { GetDirectoryHistoryString(pItem.get(), strSelectedItem); } } CStdString strOldDirectory = m_vecItems->GetPath(); m_history.SetSelectedItem(strSelectedItem, strOldDirectory); CPlayListM3U playlist; for (int i = 0; i < (int)m_vecItems->Size(); ++i) { CFileItemPtr pItem = m_vecItems->Get(i); // Musicdatabase items should contain the real path instead of a musicdb url // otherwise the user can't save and reuse the playlist when the musicdb gets deleted if (pItem->IsMusicDb()) pItem->SetPath(pItem->GetMusicInfoTag()->GetURL()); playlist.Add(pItem); } CLog::Log(LOGDEBUG, "Saving music playlist: [%s]", strPath.c_str()); playlist.Save(strPath); Refresh(); // need to update } }