mp4ameta 0.13.0

A library for reading and writing iTunes style MPEG-4 audio metadata.
Documentation
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
// IMPORTANT: This file is automatically generated!
// Edit the `generate.toml` file and run the code generation from the repository root
// with the following command: `cargo run --manifest-path=gen/Cargo.toml`

use crate::{ident, Data, Userdata};

/// ### Album
impl Userdata {
    /// Returns the album (`©alb`).
    pub fn album(&self) -> Option<&str> {
        self.strings_of(&ident::ALBUM).next()
    }

    /// Removes and returns the album (`©alb`).
    pub fn take_album(&mut self) -> Option<String> {
        self.take_strings_of(&ident::ALBUM).next()
    }

    /// Sets the album (`©alb`).
    pub fn set_album(&mut self, album: impl Into<String>) {
        self.set_data(ident::ALBUM, Data::Utf8(album.into()));
    }

    /// Removes the album (`©alb`).
    pub fn remove_album(&mut self) {
        self.remove_data_of(&ident::ALBUM);
    }

    /// Returns the album formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_album(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.album() {
            Some(s) => writeln!(f, "album: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Copyright
impl Userdata {
    /// Returns the copyright (`cprt`).
    pub fn copyright(&self) -> Option<&str> {
        self.strings_of(&ident::COPYRIGHT).next()
    }

    /// Removes and returns the copyright (`cprt`).
    pub fn take_copyright(&mut self) -> Option<String> {
        self.take_strings_of(&ident::COPYRIGHT).next()
    }

    /// Sets the copyright (`cprt`).
    pub fn set_copyright(&mut self, copyright: impl Into<String>) {
        self.set_data(ident::COPYRIGHT, Data::Utf8(copyright.into()));
    }

    /// Removes the copyright (`cprt`).
    pub fn remove_copyright(&mut self) {
        self.remove_data_of(&ident::COPYRIGHT);
    }

    /// Returns the copyright formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_copyright(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.copyright() {
            Some(s) => writeln!(f, "copyright: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Encoder
impl Userdata {
    /// Returns the encoder (`©too`).
    pub fn encoder(&self) -> Option<&str> {
        self.strings_of(&ident::ENCODER).next()
    }

    /// Removes and returns the encoder (`©too`).
    pub fn take_encoder(&mut self) -> Option<String> {
        self.take_strings_of(&ident::ENCODER).next()
    }

    /// Sets the encoder (`©too`).
    pub fn set_encoder(&mut self, encoder: impl Into<String>) {
        self.set_data(ident::ENCODER, Data::Utf8(encoder.into()));
    }

    /// Removes the encoder (`©too`).
    pub fn remove_encoder(&mut self) {
        self.remove_data_of(&ident::ENCODER);
    }

    /// Returns the encoder formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_encoder(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.encoder() {
            Some(s) => writeln!(f, "encoder: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Lyrics
impl Userdata {
    /// Returns the lyrics (`©lyr`).
    pub fn lyrics(&self) -> Option<&str> {
        self.strings_of(&ident::LYRICS).next()
    }

    /// Removes and returns the lyrics (`©lyr`).
    pub fn take_lyrics(&mut self) -> Option<String> {
        self.take_strings_of(&ident::LYRICS).next()
    }

    /// Sets the lyrics (`©lyr`).
    pub fn set_lyrics(&mut self, lyrics: impl Into<String>) {
        self.set_data(ident::LYRICS, Data::Utf8(lyrics.into()));
    }

    /// Removes the lyrics (`©lyr`).
    pub fn remove_lyrics(&mut self) {
        self.remove_data_of(&ident::LYRICS);
    }

    /// Returns the lyrics formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_lyrics(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.lyrics() {
            Some(s) => writeln!(f, "lyrics: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Movement
impl Userdata {
    /// Returns the movement (`©mvn`).
    pub fn movement(&self) -> Option<&str> {
        self.strings_of(&ident::MOVEMENT).next()
    }

    /// Removes and returns the movement (`©mvn`).
    pub fn take_movement(&mut self) -> Option<String> {
        self.take_strings_of(&ident::MOVEMENT).next()
    }

    /// Sets the movement (`©mvn`).
    pub fn set_movement(&mut self, movement: impl Into<String>) {
        self.set_data(ident::MOVEMENT, Data::Utf8(movement.into()));
    }

    /// Removes the movement (`©mvn`).
    pub fn remove_movement(&mut self) {
        self.remove_data_of(&ident::MOVEMENT);
    }

    /// Returns the movement formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_movement(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.movement() {
            Some(s) => writeln!(f, "movement: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Title
impl Userdata {
    /// Returns the title (`©nam`).
    pub fn title(&self) -> Option<&str> {
        self.strings_of(&ident::TITLE).next()
    }

    /// Removes and returns the title (`©nam`).
    pub fn take_title(&mut self) -> Option<String> {
        self.take_strings_of(&ident::TITLE).next()
    }

    /// Sets the title (`©nam`).
    pub fn set_title(&mut self, title: impl Into<String>) {
        self.set_data(ident::TITLE, Data::Utf8(title.into()));
    }

    /// Removes the title (`©nam`).
    pub fn remove_title(&mut self) {
        self.remove_data_of(&ident::TITLE);
    }

    /// Returns the title formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_title(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.title() {
            Some(s) => writeln!(f, "title: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Tv episode name
impl Userdata {
    /// Returns the tv episode name (`tven`).
    pub fn tv_episode_name(&self) -> Option<&str> {
        self.strings_of(&ident::TV_EPISODE_NAME).next()
    }

    /// Removes and returns the tv episode name (`tven`).
    pub fn take_tv_episode_name(&mut self) -> Option<String> {
        self.take_strings_of(&ident::TV_EPISODE_NAME).next()
    }

    /// Sets the tv episode name (`tven`).
    pub fn set_tv_episode_name(&mut self, tv_episode_name: impl Into<String>) {
        self.set_data(ident::TV_EPISODE_NAME, Data::Utf8(tv_episode_name.into()));
    }

    /// Removes the tv episode name (`tven`).
    pub fn remove_tv_episode_name(&mut self) {
        self.remove_data_of(&ident::TV_EPISODE_NAME);
    }

    /// Returns the tv episode name formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_tv_episode_name(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.tv_episode_name() {
            Some(s) => writeln!(f, "tv episode name: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Tv network name
impl Userdata {
    /// Returns the tv network name (`tvnn`).
    pub fn tv_network_name(&self) -> Option<&str> {
        self.strings_of(&ident::TV_NETWORK_NAME).next()
    }

    /// Removes and returns the tv network name (`tvnn`).
    pub fn take_tv_network_name(&mut self) -> Option<String> {
        self.take_strings_of(&ident::TV_NETWORK_NAME).next()
    }

    /// Sets the tv network name (`tvnn`).
    pub fn set_tv_network_name(&mut self, tv_network_name: impl Into<String>) {
        self.set_data(ident::TV_NETWORK_NAME, Data::Utf8(tv_network_name.into()));
    }

    /// Removes the tv network name (`tvnn`).
    pub fn remove_tv_network_name(&mut self) {
        self.remove_data_of(&ident::TV_NETWORK_NAME);
    }

    /// Returns the tv network name formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_tv_network_name(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.tv_network_name() {
            Some(s) => writeln!(f, "tv network name: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Tv show name
impl Userdata {
    /// Returns the tv show name (`tvsh`).
    pub fn tv_show_name(&self) -> Option<&str> {
        self.strings_of(&ident::TV_SHOW_NAME).next()
    }

    /// Removes and returns the tv show name (`tvsh`).
    pub fn take_tv_show_name(&mut self) -> Option<String> {
        self.take_strings_of(&ident::TV_SHOW_NAME).next()
    }

    /// Sets the tv show name (`tvsh`).
    pub fn set_tv_show_name(&mut self, tv_show_name: impl Into<String>) {
        self.set_data(ident::TV_SHOW_NAME, Data::Utf8(tv_show_name.into()));
    }

    /// Removes the tv show name (`tvsh`).
    pub fn remove_tv_show_name(&mut self) {
        self.remove_data_of(&ident::TV_SHOW_NAME);
    }

    /// Returns the tv show name formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_tv_show_name(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.tv_show_name() {
            Some(s) => writeln!(f, "tv show name: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Work
impl Userdata {
    /// Returns the work (`©wrk`).
    pub fn work(&self) -> Option<&str> {
        self.strings_of(&ident::WORK).next()
    }

    /// Removes and returns the work (`©wrk`).
    pub fn take_work(&mut self) -> Option<String> {
        self.take_strings_of(&ident::WORK).next()
    }

    /// Sets the work (`©wrk`).
    pub fn set_work(&mut self, work: impl Into<String>) {
        self.set_data(ident::WORK, Data::Utf8(work.into()));
    }

    /// Removes the work (`©wrk`).
    pub fn remove_work(&mut self) {
        self.remove_data_of(&ident::WORK);
    }

    /// Returns the work formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_work(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.work() {
            Some(s) => writeln!(f, "work: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Year
impl Userdata {
    /// Returns the year (`©day`).
    pub fn year(&self) -> Option<&str> {
        self.strings_of(&ident::YEAR).next()
    }

    /// Removes and returns the year (`©day`).
    pub fn take_year(&mut self) -> Option<String> {
        self.take_strings_of(&ident::YEAR).next()
    }

    /// Sets the year (`©day`).
    pub fn set_year(&mut self, year: impl Into<String>) {
        self.set_data(ident::YEAR, Data::Utf8(year.into()));
    }

    /// Removes the year (`©day`).
    pub fn remove_year(&mut self) {
        self.remove_data_of(&ident::YEAR);
    }

    /// Returns the year formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_year(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.year() {
            Some(s) => writeln!(f, "year: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Isrc
impl Userdata {
    /// Returns the isrc (`----:com.apple.iTunes:ISRC`).
    pub fn isrc(&self) -> Option<&str> {
        self.strings_of(&ident::ISRC).next()
    }

    /// Removes and returns the isrc (`----:com.apple.iTunes:ISRC`).
    pub fn take_isrc(&mut self) -> Option<String> {
        self.take_strings_of(&ident::ISRC).next()
    }

    /// Sets the isrc (`----:com.apple.iTunes:ISRC`).
    pub fn set_isrc(&mut self, isrc: impl Into<String>) {
        self.set_data(ident::ISRC, Data::Utf8(isrc.into()));
    }

    /// Removes the isrc (`----:com.apple.iTunes:ISRC`).
    pub fn remove_isrc(&mut self) {
        self.remove_data_of(&ident::ISRC);
    }

    /// Returns the isrc formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_isrc(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.isrc() {
            Some(s) => writeln!(f, "isrc: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Label
impl Userdata {
    /// Returns the label (`----:com.apple.iTunes:LABEL`).
    pub fn label(&self) -> Option<&str> {
        self.strings_of(&ident::LABEL).next()
    }

    /// Removes and returns the label (`----:com.apple.iTunes:LABEL`).
    pub fn take_label(&mut self) -> Option<String> {
        self.take_strings_of(&ident::LABEL).next()
    }

    /// Sets the label (`----:com.apple.iTunes:LABEL`).
    pub fn set_label(&mut self, label: impl Into<String>) {
        self.set_data(ident::LABEL, Data::Utf8(label.into()));
    }

    /// Removes the label (`----:com.apple.iTunes:LABEL`).
    pub fn remove_label(&mut self) {
        self.remove_data_of(&ident::LABEL);
    }

    /// Returns the label formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_label(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.label() {
            Some(s) => writeln!(f, "label: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Album sort order
impl Userdata {
    /// Returns the album sort order (`soal`).
    pub fn album_sort_order(&self) -> Option<&str> {
        self.strings_of(&ident::ALBUM_SORT_ORDER).next()
    }

    /// Removes and returns the album sort order (`soal`).
    pub fn take_album_sort_order(&mut self) -> Option<String> {
        self.take_strings_of(&ident::ALBUM_SORT_ORDER).next()
    }

    /// Sets the album sort order (`soal`).
    pub fn set_album_sort_order(&mut self, album_sort_order: impl Into<String>) {
        self.set_data(ident::ALBUM_SORT_ORDER, Data::Utf8(album_sort_order.into()));
    }

    /// Removes the album sort order (`soal`).
    pub fn remove_album_sort_order(&mut self) {
        self.remove_data_of(&ident::ALBUM_SORT_ORDER);
    }

    /// Returns the album sort order formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_album_sort_order(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.album_sort_order() {
            Some(s) => writeln!(f, "album sort order: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Title sort order
impl Userdata {
    /// Returns the title sort order (`sonm`).
    pub fn title_sort_order(&self) -> Option<&str> {
        self.strings_of(&ident::TITLE_SORT_ORDER).next()
    }

    /// Removes and returns the title sort order (`sonm`).
    pub fn take_title_sort_order(&mut self) -> Option<String> {
        self.take_strings_of(&ident::TITLE_SORT_ORDER).next()
    }

    /// Sets the title sort order (`sonm`).
    pub fn set_title_sort_order(&mut self, title_sort_order: impl Into<String>) {
        self.set_data(ident::TITLE_SORT_ORDER, Data::Utf8(title_sort_order.into()));
    }

    /// Removes the title sort order (`sonm`).
    pub fn remove_title_sort_order(&mut self) {
        self.remove_data_of(&ident::TITLE_SORT_ORDER);
    }

    /// Returns the title sort order formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_title_sort_order(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.title_sort_order() {
            Some(s) => writeln!(f, "title sort order: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Tv show name sort order
impl Userdata {
    /// Returns the tv show name sort order (`sosn`).
    pub fn tv_show_name_sort_order(&self) -> Option<&str> {
        self.strings_of(&ident::TV_SHOW_NAME_SORT_ORDER).next()
    }

    /// Removes and returns the tv show name sort order (`sosn`).
    pub fn take_tv_show_name_sort_order(&mut self) -> Option<String> {
        self.take_strings_of(&ident::TV_SHOW_NAME_SORT_ORDER).next()
    }

    /// Sets the tv show name sort order (`sosn`).
    pub fn set_tv_show_name_sort_order(&mut self, tv_show_name_sort_order: impl Into<String>) {
        self.set_data(ident::TV_SHOW_NAME_SORT_ORDER, Data::Utf8(tv_show_name_sort_order.into()));
    }

    /// Removes the tv show name sort order (`sosn`).
    pub fn remove_tv_show_name_sort_order(&mut self) {
        self.remove_data_of(&ident::TV_SHOW_NAME_SORT_ORDER);
    }

    /// Returns the tv show name sort order formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_tv_show_name_sort_order(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.tv_show_name_sort_order() {
            Some(s) => writeln!(f, "tv show name sort order: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Album artist
impl Userdata {
    /// Returns all album artists (`aART`).
    pub fn album_artists(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::ALBUM_ARTIST)
    }

    /// Returns the first album artist (`aART`).
    pub fn album_artist(&self) -> Option<&str> {
        self.strings_of(&ident::ALBUM_ARTIST).next()
    }

    /// Removes and returns all album artists (`aART`).
    pub fn take_album_artists(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::ALBUM_ARTIST)
    }

    /// Removes all and returns the first album artist (`aART`).
    pub fn take_album_artist(&mut self) -> Option<String> {
        self.take_strings_of(&ident::ALBUM_ARTIST).next()
    }

    /// Sets all album artists (`aART`). This will remove all other album artists.
    pub fn set_album_artists(&mut self, album_artists: impl IntoIterator<Item = String>) {
        let data = album_artists.into_iter().map(Data::Utf8);
        self.set_all_data(ident::ALBUM_ARTIST, data);
    }

    /// Sets the album artist (`aART`). This will remove all other album artists.
    pub fn set_album_artist(&mut self, album_artist: impl Into<String>) {
        self.set_data(ident::ALBUM_ARTIST, Data::Utf8(album_artist.into()));
    }

    /// Adds all album artists (`aART`).
    pub fn add_album_artists(&mut self, album_artists: impl IntoIterator<Item = String>) {
        let data = album_artists.into_iter().map(Data::Utf8);
        self.add_all_data(ident::ALBUM_ARTIST, data);
    }

    /// Adds an album artist (`aART`).
    pub fn add_album_artist(&mut self, album_artist: impl Into<String>) {
        self.add_data(ident::ALBUM_ARTIST, Data::Utf8(album_artist.into()));
    }

    /// Removes all album artists (`aART`).
    pub fn remove_album_artists(&mut self) {
        self.remove_data_of(&ident::ALBUM_ARTIST);
    }

    /// Returns all album artists formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_album_artists(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.album_artists().count() > 1 {
            writeln!(f, "album artists:")?;
            for s in self.album_artists() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.album_artist() {
            writeln!(f, "album artist: {}", s)?;
        }
        Ok(())
    }
}

/// ### Artist
impl Userdata {
    /// Returns all artists (`©ART`).
    pub fn artists(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::ARTIST)
    }

    /// Returns the first artist (`©ART`).
    pub fn artist(&self) -> Option<&str> {
        self.strings_of(&ident::ARTIST).next()
    }

    /// Removes and returns all artists (`©ART`).
    pub fn take_artists(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::ARTIST)
    }

    /// Removes all and returns the first artist (`©ART`).
    pub fn take_artist(&mut self) -> Option<String> {
        self.take_strings_of(&ident::ARTIST).next()
    }

    /// Sets all artists (`©ART`). This will remove all other artists.
    pub fn set_artists(&mut self, artists: impl IntoIterator<Item = String>) {
        let data = artists.into_iter().map(Data::Utf8);
        self.set_all_data(ident::ARTIST, data);
    }

    /// Sets the artist (`©ART`). This will remove all other artists.
    pub fn set_artist(&mut self, artist: impl Into<String>) {
        self.set_data(ident::ARTIST, Data::Utf8(artist.into()));
    }

    /// Adds all artists (`©ART`).
    pub fn add_artists(&mut self, artists: impl IntoIterator<Item = String>) {
        let data = artists.into_iter().map(Data::Utf8);
        self.add_all_data(ident::ARTIST, data);
    }

    /// Adds an artist (`©ART`).
    pub fn add_artist(&mut self, artist: impl Into<String>) {
        self.add_data(ident::ARTIST, Data::Utf8(artist.into()));
    }

    /// Removes all artists (`©ART`).
    pub fn remove_artists(&mut self) {
        self.remove_data_of(&ident::ARTIST);
    }

    /// Returns all artists formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_artists(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.artists().count() > 1 {
            writeln!(f, "artists:")?;
            for s in self.artists() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.artist() {
            writeln!(f, "artist: {}", s)?;
        }
        Ok(())
    }
}

/// ### Category
impl Userdata {
    /// Returns all categories (`catg`).
    pub fn categories(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::CATEGORY)
    }

    /// Returns the first category (`catg`).
    pub fn category(&self) -> Option<&str> {
        self.strings_of(&ident::CATEGORY).next()
    }

    /// Removes and returns all categories (`catg`).
    pub fn take_categories(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::CATEGORY)
    }

    /// Removes all and returns the first category (`catg`).
    pub fn take_category(&mut self) -> Option<String> {
        self.take_strings_of(&ident::CATEGORY).next()
    }

    /// Sets all categories (`catg`). This will remove all other categories.
    pub fn set_categories(&mut self, categories: impl IntoIterator<Item = String>) {
        let data = categories.into_iter().map(Data::Utf8);
        self.set_all_data(ident::CATEGORY, data);
    }

    /// Sets the category (`catg`). This will remove all other categories.
    pub fn set_category(&mut self, category: impl Into<String>) {
        self.set_data(ident::CATEGORY, Data::Utf8(category.into()));
    }

    /// Adds all categories (`catg`).
    pub fn add_categories(&mut self, categories: impl IntoIterator<Item = String>) {
        let data = categories.into_iter().map(Data::Utf8);
        self.add_all_data(ident::CATEGORY, data);
    }

    /// Adds an category (`catg`).
    pub fn add_category(&mut self, category: impl Into<String>) {
        self.add_data(ident::CATEGORY, Data::Utf8(category.into()));
    }

    /// Removes all categories (`catg`).
    pub fn remove_categories(&mut self) {
        self.remove_data_of(&ident::CATEGORY);
    }

    /// Returns all categories formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_categories(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.categories().count() > 1 {
            writeln!(f, "categories:")?;
            for s in self.categories() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.category() {
            writeln!(f, "category: {}", s)?;
        }
        Ok(())
    }
}

/// ### Comment
impl Userdata {
    /// Returns all comments (`©cmt`).
    pub fn comments(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::COMMENT)
    }

    /// Returns the first comment (`©cmt`).
    pub fn comment(&self) -> Option<&str> {
        self.strings_of(&ident::COMMENT).next()
    }

    /// Removes and returns all comments (`©cmt`).
    pub fn take_comments(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::COMMENT)
    }

    /// Removes all and returns the first comment (`©cmt`).
    pub fn take_comment(&mut self) -> Option<String> {
        self.take_strings_of(&ident::COMMENT).next()
    }

    /// Sets all comments (`©cmt`). This will remove all other comments.
    pub fn set_comments(&mut self, comments: impl IntoIterator<Item = String>) {
        let data = comments.into_iter().map(Data::Utf8);
        self.set_all_data(ident::COMMENT, data);
    }

    /// Sets the comment (`©cmt`). This will remove all other comments.
    pub fn set_comment(&mut self, comment: impl Into<String>) {
        self.set_data(ident::COMMENT, Data::Utf8(comment.into()));
    }

    /// Adds all comments (`©cmt`).
    pub fn add_comments(&mut self, comments: impl IntoIterator<Item = String>) {
        let data = comments.into_iter().map(Data::Utf8);
        self.add_all_data(ident::COMMENT, data);
    }

    /// Adds an comment (`©cmt`).
    pub fn add_comment(&mut self, comment: impl Into<String>) {
        self.add_data(ident::COMMENT, Data::Utf8(comment.into()));
    }

    /// Removes all comments (`©cmt`).
    pub fn remove_comments(&mut self) {
        self.remove_data_of(&ident::COMMENT);
    }

    /// Returns all comments formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_comments(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.comments().count() > 1 {
            writeln!(f, "comments:")?;
            for s in self.comments() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.comment() {
            writeln!(f, "comment: {}", s)?;
        }
        Ok(())
    }
}

/// ### Composer
impl Userdata {
    /// Returns all composers (`©wrt`).
    pub fn composers(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::COMPOSER)
    }

    /// Returns the first composer (`©wrt`).
    pub fn composer(&self) -> Option<&str> {
        self.strings_of(&ident::COMPOSER).next()
    }

    /// Removes and returns all composers (`©wrt`).
    pub fn take_composers(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::COMPOSER)
    }

    /// Removes all and returns the first composer (`©wrt`).
    pub fn take_composer(&mut self) -> Option<String> {
        self.take_strings_of(&ident::COMPOSER).next()
    }

    /// Sets all composers (`©wrt`). This will remove all other composers.
    pub fn set_composers(&mut self, composers: impl IntoIterator<Item = String>) {
        let data = composers.into_iter().map(Data::Utf8);
        self.set_all_data(ident::COMPOSER, data);
    }

    /// Sets the composer (`©wrt`). This will remove all other composers.
    pub fn set_composer(&mut self, composer: impl Into<String>) {
        self.set_data(ident::COMPOSER, Data::Utf8(composer.into()));
    }

    /// Adds all composers (`©wrt`).
    pub fn add_composers(&mut self, composers: impl IntoIterator<Item = String>) {
        let data = composers.into_iter().map(Data::Utf8);
        self.add_all_data(ident::COMPOSER, data);
    }

    /// Adds an composer (`©wrt`).
    pub fn add_composer(&mut self, composer: impl Into<String>) {
        self.add_data(ident::COMPOSER, Data::Utf8(composer.into()));
    }

    /// Removes all composers (`©wrt`).
    pub fn remove_composers(&mut self) {
        self.remove_data_of(&ident::COMPOSER);
    }

    /// Returns all composers formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_composers(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.composers().count() > 1 {
            writeln!(f, "composers:")?;
            for s in self.composers() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.composer() {
            writeln!(f, "composer: {}", s)?;
        }
        Ok(())
    }
}

/// ### Custom genre
impl Userdata {
    /// Returns all custom genres (`©gen`).
    pub fn custom_genres(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::CUSTOM_GENRE)
    }

    /// Returns the first custom genre (`©gen`).
    pub fn custom_genre(&self) -> Option<&str> {
        self.strings_of(&ident::CUSTOM_GENRE).next()
    }

    /// Removes and returns all custom genres (`©gen`).
    pub fn take_custom_genres(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::CUSTOM_GENRE)
    }

    /// Removes all and returns the first custom genre (`©gen`).
    pub fn take_custom_genre(&mut self) -> Option<String> {
        self.take_strings_of(&ident::CUSTOM_GENRE).next()
    }

    /// Sets all custom genres (`©gen`). This will remove all other custom genres.
    pub fn set_custom_genres(&mut self, custom_genres: impl IntoIterator<Item = String>) {
        let data = custom_genres.into_iter().map(Data::Utf8);
        self.set_all_data(ident::CUSTOM_GENRE, data);
    }

    /// Sets the custom genre (`©gen`). This will remove all other custom genres.
    pub fn set_custom_genre(&mut self, custom_genre: impl Into<String>) {
        self.set_data(ident::CUSTOM_GENRE, Data::Utf8(custom_genre.into()));
    }

    /// Adds all custom genres (`©gen`).
    pub fn add_custom_genres(&mut self, custom_genres: impl IntoIterator<Item = String>) {
        let data = custom_genres.into_iter().map(Data::Utf8);
        self.add_all_data(ident::CUSTOM_GENRE, data);
    }

    /// Adds an custom genre (`©gen`).
    pub fn add_custom_genre(&mut self, custom_genre: impl Into<String>) {
        self.add_data(ident::CUSTOM_GENRE, Data::Utf8(custom_genre.into()));
    }

    /// Removes all custom genres (`©gen`).
    pub fn remove_custom_genres(&mut self) {
        self.remove_data_of(&ident::CUSTOM_GENRE);
    }

    /// Returns all custom genres formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_custom_genres(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.custom_genres().count() > 1 {
            writeln!(f, "custom genres:")?;
            for s in self.custom_genres() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.custom_genre() {
            writeln!(f, "custom genre: {}", s)?;
        }
        Ok(())
    }
}

/// ### Description
impl Userdata {
    /// Returns all descriptions (`desc`).
    pub fn descriptions(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::DESCRIPTION)
    }

    /// Returns the first description (`desc`).
    pub fn description(&self) -> Option<&str> {
        self.strings_of(&ident::DESCRIPTION).next()
    }

    /// Removes and returns all descriptions (`desc`).
    pub fn take_descriptions(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::DESCRIPTION)
    }

    /// Removes all and returns the first description (`desc`).
    pub fn take_description(&mut self) -> Option<String> {
        self.take_strings_of(&ident::DESCRIPTION).next()
    }

    /// Sets all descriptions (`desc`). This will remove all other descriptions.
    pub fn set_descriptions(&mut self, descriptions: impl IntoIterator<Item = String>) {
        let data = descriptions.into_iter().map(Data::Utf8);
        self.set_all_data(ident::DESCRIPTION, data);
    }

    /// Sets the description (`desc`). This will remove all other descriptions.
    pub fn set_description(&mut self, description: impl Into<String>) {
        self.set_data(ident::DESCRIPTION, Data::Utf8(description.into()));
    }

    /// Adds all descriptions (`desc`).
    pub fn add_descriptions(&mut self, descriptions: impl IntoIterator<Item = String>) {
        let data = descriptions.into_iter().map(Data::Utf8);
        self.add_all_data(ident::DESCRIPTION, data);
    }

    /// Adds an description (`desc`).
    pub fn add_description(&mut self, description: impl Into<String>) {
        self.add_data(ident::DESCRIPTION, Data::Utf8(description.into()));
    }

    /// Removes all descriptions (`desc`).
    pub fn remove_descriptions(&mut self) {
        self.remove_data_of(&ident::DESCRIPTION);
    }

    /// Returns all descriptions formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_descriptions(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.descriptions().count() > 1 {
            writeln!(f, "descriptions:")?;
            for s in self.descriptions() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.description() {
            writeln!(f, "description: {}", s)?;
        }
        Ok(())
    }
}

/// ### Grouping
impl Userdata {
    /// Returns all groupings (`©grp`).
    pub fn groupings(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::GROUPING)
    }

    /// Returns the first grouping (`©grp`).
    pub fn grouping(&self) -> Option<&str> {
        self.strings_of(&ident::GROUPING).next()
    }

    /// Removes and returns all groupings (`©grp`).
    pub fn take_groupings(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::GROUPING)
    }

    /// Removes all and returns the first grouping (`©grp`).
    pub fn take_grouping(&mut self) -> Option<String> {
        self.take_strings_of(&ident::GROUPING).next()
    }

    /// Sets all groupings (`©grp`). This will remove all other groupings.
    pub fn set_groupings(&mut self, groupings: impl IntoIterator<Item = String>) {
        let data = groupings.into_iter().map(Data::Utf8);
        self.set_all_data(ident::GROUPING, data);
    }

    /// Sets the grouping (`©grp`). This will remove all other groupings.
    pub fn set_grouping(&mut self, grouping: impl Into<String>) {
        self.set_data(ident::GROUPING, Data::Utf8(grouping.into()));
    }

    /// Adds all groupings (`©grp`).
    pub fn add_groupings(&mut self, groupings: impl IntoIterator<Item = String>) {
        let data = groupings.into_iter().map(Data::Utf8);
        self.add_all_data(ident::GROUPING, data);
    }

    /// Adds an grouping (`©grp`).
    pub fn add_grouping(&mut self, grouping: impl Into<String>) {
        self.add_data(ident::GROUPING, Data::Utf8(grouping.into()));
    }

    /// Removes all groupings (`©grp`).
    pub fn remove_groupings(&mut self) {
        self.remove_data_of(&ident::GROUPING);
    }

    /// Returns all groupings formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_groupings(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.groupings().count() > 1 {
            writeln!(f, "groupings:")?;
            for s in self.groupings() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.grouping() {
            writeln!(f, "grouping: {}", s)?;
        }
        Ok(())
    }
}

/// ### Keyword
impl Userdata {
    /// Returns all keywords (`keyw`).
    pub fn keywords(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::KEYWORD)
    }

    /// Returns the first keyword (`keyw`).
    pub fn keyword(&self) -> Option<&str> {
        self.strings_of(&ident::KEYWORD).next()
    }

    /// Removes and returns all keywords (`keyw`).
    pub fn take_keywords(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::KEYWORD)
    }

    /// Removes all and returns the first keyword (`keyw`).
    pub fn take_keyword(&mut self) -> Option<String> {
        self.take_strings_of(&ident::KEYWORD).next()
    }

    /// Sets all keywords (`keyw`). This will remove all other keywords.
    pub fn set_keywords(&mut self, keywords: impl IntoIterator<Item = String>) {
        let data = keywords.into_iter().map(Data::Utf8);
        self.set_all_data(ident::KEYWORD, data);
    }

    /// Sets the keyword (`keyw`). This will remove all other keywords.
    pub fn set_keyword(&mut self, keyword: impl Into<String>) {
        self.set_data(ident::KEYWORD, Data::Utf8(keyword.into()));
    }

    /// Adds all keywords (`keyw`).
    pub fn add_keywords(&mut self, keywords: impl IntoIterator<Item = String>) {
        let data = keywords.into_iter().map(Data::Utf8);
        self.add_all_data(ident::KEYWORD, data);
    }

    /// Adds an keyword (`keyw`).
    pub fn add_keyword(&mut self, keyword: impl Into<String>) {
        self.add_data(ident::KEYWORD, Data::Utf8(keyword.into()));
    }

    /// Removes all keywords (`keyw`).
    pub fn remove_keywords(&mut self) {
        self.remove_data_of(&ident::KEYWORD);
    }

    /// Returns all keywords formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_keywords(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.keywords().count() > 1 {
            writeln!(f, "keywords:")?;
            for s in self.keywords() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.keyword() {
            writeln!(f, "keyword: {}", s)?;
        }
        Ok(())
    }
}

/// ### Lyricist
impl Userdata {
    /// Returns all lyricists (`----:com.apple.iTunes:LYRICIST`).
    pub fn lyricists(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::LYRICIST)
    }

    /// Returns the first lyricist (`----:com.apple.iTunes:LYRICIST`).
    pub fn lyricist(&self) -> Option<&str> {
        self.strings_of(&ident::LYRICIST).next()
    }

    /// Removes and returns all lyricists (`----:com.apple.iTunes:LYRICIST`).
    pub fn take_lyricists(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::LYRICIST)
    }

    /// Removes all and returns the first lyricist (`----:com.apple.iTunes:LYRICIST`).
    pub fn take_lyricist(&mut self) -> Option<String> {
        self.take_strings_of(&ident::LYRICIST).next()
    }

    /// Sets all lyricists (`----:com.apple.iTunes:LYRICIST`). This will remove all other lyricists.
    pub fn set_lyricists(&mut self, lyricists: impl IntoIterator<Item = String>) {
        let data = lyricists.into_iter().map(Data::Utf8);
        self.set_all_data(ident::LYRICIST, data);
    }

    /// Sets the lyricist (`----:com.apple.iTunes:LYRICIST`). This will remove all other lyricists.
    pub fn set_lyricist(&mut self, lyricist: impl Into<String>) {
        self.set_data(ident::LYRICIST, Data::Utf8(lyricist.into()));
    }

    /// Adds all lyricists (`----:com.apple.iTunes:LYRICIST`).
    pub fn add_lyricists(&mut self, lyricists: impl IntoIterator<Item = String>) {
        let data = lyricists.into_iter().map(Data::Utf8);
        self.add_all_data(ident::LYRICIST, data);
    }

    /// Adds an lyricist (`----:com.apple.iTunes:LYRICIST`).
    pub fn add_lyricist(&mut self, lyricist: impl Into<String>) {
        self.add_data(ident::LYRICIST, Data::Utf8(lyricist.into()));
    }

    /// Removes all lyricists (`----:com.apple.iTunes:LYRICIST`).
    pub fn remove_lyricists(&mut self) {
        self.remove_data_of(&ident::LYRICIST);
    }

    /// Returns all lyricists formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_lyricists(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.lyricists().count() > 1 {
            writeln!(f, "lyricists:")?;
            for s in self.lyricists() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.lyricist() {
            writeln!(f, "lyricist: {}", s)?;
        }
        Ok(())
    }
}

/// ### Album artist sort order
impl Userdata {
    /// Returns all album artist sort orders (`soaa`).
    pub fn album_artist_sort_orders(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::ALBUM_ARTIST_SORT_ORDER)
    }

    /// Returns the first album artist sort order (`soaa`).
    pub fn album_artist_sort_order(&self) -> Option<&str> {
        self.strings_of(&ident::ALBUM_ARTIST_SORT_ORDER).next()
    }

    /// Removes and returns all album artist sort orders (`soaa`).
    pub fn take_album_artist_sort_orders(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::ALBUM_ARTIST_SORT_ORDER)
    }

