bool CBlurayDirectory::GetDirectory(const CURL& url, CFileItemList &items) { Dispose(); m_url = url; std::string root = m_url.GetHostName(); std::string file = m_url.GetFileName(); URIUtils::RemoveSlashAtEnd(file); URIUtils::RemoveSlashAtEnd(root); if (!InitializeBluray(root)) return false; if(file == "root") GetRoot(items); else if(file == "root/titles") GetTitles(false, items); else { CURL url2 = GetUnderlyingCURL(url); CDirectory::CHints hints; hints.flags = m_flags; if (!CDirectory::GetDirectory(url2, items, hints)) return false; } items.AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty items.AddSortMethod(SortBySize, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // FileName, Size | Foldername, Size return true; }
bool CBlurayDirectory::GetDirectory(const CURL& url, CFileItemList &items) { Dispose(); m_url = url; std::string root = m_url.GetHostName(); std::string file = m_url.GetFileName(); URIUtils::RemoveSlashAtEnd(file); URIUtils::RemoveSlashAtEnd(root); m_dll = new DllLibbluray(); if (!m_dll->Load()) { CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to load dll"); return false; } m_dll->bd_register_dir(DllLibbluray::dir_open); m_dll->bd_register_file(DllLibbluray::file_open); m_dll->bd_set_debug_handler(DllLibbluray::bluray_logger); m_dll->bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV); m_bd = m_dll->bd_open(root.c_str(), NULL); if(!m_bd) { CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to open %s", root.c_str()); return false; } if(file == "root") GetRoot(items); else if(file == "root/titles") GetTitles(false, items); else { CURL url2 = GetUnderlyingCURL(url); CDirectory::CHints hints; hints.flags = m_flags; if (!CDirectory::GetDirectory(url2, items, hints)) return false; } items.AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty items.AddSortMethod(SortBySize, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // FileName, Size | Foldername, Size return true; }