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

v-0.4.0
Carsten Haitzler 3 years ago
parent ca538f6f8c
commit cf2b383f0c
  1. 1
      src/bin/video.c
  2. 36
      src/bin/win.c
  3. 2
      src/bin/win.h

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

@ -235,13 +235,13 @@ _local_artwork_get(void *data)
{
Evas_Object *win = data;
Inf *inf = evas_object_data_get(win, "inf");
if (!inf) return EINA_FALSE;
if (!inf->vid) return EINA_FALSE;
const char *file = NULL;
const char *filename = video_file_get(inf->vid);
Efreet_Uri *uri = efreet_uri_decode(filename);
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);
if (!artwork) artwork = video_meta_artwork_get(inf->vid, file, EMOTION_ARTWORK_IMAGE);
if (artwork)
{
evas_object_image_save(artwork, path, NULL, NULL);
@ -281,7 +281,6 @@ _local_artwork_get(void *data)
}
}
}
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)
{
const char *extn = strchr(file, '.');
win_newfile(win);
if ((extn) &&
((!strcasecmp(extn, ".mp3")) ||
(!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
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))
elm_layout_signal_emit(inf->lay, "state,novideo", "rage");
{
if (inf->newfile)
elm_layout_signal_emit(inf->lay, "state,novideo", "rage");
}
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))
elm_layout_signal_emit(inf->lay, "state,noaudio", "rage");
{
if (inf->newfile)
elm_layout_signal_emit(inf->lay, "state,noaudio", "rage");
}
else
elm_layout_signal_emit(inf->lay, "state,audio", "rage");
{
elm_layout_signal_emit(inf->lay, "state,audio", "rage");
}
inf->newfile = EINA_FALSE;
}
void

@ -27,6 +27,7 @@ struct _Inf
Eina_Bool dragging : 1;
Eina_Bool browse_mode : 1;
Eina_Bool down : 1;
Eina_Bool newfile : 1;
};
// ui high level controls
@ -49,6 +50,7 @@ Eina_Bool win_video_have_prev(Evas_Object *win);
Evas_Object *win_add(void);
void win_focus(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_art(Evas_Object *win, const char *path);
void win_aspect_adjust(Evas_Object *win);

Loading…
Cancel
Save