    /// Removes all and returns the first album artist sort order (`soaa`).
    pub fn take_album_artist_sort_order(&mut self) -> Option<String> {
        self.take_strings_of(&ident::ALBUM_ARTIST_SORT_ORDER).next()
    }

    /// Sets all album artist sort orders (`soaa`). This will remove all other album artist sort orders.
    pub fn set_album_artist_sort_orders(&mut self, album_artist_sort_orders: impl IntoIterator<Item = String>) {
        let data = album_artist_sort_orders.into_iter().map(Data::Utf8);
        self.set_all_data(ident::ALBUM_ARTIST_SORT_ORDER, data);
    }

    /// Sets the album artist sort order (`soaa`). This will remove all other album artist sort orders.
    pub fn set_album_artist_sort_order(&mut self, album_artist_sort_order: impl Into<String>) {
        self.set_data(ident::ALBUM_ARTIST_SORT_ORDER, Data::Utf8(album_artist_sort_order.into()));
    }

    /// Adds all album artist sort orders (`soaa`).
    pub fn add_album_artist_sort_orders(&mut self, album_artist_sort_orders: impl IntoIterator<Item = String>) {
        let data = album_artist_sort_orders.into_iter().map(Data::Utf8);
        self.add_all_data(ident::ALBUM_ARTIST_SORT_ORDER, data);
    }

