mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
32 lines
567 B
Swift
32 lines
567 B
Swift
//
|
|
// MPDClientSong.swift
|
|
// Persephone
|
|
//
|
|
// Created by Daniel Barber on 2019/2/03.
|
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import mpdclient
|
|
|
|
extension MPDClient {
|
|
class Song {
|
|
let mpdSong: OpaquePointer
|
|
|
|
init(_ mpdSong: OpaquePointer) {
|
|
self.mpdSong = mpdSong
|
|
}
|
|
|
|
deinit {
|
|
mpd_song_free(mpdSong)
|
|
}
|
|
|
|
func getTag(_ tagType: mpd_tag_type) -> String {
|
|
guard let tag = mpd_song_get_tag(mpdSong, tagType, 0)
|
|
else { return "" }
|
|
|
|
return String(cString: tag)
|
|
}
|
|
}
|
|
}
|