Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How to get total file size of all items in playlist (Read 2775 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to get total file size of all items in playlist

Currently I use this code:
Code: [Select]
metadb_handle_list items;
pm->playlist_get_all_items(playlist_idx, items);
t_filesize total_filesize = 0;
for (int i=0; i<items.get_count(); i++) {
    total_filesize += items[i]->get_filesize();
    }
items.remove_all();

This works well for normal MP3/OGG/FLAC files, but the total filesize is not reported correctly when e.g. CUE+FLAC is used -- it seems that each song (which is part of CUE) returns the same filesize as the whole original file. Is it possible to show the filesize of part of FLAC (based on CUE info)?

I've noticed that Properties... box always shows only original size of whole flac size, no matter how many tracks from CUE are selected. How to achieve this effect? With my code, I get original_whole_flac_filesize * num_selected_tracks...

How to get total file size of all items in playlist

Reply #1
See file_list_helper::file_list_from_metadb_handle_list in the SDK helpers.

 

How to get total file size of all items in playlist

Reply #2
Thank you, now it works as intended. I've also realized that getting only file's certain part size is a nonsese.