Skip to content

Commit

Permalink
Force ID3v2.3 tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayurifag committed Jul 17, 2024
1 parent 4c0b401 commit 1294c23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/umom/processors/mp3_tags_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ func ProcessMP3FileTags(path string) error {
if isAlreadyProcessedMP3File(tag) {
return nil
}

tag.SetVersion(3) // ID3v2.3 - so tags will be readen everywhere fine

if err := normalizeTags(tag); err != nil {
return err
}
Expand All @@ -33,9 +36,9 @@ func ProcessMP3FileTags(path string) error {
}

const checkTag = "Copyright message"
const checkVersion = "0.0.1test"
const checkVersion = "0.0.2test"

// Checks if file has tag "Copyright message" with value "0.0.1test"
// Checks if file has tag "Copyright message" with value "0.0.2test"
// Didnt sure what to use, https://github.com/n10v/id3v2/blob/main/common_ids.go
// There is also UserDefinedTextFrame. TODO: research
func isAlreadyProcessedMP3File(tag *id3v2.Tag) bool {
Expand Down Expand Up @@ -91,7 +94,7 @@ func normalizeTextFrame(frameID string, textFrame id3v2.TextFrame) id3v2.TextFra
}
}

// Sets custom tag to indicate that the file has been processed (Copyright message: 0.0.1test)
// Sets custom tag to indicate that the file has been processed (Copyright message: 0.0.2test)
func setProcessedFlagTag(tag *id3v2.Tag) error {
textFrame := id3v2.TextFrame{
Encoding: id3v2.EncodingUTF16,
Expand Down
2 changes: 1 addition & 1 deletion src/umom/processors/mp3_tags_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestProcessMP3FileTags(t *testing.T) {
expectedFrames := map[string]string{
"TPE1": "Aphex Twin",
"TIT2": "Xtal",
"TCOP": "0.0.1test",
"TCOP": "0.0.2test",
}

allFrames := tag.AllFrames()
Expand Down

0 comments on commit 1294c23

Please sign in to comment.