Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0c5e19
commit 3453355
Showing
5 changed files
with
61 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.DS_Store | ||
ID3Edit.xcodeproj/project.xcworkspace/xcuserdata/Phil.xcuserdatad/UserInterfaceState.xcuserstate | ||
ID3Edit.xcodeproj/xcuserdata/** | ||
xcuserdata/ |
23 changes: 0 additions & 23 deletions
23
ID3Edit.xcodeproj/xcuserdata/Phil.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file was deleted.
Oops, something went wrong.
80 changes: 0 additions & 80 deletions
80
ID3Edit.xcodeproj/xcuserdata/Phil.xcuserdatad/xcschemes/ID3Edit.xcscheme
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
ID3Edit.xcodeproj/xcuserdata/Phil.xcuserdatad/xcschemes/xcschememanagement.plist
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# ID3Edit | ||
### Author: Philip Hardy | ||
|
||
## Description: | ||
An easy to use Swift framework that edits and retrieves ID3 tag information. | ||
|
||
## Instructions: | ||
Drag the framework into your Swift project. Make sure to add to your project's | ||
embedded binaries by going to Project Settings > General > Embedded Binaries | ||
|
||
At the top of your Swift code: | ||
```swift | ||
import ID3Edit | ||
``` | ||
|
||
To open a mp3 file for writing the tag do this in your code: | ||
```swift | ||
do | ||
{ | ||
// Open the file | ||
let mp3File = try MP3File(path: "/Users/Example/Music/example.mp3") | ||
|
||
// Get song information | ||
print("Title:\t\(mp3File.getTitle())") | ||
print("Artist:\t\(mp3File.getArtist())") | ||
print("Album:\t\(mp3File.getAlbum())") | ||
print("Lyrics:\n\(mp3File.getLyrics())") | ||
|
||
let artwork = mp3File.getArtwork() | ||
|
||
// Write song information | ||
mp3File.setTitle("The new song title") | ||
mp3File.setArtist("The new artist") | ||
mp3File.setAlbum("The new album") | ||
mp3File.setLyrics("Yeah Yeah new lyrics") | ||
|
||
if let newArt = NSImage(contentsOfFile: "/Users/Example/Pictures/example.png") | ||
{ | ||
mp3File.setArtwork(newArt, isPNG: true) | ||
} | ||
else | ||
{ | ||
print("The artwork referenced does not exist.") | ||
} | ||
|
||
// Save the information to the mp3 file | ||
mp3File.writeTag() | ||
} | ||
catch ID3EditErrors.FileDoesNotExist | ||
{ | ||
print("The file does not exist.") | ||
} | ||
catch ID3EditErrors.NotAnMP3 | ||
{ | ||
print("The file you attempted to open was not an mp3 file.") | ||
} | ||
catch {} | ||
``` | ||
...that's it! Not too hard, right? |