-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstrip.cpp
More file actions
50 lines (41 loc) · 1.1 KB
/
strip.cpp
File metadata and controls
50 lines (41 loc) · 1.1 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
/*
* Copyright (c) 2013-2025 amded workers, All rights reserved.
* Terms for redistribution and use can be found in LICENCE.
*/
/**
* @file strip.cpp
* @brief Stripping all meta-data from files
*/
#include <iostream>
#include <fileref.h>
#include <tpropertymap.h>
#include "amded.h"
#include "file-spec.h"
#include "setup.h"
#include "strip.h"
void
amded_strip(struct amded_file &file)
{
if (file.fh->readOnly()) {
std::cerr << PROJECT << ": File is read-only: "
<< file.name << std::endl;
return;
}
if (file.multi_tag) {
strip_multitag(file);
return;
}
TagLib::PropertyMap pm = file.fh->properties();
const unsigned int unsupported = pm.unsupportedData().size();
pm.clear();
file.fh->setProperties(pm);
if (!get_opt(AMDED_KEEP_UNSUPPORTED_TAGS) && unsupported > 0) {
file.fh->removeUnsupportedProperties(pm.unsupportedData());
}
if (!(file.fh->save())) {
std::cerr << PROJECT << ": Failed to save file `"
<< file.name
<< "'"
<< std::endl;
}
}