-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMetadataHandler.h
More file actions
74 lines (62 loc) · 2.17 KB
/
MetadataHandler.h
File metadata and controls
74 lines (62 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef METADATA_HANDLER_H
#define METADATA_HANDLER_H
#include "MediaItem.h"
#include <Message.h>
#include <Messenger.h>
#include <String.h>
#include <vector>
/**
* @class MetadataHandler
* @brief Helper class for managing metadata operations (tags, covers).
*
* Handles reading and writing audio metadata, including embedded cover art.
* It encapsulates interactions with `TagSync` and processes batched updates
* received via BMessages from the UI (e.g., PropertiesWindow).
*/
class MetadataHandler {
public:
/**
* @brief Constructs the handler.
* @param target Messenger (usually MainWindow or CacheManager) to notify of
* changes.
*/
MetadataHandler(BMessenger target);
~MetadataHandler();
/**
* @brief Applies album cover to all files in the same album directory.
* @param filePath Path to one file in the album.
* @param data Raw image data.
* @param size Size of image data.
*/
void ApplyAlbumCover(const BString &filePath, const void *data, ssize_t size);
/**
* @brief Clears album cover from all files in the same album directory.
* @param filePath Path to one file in the album.
*/
void ClearAlbumCover(const BString &filePath);
/**
* @brief Applies cover art to a list of specific files.
* @param msg Message containing "file" strings, "bytes" data, and "mime"
* string.
*/
void ApplyCoverToAll(const BMessage *msg);
/**
* @brief Saves metadata tags (Project, Artist, etc.) to files.
* @param msg Message containing tag fields and list of "file" paths.
*/
void SaveTags(const BMessage *msg);
/**
* @brief Synchronizes metadata between Tags and BFS attributes.
* @param files List of file paths to sync.
* @param towardsBfs true = Tags→BFS, false = BFS→Tags.
*/
void SyncMetadata(const std::vector<BString> &files);
private:
BMessenger fTarget;
/**
* @brief Internal helper to iterate directory and update embedded covers.
*/
void _ProcessDirectoryForCover(const BString &filePath, bool clear,
const void *data = nullptr, size_t size = 0);
};
#endif // METADATA_HANDLER_H