hatstand code review update 1
This commit is contained in:
parent
114802a0ca
commit
41513527cd
|
@ -446,45 +446,48 @@ void IncomingDataParser::AppendFilesToPlaylist(const pb::remote::Message& msg) {
|
||||||
if (relative_path.startsWith("/")) relative_path.remove(0, 1);
|
if (relative_path.startsWith("/")) relative_path.remove(0, 1);
|
||||||
|
|
||||||
QFileInfo fi_folder(root_dir, relative_path);
|
QFileInfo fi_folder(root_dir, relative_path);
|
||||||
if (!fi_folder.exists())
|
if (!fi_folder.exists()) {
|
||||||
qLog(Warning) << "Remote relative path " << relative_path
|
qLog(Warning) << "Remote relative path " << relative_path
|
||||||
<< " doesn't exist...";
|
<< " doesn't exist...";
|
||||||
else if (!fi_folder.isDir())
|
return;
|
||||||
|
} else if (!fi_folder.isDir()) {
|
||||||
qLog(Warning) << "Remote relative path " << relative_path
|
qLog(Warning) << "Remote relative path " << relative_path
|
||||||
<< " is not a directory...";
|
<< " is not a directory...";
|
||||||
else if (root_dir.relativeFilePath(fi_folder.absoluteFilePath())
|
return;
|
||||||
.startsWith("../"))
|
} else if (root_dir.relativeFilePath(fi_folder.absoluteFilePath())
|
||||||
|
.startsWith("../")) {
|
||||||
qLog(Warning) << "Remote relative path " << relative_path
|
qLog(Warning) << "Remote relative path " << relative_path
|
||||||
<< " should not be accessed...";
|
<< " should not be accessed...";
|
||||||
else {
|
return;
|
||||||
QList<QUrl> urls;
|
}
|
||||||
QDir dir(fi_folder.absoluteFilePath());
|
|
||||||
for (const auto& file : req_append.files()) {
|
QList<QUrl> urls;
|
||||||
QFileInfo fi(dir, file.c_str());
|
QDir dir(fi_folder.absoluteFilePath());
|
||||||
if (fi.exists()) urls << QUrl::fromLocalFile(fi.canonicalFilePath());
|
for (const auto& file : req_append.files()) {
|
||||||
}
|
QFileInfo fi(dir, file.c_str());
|
||||||
if (urls.size()) {
|
if (fi.exists()) urls << QUrl::fromLocalFile(fi.canonicalFilePath());
|
||||||
MimeData* data = new MimeData;
|
}
|
||||||
data->setUrls(urls);
|
if (!urls.isEmpty()) {
|
||||||
if (req_append.has_play_now()) data->play_now_ = req_append.play_now();
|
MimeData* data = new MimeData;
|
||||||
if (req_append.has_clear_first())
|
data->setUrls(urls);
|
||||||
data->clear_first_ = req_append.clear_first();
|
if (req_append.has_play_now()) data->play_now_ = req_append.play_now();
|
||||||
if (req_append.has_new_playlist_name()) {
|
if (req_append.has_clear_first())
|
||||||
QString playlist_name =
|
data->clear_first_ = req_append.clear_first();
|
||||||
QString::fromStdString(req_append.new_playlist_name());
|
if (req_append.has_new_playlist_name()) {
|
||||||
if (!playlist_name.isEmpty()) {
|
QString playlist_name =
|
||||||
data->open_in_new_playlist_ = true;
|
QString::fromStdString(req_append.new_playlist_name());
|
||||||
data->name_for_new_playlist_ = playlist_name;
|
if (!playlist_name.isEmpty()) {
|
||||||
}
|
data->open_in_new_playlist_ = true;
|
||||||
} else if (req_append.has_playlist_id()) {
|
data->name_for_new_playlist_ = playlist_name;
|
||||||
// if playing we will drop the files in another playlist
|
|
||||||
if (app_->player()->GetState() == Engine::Playing)
|
|
||||||
data->playlist_id = req_append.playlist_id();
|
|
||||||
else
|
|
||||||
// as me may play the song, we change the current playlist
|
|
||||||
emit SetCurrentPlaylist(req_append.playlist_id());
|
|
||||||
}
|
}
|
||||||
emit AddToPlaylistSignal(data);
|
} else if (req_append.has_playlist_id()) {
|
||||||
|
// if playing we will drop the files in another playlist
|
||||||
|
if (app_->player()->GetState() == Engine::Playing)
|
||||||
|
data->playlist_id = req_append.playlist_id();
|
||||||
|
else
|
||||||
|
// as me may play the song, we change the current playlist
|
||||||
|
emit SetCurrentPlaylist(req_append.playlist_id());
|
||||||
}
|
}
|
||||||
|
emit AddToPlaylistSignal(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ void OutgoingDataCreator::SendClementineInfo() {
|
||||||
|
|
||||||
// allowed extensions for REQUEST_FILES and LIST_FILES
|
// allowed extensions for REQUEST_FILES and LIST_FILES
|
||||||
for (const QString& ext : files_music_extensions_)
|
for (const QString& ext : files_music_extensions_)
|
||||||
*info->add_files_music_extensions() = ext.toStdString();
|
info->add_files_music_extensions(ext.toStdString());
|
||||||
|
|
||||||
QString version =
|
QString version =
|
||||||
QString("%1 %2").arg(QCoreApplication::applicationName(),
|
QString("%1 %2").arg(QCoreApplication::applicationName(),
|
||||||
|
|
Loading…
Reference in New Issue