void CGUIDialogMediaSource::OnOK() { // verify the path by doing a GetDirectory. CFileItemList items; CMediaSource share; share.FromNameAndPaths(m_type, m_name, GetPaths()); // hack: Need to temporarily add the share, then get path, then remove share VECSOURCES *shares = g_settings.GetSourcesFromType(m_type); if (shares) shares->push_back(share); if (share.strPath.Left(9).Equals("plugin://") || CDirectory::GetDirectory(share.strPath, items, "", false, true) || CGUIDialogYesNo::ShowAndGetInput(1001,1025,1003,1004)) { m_confirmed = true; Close(); if (m_type == "video" && !URIUtils::IsLiveTV(share.strPath) && !share.strPath.Left(6).Equals("rss://")) { CGUIWindowVideoBase::OnAssignContent(share.strPath, 0, m_info, m_settings); } } // and remove the share again if (shares) shares->erase(--shares->end()); }
void CGUIDialogMediaSource::OnOK() { // verify the path by doing a GetDirectory. CFileItemList items; CMediaSource share; share.FromNameAndPaths(m_type, m_name, GetPaths()); // hack: Need to temporarily add the share, then get path, then remove share VECSOURCES *shares = CMediaSourceSettings::Get().GetSources(m_type); if (shares) shares->push_back(share); if (StringUtils::StartsWithNoCase(share.strPath, "plugin://") || CDirectory::GetDirectory(share.strPath, items, "", DIR_FLAG_NO_FILE_DIRS | DIR_FLAG_ALLOW_PROMPT) || CGUIDialogYesNo::ShowAndGetInput(1001,1025,1003,1004)) { m_confirmed = true; Close(); if (m_type == "video" && !URIUtils::IsLiveTV(share.strPath) && !StringUtils::StartsWithNoCase(share.strPath, "rss://") && !StringUtils::StartsWithNoCase(share.strPath, "upnp://")) { CGUIWindowVideoBase::OnAssignContent(share.strPath); } } // and remove the share again if (shares) shares->erase(--shares->end()); }
void CGUIDialogMediaSource::OnOK() { // verify the path by doing a GetDirectory. CFileItemList items; CMediaSource share; share.FromNameAndPaths(m_type, m_name, GetPaths()); // hack: Need to temporarily add the share, then get path, then remove share VECSOURCES *shares = g_settings.GetSourcesFromType(m_type); if (shares) shares->push_back(share); if (share.strPath.Left(9).Equals("plugin://") || CDirectory::GetDirectory(share.strPath, items, "", false, true) || CGUIDialogYesNo::ShowAndGetInput(1001,1025,1003,1004)) { m_confirmed = true; Close(); } // Special handling of multipath:// shares. // * GetScraperForPath takes the first path of the multipath:// element to fetch needed scraper and scan settings. // * SetScraperForPath loops through all elements and adds the appropriate settings for each path. if (CUtil::IsMultiPath(share.strPath)) { CVideoDatabase database; database.Open(); m_info = database.GetScraperForPath(share.strPath, m_settings); database.SetScraperForPath(share.strPath, m_info, m_settings); database.Close(); } // and remove the share again if (shares) shares->erase(--shares->end()); }
void CGUIDialogMediaSource::OnOK() { // verify the path by doing a GetDirectory. CFileItemList items; CMediaSource share; share.FromNameAndPaths(m_type, m_name, GetPaths()); // hack: Need to temporarily add the share, then get path, then remove share VECSOURCES *shares = g_settings.GetSourcesFromType(m_type); if (shares) shares->push_back(share); if (share.strPath.Left(9).Equals("plugin://") || CDirectory::GetDirectory(share.strPath, items, "", false, true) || CGUIDialogYesNo::ShowAndGetInput(1001,1025,1003,1004)) { if (share.strPath.Left(9).Equals("plugin://")) { CStdString strPath=share.strPath; strPath.Replace("plugin://","special://home/system/plugins/"); CFileItem item(strPath,true); item.SetCachedProgramThumb(); if (!item.HasThumbnail()) item.SetUserProgramThumb(); if (!item.HasThumbnail()) { item.SetPath(URIUtils::AddFileToFolder(strPath,"default.py")); item.m_bIsFolder = false; item.SetCachedProgramThumb(); if (!item.HasThumbnail()) item.SetUserProgramThumb(); } if (item.HasThumbnail() && m_paths->Size()) { CFileItem item2(share.strPath,true); XFILE::CFile::Cache(item.GetThumbnailImage(),item2.GetCachedProgramThumb()); m_paths->Get(0)->SetThumbnailImage(item2.GetCachedProgramThumb()); } } m_confirmed = true; Close(); } // Special handling of multipath:// shares. // * GetScraperForPath takes the first path of the multipath:// element to fetch needed scraper and scan settings. // * SetScraperForPath loops through all elements and adds the appropriate settings for each path. if (URIUtils::IsMultiPath(share.strPath)) { CVideoDatabase database; database.Open(); database.GetScraperForPath(share.strPath, m_info, m_settings); database.SetScraperForPath(share.strPath, m_info, m_settings); database.Close(); } // and remove the share again if (shares) shares->erase(--shares->end()); }
void CVirtualDirectory::GetSources(VECSOURCES &shares) const { shares = m_vecSources; // add our plug n play shares #ifndef IS_PROFESSIONAL // Laureon: Added: Jukebox: Professional mode shouldn't list removable sources if (m_allowNonLocalSources) g_mediaManager.GetRemovableDrives(shares); #endif #ifdef HAS_DVD_DRIVE // and update our dvd share for (unsigned int i = 0; i < shares.size(); ++i) { CMediaSource& share = shares[i]; if (share.m_iDriveType == CMediaSource::SOURCE_TYPE_DVD) { if(g_mediaManager.IsAudio(share.strPath)) { share.strStatus = "Audio-CD"; share.strPath = "cdda://local/"; share.strDiskUniqueId = ""; } else { share.strStatus = g_mediaManager.GetDiskLabel(share.strPath); share.strDiskUniqueId = g_mediaManager.GetDiskUniqueId(share.strPath); if (!share.strPath.length()) // unmounted CD { if (g_mediaManager.GetDiscPath() == "iso9660://") share.strPath = "iso9660://"; else // share is unmounted and not iso9660, discard it shares.erase(shares.begin() + i--); } } } } #endif }
bool CMediaSourceSettings::DeleteSource(const std::string &strType, const std::string &strName, const std::string &strPath, bool virtualSource /* = false */) { VECSOURCES *pShares = GetSources(strType); if (pShares == NULL) return false; bool found = false; for (IVECSOURCES it = pShares->begin(); it != pShares->end(); it++) { if (it->strName == strName && it->strPath == strPath) { CLog::Log(LOGDEBUG, "CMediaSourceSettings: found share, removing!"); pShares->erase(it); found = true; break; } } if (virtualSource) return found; return Save(); }