1
0
Fork 0
forked from len0rd/rockbox

playlist.c use basename for playlist_get_filename_crc32

strip the vol and use the relative portion

Change-Id: I6259343e63a84f0ab97bd6f491de09320d74eac4
This commit is contained in:
William Wilgus 2022-03-11 19:10:06 -05:00 committed by William Wilgus
parent 359c66982f
commit eb32238b22

View file

@ -107,6 +107,27 @@
#include "dircache.h" #include "dircache.h"
#endif #endif
#if 0//def ROCKBOX_HAS_LOGDISKF
#warning LOGF enabled
#define LOGF_ENABLE
#include "logf.h"
#undef DEBUGF
#undef ERRORF
#undef WARNF
#undef NOTEF
#define DEBUGF logf
#define ERRORF DEBUGF
#define WARNF DEBUGF
#define NOTEF DEBUGF
//ERRORF
//WARNF
//NOTEF
#endif
#define PLAYLIST_CONTROL_FILE_VERSION 2 #define PLAYLIST_CONTROL_FILE_VERSION 2
/* /*
@ -2566,8 +2587,13 @@ unsigned int playlist_get_filename_crc32(struct playlist_info *playlist,
struct playlist_track_info track_info; struct playlist_track_info track_info;
if (playlist_get_track_info(playlist, index, &track_info) == -1) if (playlist_get_track_info(playlist, index, &track_info) == -1)
return -1; return -1;
const char *basename;
return crc_32(track_info.filename, strlen(track_info.filename), -1); /* remove the volume identifier it might change just use the relative part*/
path_strip_volume(track_info.filename, &basename, false);
if (basename == NULL)
basename = track_info.filename;
NOTEF("%s: %s", __func__, basename);
return crc_32(basename, strlen(basename), -1);
} }
/* resume a playlist track with the given crc_32 of the track name. */ /* resume a playlist track with the given crc_32 of the track name. */