albumart - fix albumart display if paths are uri's

@fix
This commit is contained in:
Carsten Haitzler 2016-10-02 00:34:52 +09:00
parent 253c1bbcdc
commit 313dda5f2d
3 changed files with 58 additions and 21 deletions

View File

@ -86,7 +86,10 @@ _art_check(Evas_Object *obj)
free(thumb); free(thumb);
} }
} }
else evas_object_hide(sd->o_img); else
{
evas_object_hide(sd->o_img);
}
} }
static void static void
@ -97,8 +100,16 @@ _cb_vid_frame(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
if (!sd) return; if (!sd) return;
evas_object_geometry_get(data, &ox, &oy, &ow, &oh); evas_object_geometry_get(data, &ox, &oy, &ow, &oh);
evas_object_show(sd->o_vid); if (!emotion_object_video_handled_get(sd->o_vid))
evas_object_hide(sd->o_img); {
evas_object_hide(sd->o_vid);
evas_object_show(sd->o_img);
}
else
{
evas_object_show(sd->o_vid);
evas_object_hide(sd->o_img);
}
evas_object_show(sd->clip); evas_object_show(sd->clip);
_ob_resize(data, ox, oy, ow, oh); _ob_resize(data, ox, oy, ow, oh);
evas_object_smart_callback_call(data, "frame_decode", NULL); evas_object_smart_callback_call(data, "frame_decode", NULL);
@ -292,7 +303,8 @@ _ob_resize(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coor
sd->pih = sd->ih; sd->pih = sd->ih;
evas_object_smart_callback_call(obj, "frame_resize", NULL); evas_object_smart_callback_call(obj, "frame_resize", NULL);
} }
if ((sd->tw > 0) && (sd->th > 0) && (sd->doart)) if ((sd->tw > 0) && (sd->th > 0) && (sd->doart) &&
(!emotion_object_video_handled_get(sd->o_vid)))
{ {
int iw, ih; int iw, ih;

View File

@ -276,6 +276,7 @@ _videothumb_image_load(Evas_Object *obj)
if (sd->poster_mode) if (sd->poster_mode)
{ {
artfile = albumart_file_get(sd->realpath); artfile = albumart_file_get(sd->realpath);
printf("artfile for %s = %s\n", sd->realpath, artfile);
if (artfile) if (artfile)
{ {
if (ecore_file_exists(artfile)) if (ecore_file_exists(artfile))

View File

@ -185,7 +185,22 @@ _cb_fetched(void *data)
file = video_file_get(inf->vid); file = video_file_get(inf->vid);
if (file) if (file)
{ {
char *realfile = ecore_file_realpath(file); char *realfile = NULL;
if (!strncasecmp(file, "file:/", 6))
{
Efreet_Uri *uri = efreet_uri_decode(file);
if (uri)
{
realfile = ecore_file_realpath(uri->path);
efreet_uri_free(uri);
}
}
else if ((!strncasecmp(file, "http:/", 6)) ||
(!strncasecmp(file, "https:/", 7)))
realfile = strdup(file);
else
realfile = ecore_file_realpath(file);
if (realfile) if (realfile)
{ {
char *path = albumart_file_get(realfile); char *path = albumart_file_get(realfile);
@ -617,24 +632,33 @@ win_art(Evas_Object *win, const char *path)
if (inf->artimg) if (inf->artimg)
{ {
evas_object_del(inf->artimg); const char *path2;
inf->artimg = NULL;
evas_object_image_file_get(inf->artimg, &path2, NULL);
if ((!path2) || (strcmp(path, path2)))
{
evas_object_del(inf->artimg);
inf->artimg = NULL;
}
} }
inf->artimg = evas_object_image_filled_add(evas_object_evas_get(win)); if (!inf->artimg)
evas_object_image_file_set(inf->artimg, path, NULL);
evas_object_image_size_get(inf->artimg, &iw, &ih);
if ((iw > 0) && (ih > 0))
{ {
evas_object_size_hint_aspect_set(inf->artimg, inf->artimg = evas_object_image_filled_add(evas_object_evas_get(win));
EVAS_ASPECT_CONTROL_NEITHER, evas_object_image_file_set(inf->artimg, path, NULL);
iw, ih); evas_object_image_size_get(inf->artimg, &iw, &ih);
elm_object_part_content_set(inf->lay, "rage.art", inf->artimg); if ((iw > 0) && (ih > 0))
elm_layout_signal_emit(inf->lay, "state,art", "rage"); {
} evas_object_size_hint_aspect_set(inf->artimg,
else EVAS_ASPECT_CONTROL_NEITHER,
{ iw, ih);
evas_object_del(inf->artimg); elm_object_part_content_set(inf->lay, "rage.art", inf->artimg);
inf->artimg = NULL; elm_layout_signal_emit(inf->lay, "state,art", "rage");
}
else
{
evas_object_del(inf->artimg);
inf->artimg = NULL;
}
} }
} }
} }