ocarina/libsaria/remote.cpp

32 lines
513 B
C++
Raw Normal View History

// Copyright (c) Bryan Schumaker 2012.
#include <libsaria/libsaria.h>
#include <libsaria/print.h>
#include <libsaria/audio.h>
#include <fstream>
using namespace std;
static void run_cmd(ifstream &in, string &file)
{
string cmd;
in >> cmd;
if (cmd == "play")
libsaria::audio::play();
else if (cmd == "pause")
libsaria::audio::pause();
}
void libsaria::read_piped_file(string &file)
{
ifstream in;
string cmd;
if (!exists(file))
return;
in.open(file.c_str());
run_cmd(in, file);
in.close();
}