diff --git a/src/modules/auto_playlist_manager.c b/src/modules/auto_playlist_manager.c index 5be64e3..65732a8 100644 --- a/src/modules/auto_playlist_manager.c +++ b/src/modules/auto_playlist_manager.c @@ -80,6 +80,7 @@ sort_cb(const char *a, const char *b) static inline Eina_Bool is_same_path(const char *a, const char *ae, const char *b, const char *be) { + const char *suba = NULL, *subb = NULL; if (!ae) { ae = strrchr(a, '/'); @@ -90,8 +91,23 @@ is_same_path(const char *a, const char *ae, const char *b, const char *be) be = strrchr(b, '/'); if (be) be++; } - if (ae - a != be - b) return EINA_FALSE; - return !memcmp(a, b, ae - a); + /* if full match on all directories, match */ + if ((ae - a == be - b) && (!memcmp(a, b, ae - a))) return EINA_TRUE; + if (ae) + suba = memrchr(a, '/', ae - a - 1); + if (be) + subb = memrchr(b, '/', be - b - 1); + /* try to match subsections of directories: + * Artist/Album/CD 1/song + * Artist/Album/CD 2/song2 + * this is valid + */ + if (suba && subb) + { + if (suba - a != subb - b) return EINA_FALSE; + return !memcmp(a, b, suba - a); + } + return EINA_FALSE; } static void