mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-30 10:47:12 +02:00
Set title meta data for FileStream
This commit is contained in:
parent
cece83819f
commit
2b6774bdca
2 changed files with 10 additions and 9 deletions
|
@ -32,6 +32,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -45,17 +46,10 @@ namespace file
|
||||||
|
|
||||||
static bool exists(const std::string& filename)
|
static bool exists(const std::string& filename)
|
||||||
{
|
{
|
||||||
if (filename.empty())
|
return std::filesystem::exists(filename);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
static void do_chown(const std::string& file_path, const std::string& user_name, const std::string& group_name)
|
static void do_chown(const std::string& file_path, const std::string& user_name, const std::string& group_name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
|
|
||||||
// standard headers
|
// standard headers
|
||||||
|
#include <filesystem>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +51,12 @@ FileStream::FileStream(PcmStream::Listener* pcmListener, boost::asio::io_context
|
||||||
{
|
{
|
||||||
throw SnapException("Not a regular file: \"" + uri_.path + "\"");
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue