fix up album art if it's in the music file itself and not fetched

This commit is contained in:
Carsten Haitzler 2020-04-03 23:36:23 +01:00
parent ca538f6f8c
commit cf2b383f0c
3 changed files with 29 additions and 10 deletions

View File

@ -666,7 +666,6 @@ video_file_set(Evas_Object *obj, const char *file)
eina_stringshare_replace(&(sd->artfile), NULL); eina_stringshare_replace(&(sd->artfile), NULL);
emotion_object_file_set(sd->o_vid, sd->file); emotion_object_file_set(sd->o_vid, sd->file);
video_position_set(obj, 0.0); video_position_set(obj, 0.0);
printf("set %p %s %i\n", obj, file, sd->doart);
if (sd->doart) if (sd->doart)
{ {
const char *extn = strchr(sd->file, '.'); const char *extn = strchr(sd->file, '.');

View File

@ -235,13 +235,13 @@ _local_artwork_get(void *data)
{ {
Evas_Object *win = data; Evas_Object *win = data;
Inf *inf = evas_object_data_get(win, "inf"); Inf *inf = evas_object_data_get(win, "inf");
if (!inf) return EINA_FALSE; if (!inf) return EINA_FALSE;
if (!inf->vid) return EINA_FALSE; if (!inf->vid) return EINA_FALSE;
const char *file = NULL; const char *file = NULL;
const char *filename = video_file_get(inf->vid); const char *filename = video_file_get(inf->vid);
Efreet_Uri *uri = efreet_uri_decode(filename); Efreet_Uri *uri = efreet_uri_decode(filename);
if (uri) if (uri)
{ {
@ -267,7 +267,7 @@ _local_artwork_get(void *data)
Evas_Object *artwork = video_meta_artwork_get(inf->vid, file, EMOTION_ARTWORK_PREVIEW_IMAGE); Evas_Object *artwork = video_meta_artwork_get(inf->vid, file, EMOTION_ARTWORK_PREVIEW_IMAGE);
if (!artwork) artwork = video_meta_artwork_get(inf->vid, file, EMOTION_ARTWORK_IMAGE); if (!artwork) artwork = video_meta_artwork_get(inf->vid, file, EMOTION_ARTWORK_IMAGE);
if (artwork) if (artwork)
{ {
evas_object_image_save(artwork, path, NULL, NULL); evas_object_image_save(artwork, path, NULL, NULL);
@ -281,7 +281,6 @@ _local_artwork_get(void *data)
} }
} }
} }
return EINA_TRUE; return EINA_TRUE;
} }
@ -420,6 +419,7 @@ static void
_restart_vid(Evas_Object *win, Evas_Object *lay, Evas_Object *vid, const char *file, const char *sub) _restart_vid(Evas_Object *win, Evas_Object *lay, Evas_Object *vid, const char *file, const char *sub)
{ {
const char *extn = strchr(file, '.'); const char *extn = strchr(file, '.');
win_newfile(win);
if ((extn) && if ((extn) &&
((!strcasecmp(extn, ".mp3")) || ((!strcasecmp(extn, ".mp3")) ||
(!strcasecmp(extn, ".m4a")) || (!strcasecmp(extn, ".m4a")) ||
@ -766,6 +766,13 @@ win_art(Evas_Object *win, const char *path)
} }
} }
void
win_newfile(Evas_Object *win)
{
Inf *inf = evas_object_data_get(win, "inf");
inf->newfile = EINA_TRUE;
}
void void
win_show(Evas_Object *win, int w, int h) win_show(Evas_Object *win, int w, int h)
{ {
@ -789,13 +796,24 @@ win_show(Evas_Object *win, int w, int h)
} }
if (!video_has_video_get(inf->vid)) if (!video_has_video_get(inf->vid))
elm_layout_signal_emit(inf->lay, "state,novideo", "rage"); {
if (inf->newfile)
elm_layout_signal_emit(inf->lay, "state,novideo", "rage");
}
else else
elm_layout_signal_emit(inf->lay, "state,video", "rage"); {
elm_layout_signal_emit(inf->lay, "state,video", "rage");
}
if (!video_has_audio_get(inf->vid)) if (!video_has_audio_get(inf->vid))
elm_layout_signal_emit(inf->lay, "state,noaudio", "rage"); {
if (inf->newfile)
elm_layout_signal_emit(inf->lay, "state,noaudio", "rage");
}
else else
elm_layout_signal_emit(inf->lay, "state,audio", "rage"); {
elm_layout_signal_emit(inf->lay, "state,audio", "rage");
}
inf->newfile = EINA_FALSE;
} }
void void

View File

@ -27,6 +27,7 @@ struct _Inf
Eina_Bool dragging : 1; Eina_Bool dragging : 1;
Eina_Bool browse_mode : 1; Eina_Bool browse_mode : 1;
Eina_Bool down : 1; Eina_Bool down : 1;
Eina_Bool newfile : 1;
}; };
// ui high level controls // ui high level controls
@ -49,6 +50,7 @@ Eina_Bool win_video_have_prev(Evas_Object *win);
Evas_Object *win_add(void); Evas_Object *win_add(void);
void win_focus(Evas_Object *win); void win_focus(Evas_Object *win);
void win_title_update(Evas_Object *win); void win_title_update(Evas_Object *win);
void win_newfile(Evas_Object *win);
void win_show(Evas_Object *win, int w, int h); void win_show(Evas_Object *win, int w, int h);
void win_art(Evas_Object *win, const char *path); void win_art(Evas_Object *win, const char *path);
void win_aspect_adjust(Evas_Object *win); void win_aspect_adjust(Evas_Object *win);