PraghaMusicobject * new_musicobject_from_file(const gchar *file) { PraghaMusicobject *mobj = NULL; gchar *mime_type = NULL; gboolean ret = FALSE; CDEBUG(DBG_MOBJ, "Creating new musicobject from file: %s", file); mime_type = pragha_file_get_music_type(file); mobj = g_object_new (PRAGHA_TYPE_MUSICOBJECT, "file", file, "source", FILE_LOCAL, "mime-type", mime_type, NULL); g_free (mime_type); ret = pragha_musicobject_set_tags_from_file (mobj, file); if (G_LIKELY(ret)) return mobj; else { g_critical("Fail to create musicobject from file"); g_object_unref(mobj); } return NULL; }
gboolean is_playable_file(const gchar *file) { if (!file) return FALSE; if (g_file_test(file, G_FILE_TEST_IS_REGULAR) && (pragha_file_get_music_type(file) != FILE_NONE)) return TRUE; else return FALSE; }