    /// Adds an album artist sort order (`soaa`).
    pub fn add_album_artist_sort_order(&mut self, album_artist_sort_order: impl Into<String>) {
        self.add_data(ident::ALBUM_ARTIST_SORT_ORDER, Data::Utf8(album_artist_sort_order.into()));
    }

    /// Removes all album artist sort orders (`soaa`).
    pub fn remove_album_artist_sort_orders(&mut self) {
        self.remove_data_of(&ident::ALBUM_ARTIST_SORT_ORDER);
    }

    /// Returns all album artist sort orders formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_album_artist_sort_orders(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.album_artist_sort_orders().count() > 1 {
            writeln!(f, "album artist sort orders:")?;
            for s in self.album_artist_sort_orders() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.album_artist_sort_order() {
            writeln!(f, "album artist sort order: {}", s)?;
        }
        Ok(())
    }
}

/// ### Artist sort order
impl Userdata {
    /// Returns all artist sort orders (`soar`).
    pub fn artist_sort_orders(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::ARTIST_SORT_ORDER)
    }

    /// Returns the first artist sort order (`soar`).
    pub fn artist_sort_order(&self) -> Option<&str> {
        self.strings_of(&ident::ARTIST_SORT_ORDER).next()
    }

    /// Removes and returns all artist sort orders (`soar`).
    pub fn take_artist_sort_orders(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::ARTIST_SORT_ORDER)
    }

    /// Removes all and returns the first artist sort order (`soar`).
    pub fn take_artist_sort_order(&mut self) -> Option<String> {
        self.take_strings_of(&ident::ARTIST_SORT_ORDER).next()
    }

    /// Sets all artist sort orders (`soar`). This will remove all other artist sort orders.
    pub fn set_artist_sort_orders(&mut self, artist_sort_orders: impl IntoIterator<Item = String>) {
        let data = artist_sort_orders.into_iter().map(Data::Utf8);
        self.set_all_data(ident::ARTIST_SORT_ORDER, data);
    }

    /// Sets the artist sort order (`soar`). This will remove all other artist sort orders.
    pub fn set_artist_sort_order(&mut self, artist_sort_order: impl Into<String>) {
        self.set_data(ident::ARTIST_SORT_ORDER, Data::Utf8(artist_sort_order.into()));
    }

    /// Adds all artist sort orders (`soar`).
    pub fn add_artist_sort_orders(&mut self, artist_sort_orders: impl IntoIterator<Item = String>) {
        let data = artist_sort_orders.into_iter().map(Data::Utf8);
        self.add_all_data(ident::ARTIST_SORT_ORDER, data);
    }

    /// Adds an artist sort order (`soar`).
    pub fn add_artist_sort_order(&mut self, artist_sort_order: impl Into<String>) {
        self.add_data(ident::ARTIST_SORT_ORDER, Data::Utf8(artist_sort_order.into()));
    }

    /// Removes all artist sort orders (`soar`).
    pub fn remove_artist_sort_orders(&mut self) {
        self.remove_data_of(&ident::ARTIST_SORT_ORDER);
    }

    /// Returns all artist sort orders formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_artist_sort_orders(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.artist_sort_orders().count() > 1 {
            writeln!(f, "artist sort orders:")?;
            for s in self.artist_sort_orders() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.artist_sort_order() {
            writeln!(f, "artist sort order: {}", s)?;
        }
        Ok(())
    }
}

