Skip to content

Commit

Permalink
README added
Browse files Browse the repository at this point in the history
  • Loading branch information
philiphardy committed Jan 12, 2016
1 parent b0c5e19 commit 3453355
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 126 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
.DS_Store
ID3Edit.xcodeproj/project.xcworkspace/xcuserdata/Phil.xcuserdatad/UserInterfaceState.xcuserstate
ID3Edit.xcodeproj/xcuserdata/**
xcuserdata/

This file was deleted.

This file was deleted.

This file was deleted.

59 changes: 59 additions & 0 deletions README.md
@@ -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?

0 comments on commit 3453355

Please sign in to comment.