Skip to content

Commit

Permalink
ITunes genre mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wald Schlafer authored and Wald Schlafer committed Jan 11, 2019
1 parent a54bb7c commit 72d9c19
Show file tree
Hide file tree
Showing 13 changed files with 1,245 additions and 776 deletions.
4 changes: 4 additions & 0 deletions Aural.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@
3ED1008D1FBAD54600D48688 /* HistoryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED1008C1FBAD54600D48688 /* HistoryProtocol.swift */; };
3ED4257821E7EB4B00E202AB /* JSONWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED4257721E7EB4B00E202AB /* JSONWriter.swift */; };
3ED4257A21E803E000E202AB /* HTMLWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED4257921E803E000E202AB /* HTMLWriter.swift */; };
3ED4257C21E8414000E202AB /* ITunesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED4257B21E8414000E202AB /* ITunesSpec.swift */; };
3ED43339216CA387000617A3 /* PlaybackGap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED43338216CA387000617A3 /* PlaybackGap.swift */; };
3ED5264F1F2FA27200001A97 /* ChangeListenerProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED5264E1F2FA27200001A97 /* ChangeListenerProtocols.swift */; };
3ED526511F3003A800001A97 /* ObjectGraph.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED526501F3003A800001A97 /* ObjectGraph.swift */; };
Expand Down Expand Up @@ -731,6 +732,7 @@
3ED1008C1FBAD54600D48688 /* HistoryProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoryProtocol.swift; sourceTree = "<group>"; };
3ED4257721E7EB4B00E202AB /* JSONWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONWriter.swift; sourceTree = "<group>"; };
3ED4257921E803E000E202AB /* HTMLWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLWriter.swift; sourceTree = "<group>"; };
3ED4257B21E8414000E202AB /* ITunesSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ITunesSpec.swift; sourceTree = "<group>"; };
3ED43338216CA387000617A3 /* PlaybackGap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaybackGap.swift; sourceTree = "<group>"; };
3ED5264E1F2FA27200001A97 /* ChangeListenerProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangeListenerProtocols.swift; sourceTree = "<group>"; };
3ED526501F3003A800001A97 /* ObjectGraph.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectGraph.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1782,6 +1784,7 @@
3E688AC421E462C400164E84 /* CommonAVAssetParser.swift */,
3ED0C40021E73E21002757A7 /* ID3Spec.swift */,
3ECD17431F6BBEE400492F56 /* ID3Parser.swift */,
3ED4257B21E8414000E202AB /* ITunesSpec.swift */,
3ECD17461F6BBF3600492F56 /* ITunesParser.swift */,
3E17D02F21E5AC3800951F81 /* CommonFFMpegMetadataParser.swift */,
3E688ABE21E3842800164E84 /* WMParser.swift */,
Expand Down Expand Up @@ -2325,6 +2328,7 @@
3E09C6BB1F2F388B007BB489 /* PlaybackSequence.swift in Sources */,
3EF1847C217C8F6C00D24F39 /* Spectrogram.swift in Sources */,
3ED1008D1FBAD54600D48688 /* HistoryProtocol.swift in Sources */,
3ED4257C21E8414000E202AB /* ITunesSpec.swift in Sources */,
3EB9304B21996376008E45F8 /* FilterBandViewController.swift in Sources */,
3E3A636B1F690EBB00F72A60 /* PreferencesDelegateProtocol.swift in Sources */,
3E3A63691F690EA200F72A60 /* PreferencesDelegate.swift in Sources */,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,38 @@
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Aural/ITunesParser.swift"
timestampString = "568892779.326085"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "142"
endingLineNumber = "142"
landmarkName = "parseID3GenreNumericString(_:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Aural/GenreMap.swift"
timestampString = "568892779.326364"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "10"
endingLineNumber = "10"
landmarkName = "forITunesCode(_:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
4 changes: 2 additions & 2 deletions Aural/AVAssetReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ extension AVMetadataItem {
var keyAsString: String? {

if let key = self.key as? String {
return key.replacingOccurrences(of: "\0", with: "")
return StringUtils.cleanUpString(key).trim()
}

if let id = self.identifier {

let tokens = id.rawValue.split(separator: "/")
if tokens.count == 2 {
return String(tokens[1].trim().replacingOccurrences(of: "%A9", with: "@"))
return StringUtils.cleanUpString(String(tokens[1].trim().replacingOccurrences(of: "%A9", with: "@"))).trim()
}
}

Expand Down
2 changes: 1 addition & 1 deletion Aural/ApeV2Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ApeV2Parser: FFMpegMetadataParser {
if let genreCode = Int(numberStr) {

// Look up genreId in ID3 table
return GenreMap.forId(genreCode) ?? string
return GenreMap.forID3Code(genreCode) ?? string
}
}

Expand Down
Loading

0 comments on commit 72d9c19

Please sign in to comment.