/// ### Composer sort order
impl Userdata {
    /// Returns all composer sort orders (`soco`).
    pub fn composer_sort_orders(&self) -> impl Iterator<Item=&str> {
        self.strings_of(&ident::COMPOSER_SORT_ORDER)
    }

    /// Returns the first composer sort order (`soco`).
    pub fn composer_sort_order(&self) -> Option<&str> {
        self.strings_of(&ident::COMPOSER_SORT_ORDER).next()
    }

    /// Removes and returns all composer sort orders (`soco`).
    pub fn take_composer_sort_orders(&mut self) -> impl Iterator<Item=String> + '_ {
        self.take_strings_of(&ident::COMPOSER_SORT_ORDER)
    }

    /// Removes all and returns the first composer sort order (`soco`).
    pub fn take_composer_sort_order(&mut self) -> Option<String> {
        self.take_strings_of(&ident::COMPOSER_SORT_ORDER).next()
    }

    /// Sets all composer sort orders (`soco`). This will remove all other composer sort orders.
    pub fn set_composer_sort_orders(&mut self, composer_sort_orders: impl IntoIterator<Item = String>) {
        let data = composer_sort_orders.into_iter().map(Data::Utf8);
        self.set_all_data(ident::COMPOSER_SORT_ORDER, data);
    }

    /// Sets the composer sort order (`soco`). This will remove all other composer sort orders.
    pub fn set_composer_sort_order(&mut self, composer_sort_order: impl Into<String>) {
        self.set_data(ident::COMPOSER_SORT_ORDER, Data::Utf8(composer_sort_order.into()));
    }

    /// Adds all composer sort orders (`soco`).
    pub fn add_composer_sort_orders(&mut self, composer_sort_orders: impl IntoIterator<Item = String>) {
        let data = composer_sort_orders.into_iter().map(Data::Utf8);
        self.add_all_data(ident::COMPOSER_SORT_ORDER, data);
    }

    /// Adds an composer sort order (`soco`).
    pub fn add_composer_sort_order(&mut self, composer_sort_order: impl Into<String>) {
        self.add_data(ident::COMPOSER_SORT_ORDER, Data::Utf8(composer_sort_order.into()));
    }

    /// Removes all composer sort orders (`soco`).
    pub fn remove_composer_sort_orders(&mut self) {
        self.remove_data_of(&ident::COMPOSER_SORT_ORDER);
    }

    /// Returns all composer sort orders formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_composer_sort_orders(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        if self.composer_sort_orders().count() > 1 {
            writeln!(f, "composer sort orders:")?;
            for s in self.composer_sort_orders() {
                writeln!(f, "    {}", s)?;
            }
        } else if let Some(s) = self.composer_sort_order() {
            writeln!(f, "composer sort order: {}", s)?;
        }
        Ok(())
    }
}

