diff options
Diffstat (limited to 'src/dbUtils.c')
-rw-r--r-- | src/dbUtils.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c index 63f1f33b7..55791653f 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -6,6 +6,7 @@ #include "playlist.h" #include "tag.h" #include "tagTracker.h" +#include "log.h" #define LOCATE_TAG_FILE_TYPE TAG_NUM_OF_ITEM_TYPES+10 #define LOCATE_TAG_FILE_KEY "filename" @@ -76,7 +77,7 @@ static inline int strstrSearchTag(Song * song, int type, char * str) { int ret = 0; if(type == LOCATE_TAG_FILE_TYPE) { - dup = strDupToUpper(song->utf8url); + dup = strDupToUpper(getSongUrl(song)); if(strstr(dup, str)) ret = 1; free(dup); return ret; @@ -122,7 +123,7 @@ static inline int tagItemFoundAndMatches(Song * song, int type, char * str) { int i; if(type == LOCATE_TAG_FILE_TYPE) { - if(0 == strcmp(str, song->utf8url)) return 1; + if(0 == strcmp(str, getSongUrl(song))) return 1; } if(!song->tag) return 0; @@ -217,7 +218,7 @@ void printUnvisitedTags(FILE * fp, Song * song, int tagType) { MpdTag * tag = song->tag; if(tagType == LOCATE_TAG_FILE_TYPE) { - myfprintf(fp, "file: %s\n", song->utf8url); + printSongUrl(fp, song); return; } @@ -268,3 +269,23 @@ int listAllUniqueTags(FILE * fp, int type, int numConditionals, return ret; } + +int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) { + int * sum = data; + + if(!dir->utf8name) return 0; + + *sum += (strlen(dir->utf8name)+1-sizeof(Directory *))* + dir->songs->numberOfNodes; + + return 0; +} + +void printSavedMemoryFromFilenames() { + int sum; + + traverseAllIn(stderr, NULL, NULL, sumSavedMemoryInDirectory, + (void *)&sum); + + DEBUG("saved memory from filenames: %i\n", sum); +} |