Skip to content

Commit

Permalink
search lyrics for track without album or artist, resolve #49
Browse files Browse the repository at this point in the history
  • Loading branch information
ddddxxx committed Jun 9, 2017
1 parent fd882d4 commit 6b3c9ce
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
3 changes: 2 additions & 1 deletion LyricsX/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class AppController: NSObject, MusicPlayerDelegate, LyricsConsuming {
return
}
let title = track.name
let artist = track.artist
// FIXME: deal with optional value
let artist = track.artist ?? ""

guard !WrongLyricsUtil.shared.isNoMatching(title: title, artist: artist) else {
return
Expand Down
4 changes: 2 additions & 2 deletions LyricsX/MediaPlayer/MusicPlayerProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ enum MusicPlayerState {
struct MusicTrack {
var id: String
var name: String
var album: String
var artist: String
var album: String?
var artist: String?
var duration: TimeInterval?
}

Expand Down
6 changes: 2 additions & 4 deletions LyricsX/MediaPlayer/Spotify.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ extension SpotifyEPlS {
extension SpotifyTrack {
var track: MusicTrack? {
guard let id = id?() as? String,
let name = name as? String,
let album = album as? String,
let artist = artist as? String else {
let name = name as? String else {
return nil
}

return MusicTrack(id: id, name: name, album: album, artist: artist, duration: duration.map({TimeInterval($0)}))
return MusicTrack(id: id, name: name, album: album as? String, artist: artist as? String, duration: duration.map({TimeInterval($0)}))
}
}
6 changes: 2 additions & 4 deletions LyricsX/MediaPlayer/Vox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ extension VoxApplication {
}
var track: MusicTrack? {
guard let id = uniqueID as? String,
let name = track as? String,
let album = album as? String,
let artist = artist as? String else {
let name = track as? String else {
return nil
}
return MusicTrack(id: id, name: name, album: album, artist: artist, duration: totalTime as TimeInterval?)
return MusicTrack(id: id, name: name, album: album as? String, artist: artist as? String, duration: totalTime as TimeInterval?)
}
}
6 changes: 2 additions & 4 deletions LyricsX/MediaPlayer/iTunes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,10 @@ extension iTunesTrack {

var track: MusicTrack? {
guard let id = stringID,
let name = name as? String,
let album = album as? String,
let artist = artist as? String else {
let name = name as? String else {
return nil
}

return MusicTrack(id: id, name: name, album: album, artist: artist, duration: duration as TimeInterval?)
return MusicTrack(id: id, name: name, album: album as? String, artist: artist as? String, duration: duration as TimeInterval?)
}
}
2 changes: 1 addition & 1 deletion LyricsX/Support Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.1.3</string>
<key>CFBundleVersion</key>
<string>1150</string>
<string>1151</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand Down

0 comments on commit 6b3c9ce

Please sign in to comment.