/// ### Compilation
impl Userdata {
    /// Returns the compilation flag (`cpil`).
    pub fn compilation(&self) -> bool {
        let vec = match self.bytes_of(&ident::COMPILATION).next() {
            Some(v) => v,
            None => return false,
        };
        vec.first().map(|&v| v == 1).unwrap_or(false)
    }

    /// Sets the compilation flag to true (`cpil`).
    pub fn set_compilation(&mut self) {
        self.set_data(ident::COMPILATION, Data::BeSigned(vec![1]));
    }

    /// Removes the compilation flag (`cpil`).
    pub fn remove_compilation(&mut self) {
        self.remove_data_of(&ident::COMPILATION)
    }

    /// Returns the compilation formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_compilation(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.compilation() {
            true => writeln!(f, "compilation"),
            false => Ok(()),
        }
    }
}

/// ### Gapless playback
impl Userdata {
    /// Returns the gapless playback flag (`pgap`).
    pub fn gapless_playback(&self) -> bool {
        let vec = match self.bytes_of(&ident::GAPLESS_PLAYBACK).next() {
            Some(v) => v,
            None => return false,
        };
        vec.first().map(|&v| v == 1).unwrap_or(false)
    }

    /// Sets the gapless playback flag to true (`pgap`).
    pub fn set_gapless_playback(&mut self) {
        self.set_data(ident::GAPLESS_PLAYBACK, Data::BeSigned(vec![1]));
    }

