aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/OtherCommands.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/OtherCommands.cxx')
-rw-r--r--src/command/OtherCommands.cxx60
1 files changed, 44 insertions, 16 deletions
diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx
index 7b2cb1331..6432ce4e7 100644
--- a/src/command/OtherCommands.cxx
+++ b/src/command/OtherCommands.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,19 +20,21 @@
#include "config.h"
#include "OtherCommands.hxx"
#include "DatabaseCommands.hxx"
+#include "db/update/UpdateGlue.hxx"
#include "CommandError.hxx"
-#include "UpdateGlue.hxx"
-#include "Directory.hxx"
-#include "Song.hxx"
+#include "db/Directory.hxx"
+#include "DetachedSong.hxx"
#include "SongPrint.hxx"
#include "TagPrint.hxx"
+#include "TagStream.hxx"
+#include "tag/TagHandler.hxx"
#include "TimePrint.hxx"
#include "Mapper.hxx"
-#include "DecoderPrint.hxx"
+#include "decoder/DecoderPrint.hxx"
#include "protocol/ArgParser.hxx"
#include "protocol/Result.hxx"
#include "ls.hxx"
-#include "Volume.hxx"
+#include "mixer/Volume.hxx"
#include "util/ASCII.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
@@ -40,14 +42,11 @@
#include "Stats.hxx"
#include "Permission.hxx"
#include "PlaylistFile.hxx"
-#include "ClientFile.hxx"
-#include "Client.hxx"
+#include "PlaylistVector.hxx"
+#include "client/ClientFile.hxx"
+#include "client/Client.hxx"
#include "Idle.hxx"
-#ifdef ENABLE_SQLITE
-#include "StickerDatabase.hxx"
-#endif
-
#include <assert.h>
#include <string.h>
@@ -102,6 +101,20 @@ handle_close(gcc_unused Client &client,
return CommandResult::FINISH;
}
+static void
+print_tag(TagType type, const char *value, void *ctx)
+{
+ Client &client = *(Client *)ctx;
+
+ tag_print(client, type, value);
+}
+
+static constexpr tag_handler print_tag_handler = {
+ nullptr,
+ print_tag,
+ nullptr,
+};
+
CommandResult
handle_lsinfo(Client &client, int argc, char *argv[])
{
@@ -128,15 +141,30 @@ handle_lsinfo(Client &client, int argc, char *argv[])
if (!client_allow_file(client, path_fs, error))
return print_error(client, error);
- Song *song = Song::LoadFile(path_utf8, nullptr);
- if (song == nullptr) {
+ DetachedSong song(path_utf8);
+ if (!song.Update()) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "No such file");
+ return CommandResult::ERROR;
+ }
+
+ song_print_info(client, song);
+ return CommandResult::OK;
+ }
+
+ if (uri_has_scheme(uri)) {
+ if (!uri_supported_scheme(uri)) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "unsupported URI scheme");
+ return CommandResult::ERROR;
+ }
+
+ if (!tag_stream_scan(uri, print_tag_handler, &client)) {
command_error(client, ACK_ERROR_NO_EXIST,
"No such file");
return CommandResult::ERROR;
}
- song_print_info(client, *song);
- song->Free();
return CommandResult::OK;
}