Move meta_mpd.py to plug-ins directory

This commit is contained in:
badaix 2021-12-18 14:53:11 +01:00
parent 8d8061a946
commit da687c1585
3 changed files with 17 additions and 7 deletions

View file

@ -117,5 +117,6 @@ else()
install(FILES etc/snapserver.conf COMPONENT server DESTINATION ${CMAKE_INSTALL_SYSCONFDIR})
install(FILES etc/index.html COMPONENT server DESTINATION ${CMAKE_INSTALL_DATADIR}/snapserver)
install(DIRECTORY etc/snapweb/ DESTINATION ${CMAKE_INSTALL_DATADIR}/snapserver/snapweb)
install(DIRECTORY etc/plug-ins/ DESTINATION ${CMAKE_INSTALL_DATADIR}/snapserver/plug-ins)
#install(FILES ../debian/snapserver.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR})
endif()

File diff suppressed because one or more lines are too long

View file

@ -29,6 +29,7 @@
// 3rd party headers
// standard headers
#include <filesystem>
#include <memory>
@ -140,13 +141,17 @@ void StreamControl::onLog(std::string message)
ScriptStreamControl::ScriptStreamControl(const net::any_io_executor& executor, const std::string& script) : StreamControl(executor), script_(script)
{
// auto fileExists = [](const std::string& filename) {
// struct stat buffer;
// return (stat(filename.c_str(), &buffer) == 0);
// };
// if (!fileExists(script_))
// throw SnapException("Control script not found: \"" + script_ + "\"");
namespace fs = std::filesystem;
if (!fs::exists(script_))
{
fs::path plugin_path = "/usr/share/snapserver/plug-ins";
if (fs::exists(plugin_path / script_))
script_ = (plugin_path / script_).native();
else if (fs::exists(plugin_path / fs::path(script_).filename()))
script_ = (plugin_path / fs::path(script_).filename()).native();
else
throw SnapException("Control script not found: \"" + script_ + "\"");
}
}