CVFSEntry::CVFSEntry(BinaryAddonBasePtr addonInfo) : IAddonInstanceHandler(ADDON_INSTANCE_VFS, addonInfo), m_protocols(addonInfo->Type(ADDON_VFS)->GetValue("@protocols").asString()), m_extensions(addonInfo->Type(ADDON_VFS)->GetValue("@extensions").asString()), m_files(addonInfo->Type(ADDON_VFS)->GetValue("@files").asBoolean()), m_directories(addonInfo->Type(ADDON_VFS)->GetValue("@directories").asBoolean()), m_filedirectories(addonInfo->Type(ADDON_VFS)->GetValue("@filedirectories").asBoolean()) { m_struct = {{ 0 }}; m_struct.toKodi.kodiInstance = this; if (CreateInstance(&m_struct) != ADDON_STATUS_OK) CLog::Log(LOGFATAL, "CVFSEntry - Couldn't create instance on add-on '%s'", addonInfo->Name().c_str()); }
std::string CCDDARipper::GetTrackName(CFileItem *item) { // get track number from "cdda://local/01.cdda" int trackNumber = atoi(item->GetPath().substr(13, item->GetPath().size() - 13 - 5).c_str()); // Format up our ripped file label CFileItem destItem(*item); destItem.SetLabel(""); // get track file name format from audiocds.trackpathformat setting, // use only format part starting from the last '/' std::string strFormat = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_AUDIOCDS_TRACKPATHFORMAT); size_t pos = strFormat.find_last_of("/\\"); if (pos != std::string::npos) strFormat.erase(0, pos+1); CLabelFormatter formatter(strFormat, ""); formatter.FormatLabel(&destItem); // grab the label to use it as our ripped filename std::string track = destItem.GetLabel(); if (track.empty()) track = StringUtils::Format("%s%02i", "Track-", trackNumber); const BinaryAddonBasePtr addonInfo = CServiceBroker::GetBinaryAddonManager().GetInstalledAddonInfo(CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_AUDIOCDS_ENCODER), ADDON_AUDIOENCODER); if (addonInfo) track += addonInfo->Type(ADDON_AUDIOENCODER)->GetValue("@extension").asString(); return track; }
CVFSEntry::ProtocolInfo::ProtocolInfo(BinaryAddonBasePtr addonInfo) : supportPath(addonInfo->Type(ADDON_VFS)->GetValue("@supportPath").asBoolean()), supportUsername(addonInfo->Type(ADDON_VFS)->GetValue("@supportUsername").asBoolean()), supportPassword(addonInfo->Type(ADDON_VFS)->GetValue("@supportPassword").asBoolean()), supportPort(addonInfo->Type(ADDON_VFS)->GetValue("@supportPort").asBoolean()), supportBrowsing(addonInfo->Type(ADDON_VFS)->GetValue("@supportBrowsing").asBoolean()), supportWrite(addonInfo->Type(ADDON_VFS)->GetValue("@supportWrite").asBoolean()), defaultPort(addonInfo->Type(ADDON_VFS)->GetValue("@defaultPort").asInteger()), type(addonInfo->Type(ADDON_VFS)->GetValue("@protocols").asString()), label(addonInfo->Type(ADDON_VFS)->GetValue("@label").asInteger()) { }
bool CInputStreamAddon::Supports(BinaryAddonBasePtr& addonBase, const CFileItem &fileitem) { // check if a specific inputstream addon is requested CVariant addon = fileitem.GetProperty("inputstreamaddon"); if (!addon.isNull()) return (addon.asString() == addonBase->ID()); // check protocols std::string protocol = fileitem.GetURL().GetProtocol(); if (!protocol.empty()) { std::string protocols = addonBase->Type(ADDON_INPUTSTREAM)->GetValue("@protocols").asString(); if (!protocols.empty()) { std::vector<std::string> protocolsList = StringUtils::Tokenize(protocols, "|"); for (auto& value : protocolsList) { StringUtils::Trim(value); if (value == protocol) return true; } } } std::string filetype = fileitem.GetURL().GetFileType(); if (!filetype.empty()) { std::string extensions = addonBase->Type(ADDON_INPUTSTREAM)->GetValue("@extension").asString(); if (!extensions.empty()) { std::vector<std::string> extensionsList = StringUtils::Tokenize(extensions, "|"); for (auto& value : extensionsList) { StringUtils::Trim(value); if (value == filetype) return true; } } } return false; }
CInputStreamAddon::CInputStreamAddon(BinaryAddonBasePtr& addonBase, IVideoPlayer* player, const CFileItem& fileitem) : IAddonInstanceHandler(ADDON_INSTANCE_INPUTSTREAM, addonBase), CDVDInputStream(DVDSTREAM_TYPE_ADDON, fileitem), m_player(player) { std::string listitemprops = addonBase->Type(ADDON_INPUTSTREAM)->GetValue("@listitemprops").asString(); std::string name(addonBase->ID()); m_fileItemProps = StringUtils::Tokenize(listitemprops, "|"); for (auto &key : m_fileItemProps) { StringUtils::Trim(key); key = name + "." + key; } m_struct = {{ 0 }}; m_caps.m_mask = 0; }