    /// Removes the gapless playback flag (`pgap`).
    pub fn remove_gapless_playback(&mut self) {
        self.remove_data_of(&ident::GAPLESS_PLAYBACK)
    }

    /// Returns the gapless playback formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_gapless_playback(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.gapless_playback() {
            true => writeln!(f, "gapless playback"),
            false => Ok(()),
        }
    }
}

/// ### Show movement
impl Userdata {
    /// Returns the show movement flag (`shwm`).
    pub fn show_movement(&self) -> bool {
        let vec = match self.bytes_of(&ident::SHOW_MOVEMENT).next() {
            Some(v) => v,
            None => return false,
        };
        vec.first().map(|&v| v == 1).unwrap_or(false)
    }

    /// Sets the show movement flag to true (`shwm`).
    pub fn set_show_movement(&mut self) {
        self.set_data(ident::SHOW_MOVEMENT, Data::BeSigned(vec![1]));
    }

    /// Removes the show movement flag (`shwm`).
    pub fn remove_show_movement(&mut self) {
        self.remove_data_of(&ident::SHOW_MOVEMENT)
    }

    /// Returns the show movement formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_show_movement(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.show_movement() {
            true => writeln!(f, "show movement"),
            false => Ok(()),
        }
    }
}

/// ### Bpm
impl Userdata {
    /// Returns the bpm (`tmpo`)
    pub fn bpm(&self) -> Option<u16> {
        let vec = self.bytes_of(&ident::BPM).next()?;
        be_int!(vec, 0, u16)
    }

