diff --git a/common/utils/file_utils.hpp b/common/utils/file_utils.hpp index 0fdac284..00f0853a 100644 --- a/common/utils/file_utils.hpp +++ b/common/utils/file_utils.hpp @@ -32,6 +32,7 @@ #include #endif +#include #include #include #include @@ -45,17 +46,10 @@ namespace file static bool exists(const std::string& filename) { - if (filename.empty()) - return false; -#ifdef WINDOWS - DWORD dwAttrib = GetFileAttributes(filename.c_str()); - return (dwAttrib != INVALID_FILE_ATTRIBUTES); -#else - struct stat buffer; - return (stat(filename.c_str(), &buffer) == 0); -#endif + return std::filesystem::exists(filename); } + #ifndef WINDOWS static void do_chown(const std::string& file_path, const std::string& user_name, const std::string& group_name) { diff --git a/server/streamreader/file_stream.cpp b/server/streamreader/file_stream.cpp index 1a545ea5..3955c6a3 100644 --- a/server/streamreader/file_stream.cpp +++ b/server/streamreader/file_stream.cpp @@ -27,6 +27,7 @@ // 3rd party headers // standard headers +#include #include @@ -50,6 +51,12 @@ FileStream::FileStream(PcmStream::Listener* pcmListener, boost::asio::io_context { throw SnapException("Not a regular file: \"" + uri_.path + "\""); } + + Properties properties; + Metadata meta; + meta.title = std::filesystem::path(uri_.path).filename().replace_extension(""); + properties.metadata = meta; + setProperties(properties); }