[DEV/DEBUG] cli enterprete server name and correct the mpeg-ts mine type (not official)

This commit is contained in:
Edouard DUPIN 2017-04-13 00:16:24 +02:00
parent cf93a425ba
commit 6f75373855
4 changed files with 52 additions and 12 deletions

View File

@ -46,11 +46,16 @@ static std::string extractAndRemove(const std::string& _inputValue, const char _
bool pushVideoFile(zeus::service::ProxyVideo& _srv, std::string _path, std::map<std::string,std::string> _basicKey = std::map<std::string,std::string>()) {
APPL_INFO("Add media : '" << _path << "'");
std::string extention = etk::tolower(std::string(_path.begin()+_path.size() -3, _path.end()));
std::string extention;
if ( _path.rfind('.') != std::string::npos
&& _path.rfind('.') != 0) {
extention = etk::tolower(std::string(_path.begin()+_path.rfind('.'), _path.end()));
}
if ( extention != "avi"
&& extention != "mkv"
&& extention != "mov"
&& extention != "mp4") {
&& extention != "mp4"
&& extention != "ts") {
APPL_ERROR("Sot send file : " << _path << " Not manage extention...");
return false;
}
@ -90,7 +95,7 @@ bool pushVideoFile(zeus::service::ProxyVideo& _srv, std::string _path, std::map<
}
// remove extention
fileName = std::string(fileName.begin(), fileName.begin() + fileName.size() - 4);
fileName = std::string(fileName.begin(), fileName.begin() + fileName.size() - (extention.size()+1));
std::vector<std::string> listElementBase = etk::split(fileName, '-');
@ -133,7 +138,11 @@ bool pushVideoFile(zeus::service::ProxyVideo& _srv, std::string _path, std::map<
std::string seriesName = listElement[0];
_basicKey.insert(std::pair<std::string,std::string>("series-name", etk::to_string(seriesName)));
_basicKey.insert(std::pair<std::string,std::string>("title", etk::to_string(listElement[3])));
std::string fullEpisodeName = listElement[3];
for (int32_t yyy=4; yyy<listElement.size(); ++yyy) {
fullEpisodeName += "-" + listElement[yyy];
}
_basicKey.insert(std::pair<std::string,std::string>("title", etk::to_string(fullEpisodeName)));
if (std::string(&listElement[1][1]) == "XX") {
// saison unknow ... ==> nothing to do ...
} else {
@ -168,7 +177,7 @@ bool pushVideoFile(zeus::service::ProxyVideo& _srv, std::string _path, std::map<
episodePrint = etk::to_string(episode);
_basicKey.insert(std::pair<std::string,std::string>("episode", etk::to_string(episode)));
}
APPL_INFO(" recontituated: '" << seriesName << "-s" << saisonPrint << "-e" << episodePrint << "-" << listElement[3] << "'");
APPL_INFO(" recontituated: '" << seriesName << "-s" << saisonPrint << "-e" << episodePrint << "-" << fullEpisodeName << "'");
}
}
// send all meta data:
@ -276,13 +285,32 @@ int main(int _argc, const char *_argv[]) {
zeus::init(_argc, _argv);
zeus::Client client1;
std::string login = "test1";
std::string address = "";
uint32_t port = 0;
std::string pass = "coucou";
std::string requestAction = "";
std::vector<std::string> args;
for (int32_t iii=1; iii<_argc ; ++iii) {
std::string data = _argv[iii];
if (etk::start_with(data, "--login=") == true) {
login = &data[8];
// separate loggin and IP adress ...
std::vector<std::string> listElem = etk::split(&data[8], '~');
if (listElem.size() == 0) {
APPL_ERROR("Not enouth element in the login ... need use a XXX~SERVER.org:zzz");
return -1;
}
login = listElem[0];
if (listElem.size() == 1) {
// connnect on local host ... nothing to do
} else {
std::vector<std::string> listElem2 = etk::split(listElem[1], ':');
if (listElem2.size() >= 1) {
address = listElem2[0];
}
if (listElem2.size() >= 2) {
port = etk::string_to_uint32_t(listElem2[1]);
}
}
} else if (etk::start_with(data, "--pass=") == true) {
pass = &data[7];
} else if ( data == "-h"
@ -308,7 +336,13 @@ int main(int _argc, const char *_argv[]) {
APPL_INFO("==================================");
APPL_INFO("== ZEUS test client start ==");
APPL_INFO("==================================");
// Generate IP and Port in the client interface
if (address != "") {
client1.propertyIp.set(address);
}
if (port != 0) {
client1.propertyPort.set(port);
}
bool ret = client1.connect(login, pass);
if (ret == false) {
APPL_ERROR(" ==> NOT Authentify with '" << login << "'");
@ -405,7 +439,7 @@ int main(int _argc, const char *_argv[]) {
APPL_PRINT("============================================");
} else if (requestAction == "pushPath") {
APPL_PRINT("============================================");
APPL_PRINT("== push file: ");
APPL_PRINT("== push path: ");
APPL_PRINT("============================================");
// Send a full path:
// installVideoPath(remoteServiceVideo, "testVideo");

View File

@ -52,7 +52,7 @@ void appl::widget::VideoDisplay::init() {
m_resource->get().configure(ivec2(128,128), egami::colorType::RGB8);
}
// Create the River manager for tha application or part of the application.
m_audioManager = audio::river::Manager::create("river_sample_read");
m_audioManager = audio::river::Manager::create("zeus-video-player");
}
appl::widget::VideoDisplay::~VideoDisplay() {
@ -279,6 +279,7 @@ void appl::widget::VideoDisplay::periodicEvent(const ewol::event::Time& _event)
/ audio::getFormatBytes(m_decoder->m_audioPool[idSlot].m_format)
/ m_decoder->m_audioPool[idSlot].m_map.size();
m_audioInterface->write(&m_decoder->m_audioPool[idSlot].m_buffer[0], nbSample);
APPL_WARNING("write samples ... ");
}
m_decoder->m_audioPool[idSlot].m_isUsed = false;
getSomething = true;
@ -317,7 +318,8 @@ void appl::widget::VideoDisplay::periodicEvent(const ewol::event::Time& _event)
}
// TODO : Chek if this is needed, the display configuration not change too much ...
markToRedraw();
if (m_haveDuration == true) {
if ( m_haveDuration == true
&& m_decoder->getDuration() > echrono::milliseconds(10)) {
if (m_currentTime >= m_decoder->getDuration() + echrono::milliseconds(200)) {
APPL_WARNING("Finish playing");
signalFinish.emit();

View File

@ -32,7 +32,7 @@ static std::vector<std::pair<std::string, std::string>> mineList = {
{ "m4v", "video/mp4"},
{ "m4p", "video/mp4"},
{ "mp4ps", "video/x-nerodigital-ps"},
{ "ts", "video/mpeg2"},
{ "ts", "video/mpeg2-ts"},
{ "ogm", "video/mpeg"},
{ "mkv", "video/x-matroska"},
{ "rmvb", "video/mpeg"},

View File

@ -25,7 +25,11 @@ zeus::FileImpl::FileImpl(std::string _fileNameReal) :
m_node(_fileNameReal) {
m_size = m_node.fileSize();
m_node.fileOpenRead();
std::string extention = std::string(_fileNameReal.begin()+_fileNameReal.size() -3, _fileNameReal.end());
std::string extention;
if ( _fileNameReal.rfind('.') != std::string::npos
&& _fileNameReal.rfind('.') != 0) {
extention = std::string(_fileNameReal.begin()+_fileNameReal.rfind('.'), _fileNameReal.end());
}
m_mineType = zeus::getMineType(extention);
m_sha512 = algue::stringConvert(algue::sha512::encodeFromFile(_fileNameReal));
}