    /// Sets the bpm (`tmpo`)
    pub fn set_bpm(&mut self, bpm: u16) {
        let vec: Vec<u8> = bpm.to_be_bytes().to_vec();
        self.set_data(ident::BPM, Data::BeSigned(vec));
    }

    /// Removes the bpm (`tmpo`).
    pub fn remove_bpm(&mut self) {
        self.remove_data_of(&ident::BPM);
    }

    /// Returns the bpm formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_bpm(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.bpm() {
            Some(s) => writeln!(f, "bpm: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Movement count
impl Userdata {
    /// Returns the movement count (`©mvc`)
    pub fn movement_count(&self) -> Option<u16> {
        let vec = self.bytes_of(&ident::MOVEMENT_COUNT).next()?;
        be_int!(vec, 0, u16)
    }

    /// Sets the movement count (`©mvc`)
    pub fn set_movement_count(&mut self, movement_count: u16) {
        let vec: Vec<u8> = movement_count.to_be_bytes().to_vec();
        self.set_data(ident::MOVEMENT_COUNT, Data::BeSigned(vec));
    }

    /// Removes the movement count (`©mvc`).
    pub fn remove_movement_count(&mut self) {
        self.remove_data_of(&ident::MOVEMENT_COUNT);
    }

    /// Returns the movement count formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_movement_count(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.movement_count() {
            Some(s) => writeln!(f, "movement count: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Movement index
impl Userdata {
    /// Returns the movement index (`©mvi`)
    pub fn movement_index(&self) -> Option<u16> {
        let vec = self.bytes_of(&ident::MOVEMENT_INDEX).next()?;
        be_int!(vec, 0, u16)
    }

    /// Sets the movement index (`©mvi`)
    pub fn set_movement_index(&mut self, movement_index: u16) {
        let vec: Vec<u8> = movement_index.to_be_bytes().to_vec();
        self.set_data(ident::MOVEMENT_INDEX, Data::BeSigned(vec));
    }

    /// Removes the movement index (`©mvi`).
    pub fn remove_movement_index(&mut self) {
        self.remove_data_of(&ident::MOVEMENT_INDEX);
    }

    /// Returns the movement index formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_movement_index(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.movement_index() {
            Some(s) => writeln!(f, "movement index: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Tv episode
impl Userdata {
    /// Returns the tv episode (`tves`)
    pub fn tv_episode(&self) -> Option<u32> {
        let vec = self.bytes_of(&ident::TV_EPISODE).next()?;
        be_int!(vec, 0, u32)
    }

    /// Sets the tv episode (`tves`)
    pub fn set_tv_episode(&mut self, tv_episode: u32) {
        let vec: Vec<u8> = tv_episode.to_be_bytes().to_vec();
        self.set_data(ident::TV_EPISODE, Data::BeSigned(vec));
    }

    /// Removes the tv episode (`tves`).
    pub fn remove_tv_episode(&mut self) {
        self.remove_data_of(&ident::TV_EPISODE);
    }

    /// Returns the tv episode formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_tv_episode(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.tv_episode() {
            Some(s) => writeln!(f, "tv episode: {}", s),
            None => Ok(()),
        }
    }
}

/// ### Tv season
impl Userdata {
    /// Returns the tv season (`tvsn`)
    pub fn tv_season(&self) -> Option<u32> {
        let vec = self.bytes_of(&ident::TV_SEASON).next()?;
        be_int!(vec, 0, u32)
    }

    /// Sets the tv season (`tvsn`)
    pub fn set_tv_season(&mut self, tv_season: u32) {
        let vec: Vec<u8> = tv_season.to_be_bytes().to_vec();
        self.set_data(ident::TV_SEASON, Data::BeSigned(vec));
    }

    /// Removes the tv season (`tvsn`).
    pub fn remove_tv_season(&mut self) {
        self.remove_data_of(&ident::TV_SEASON);
    }

    /// Returns the tv season formatted in an easily readable way.
    #[allow(unused)]
    pub(crate) fn format_tv_season(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self.tv_season() {
            Some(s) => writeln!(f, "tv season: {}", s),
            None => Ok(()),
        }
    }
}