aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-01-24 11:44:33 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-01-24 11:44:33 +0000
commit95cb9155572e84bcb12b9b30c3b0bff3a0263b70 (patch)
treeb322a3417c60b651285857d6f86112aee5a74163 /src/bin
parentbrng back key controls after dnd fix with focus fix for new button (diff)
downloadrage-95cb9155572e84bcb12b9b30c3b0bff3a0263b70.tar.gz
mpris - fix title return to return real title or generated one
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/mpris.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/bin/mpris.c b/src/bin/mpris.c
index 948f78c..ef0cd7f 100644
--- a/src/bin/mpris.c
+++ b/src/bin/mpris.c
@@ -681,8 +681,8 @@ GETTER(metadata)
Inf *inf = evas_object_data_get(mainwin, "inf");
Eldbus_Message_Iter *array = NULL, *entry = NULL, *var, *var2;
uint64_t len = 0;
- char *buf = NULL;
- const char *s;
+ char *buf = NULL, *tmp = NULL, *p;
+ const char *s, *file;
if (!inf) return EINA_FALSE;
// XXX: TODO:
@@ -740,12 +740,45 @@ GETTER(metadata)
s = video_title_get(inf->vid);
if (!s) s = video_meta_title_get(inf->vid);
+ if ((!s) && (inf->file_cur))
+ {
+ Winvid_Entry *vid = inf->file_cur->data;
+ if (vid)
+ {
+ file = vid->file;
+ s = ecore_file_file_get(vid->uri ? vid->uri->path : file);
+ if (s)
+ {
+ tmp = alloca(strlen(s) + 1);
+ strcpy(tmp, s);
+ for (p = tmp; *p; p++)
+ {
+ // nuke stupid characters from the label that may be in filename
+ if ((*p == '_') || (*p == '#') || (*p == '$') || (*p == '%') ||
+ (*p == '*') || (*p == '+') || (*p == '[') || (*p == ']') ||
+ (*p == ';') || (*p == '<') || (*p == '=') || (*p == '>') ||
+ (*p == '^') || (*p == '`') || (*p == '{') || (*p == '}') ||
+ (*p == '|') || (*p == '~') || (*p == 127) ||
+ (*p == '\'') || (*p == '\\'))
+ {
+ *p = ' ';
+ }
+ else if (*p == '.')
+ {
+ *p = 0;
+ break;
+ }
+ }
+ s = tmp;
+ }
+ }
+ }
if (s)
{
eldbus_message_iter_arguments_append(array, "{sv}", &entry);
eldbus_message_iter_basic_append(entry, 's', "xesam:title");
var = eldbus_message_iter_container_new(entry, 'v', "s");
- eldbus_message_iter_basic_append(var, 's', buf);
+ eldbus_message_iter_basic_append(var, 's', s);
eldbus_message_iter_container_close(entry, var);
eldbus_message_iter_container_close(array, entry);
}