https://github.com/tfmart/tagcleaner
Swift package for cleaning music metadata tags. Removes extraneous information from titles, albums, and artist fields.
https://github.com/tfmart/tagcleaner
apple ios ipados macos music property-wrapper regex-builder swift tagging tvos watchos
Last synced: 5 months ago
JSON representation
Swift package for cleaning music metadata tags. Removes extraneous information from titles, albums, and artist fields.
- Host: GitHub
- URL: https://github.com/tfmart/tagcleaner
- Owner: tfmart
- License: mit
- Created: 2024-07-29T04:55:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-05T15:52:48.000Z (almost 2 years ago)
- Last Synced: 2025-10-30T22:54:27.676Z (8 months ago)
- Topics: apple, ios, ipados, macos, music, property-wrapper, regex-builder, swift, tagging, tvos, watchos
- Language: Swift
- Homepage:
- Size: 65.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TagCleaner
TagCleaner is a Swift package that provides a robust solution for cleaning and standardizing music metadata tags. It offers a set of filters to remove common extraneous information from song titles, album names, and other music-related text.
## Features
- Multiple built-in filters for common tag cleaning tasks
- Customizable filter application
- Easy to use API
- Support for iOS, macOS, watchOS, and tvOS
## Inspiration
TagCleaner is inspired by and based on the work of [Web Scrobbler's metadata-filter](https://github.com/web-scrobbler/metadata-filter). It's essentially a Swift port of this JavaScript library, adapted for use in Apple's ecosystem.
## How It Works
TagCleaner uses a combination of RegexBuilder patterns and Swift's string manipulation capabilities to clean music metadata. It includes filters for:
- Explicit/Clean labels
- Featured artists
- Remastered versions
- Reissues
- Remixes
- Singles and EPs
- Bonus tracks
- Live recordings
- Parodies
- Version information
- YouTube-specific tags
- And more!
## Installation
### Swift Package Manager
1. In Xcode, select "File" → "Swift Packages" → "Add Package Dependency"
2. Enter the repository URL: `https://github.com/yourusername/TagCleaner.git`
3. Select the version you want to use
Alternatively, you can add it to your `Package.swift` file:
```swift
dependencies: [
.package(url: "https://github.com/yourusername/TagCleaner.git", from: "1.0.0")
]
```
## Usage
Here's a basic example of how to use TagCleaner:
```swift
import TagCleaner
let cleaner = TagCleaner()
let cleanedTitle = cleaner.apply("Song Title (Remastered 2021) [feat. Another Artist]", filter: FilterDirectory.releaseInformation)
print(cleanedTitle) // Outputs: "Song Title"
```
You can also use the `@TCFilteredString` property wrapper for automatic cleaning:
```swift
struct Song {
@TCFilteredString(filters:
FilterDirectory.releaseInformation.remaster,
FilterDirectory.artistInformation.featuredArtists
)
var title: String = ""
}
let song = Song(title: "Song Title (Remastered 2021) [feat. Another Artist]")
print(song.title) // Outputs: "Song Title"
```
## System Requirements
- iOS 16.0+
- macOS 13.0+
- watchOS 9.0+
- tvOS 16.0+
- Swift 5.7+
## License
TagCleaner is released under the MIT License. See the LICENSE file for details.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.