Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddddxxx committed Jul 10, 2021
2 parents 3117c1d + 3b19cef commit c774fde
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 85 deletions.
22 changes: 11 additions & 11 deletions LyricsX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
BB4141C01E45B67800A51775 /* KaraokeLyricsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4141BF1E45B67800A51775 /* KaraokeLyricsController.swift */; };
BB4141C81E46CDD700A51775 /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB4141C61E46CDD200A51775 /* SnapKit.framework */; };
BB4141C91E46CDD700A51775 /* SnapKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BB4141C61E46CDD200A51775 /* SnapKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BB458C63201C5F4500740C3B /* LyricsMetaData+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB458C62201C5F4500740C3B /* LyricsMetaData+Extension.swift */; };
BB458C63201C5F4500740C3B /* LyricsMetadata+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB458C62201C5F4500740C3B /* LyricsMetadata+Extension.swift */; };
BB4919361F00CD800054EA09 /* PreferenceShortcutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4919351F00CD800054EA09 /* PreferenceShortcutViewController.swift */; };
BB50786422014C3900B695C3 /* KaraokeLyricsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4141BF1E45B67800A51775 /* KaraokeLyricsController.swift */; };
BB50786522014C3900B695C3 /* Polyfill.swift in Sources */ = {isa = PBXBuildFile; fileRef = E97593E32150F47800D80616 /* Polyfill.swift */; };
Expand All @@ -62,7 +62,7 @@
BB50787022014C3900B695C3 /* TouchBarLyricsItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5863F221EFFD9F0084D2C0 /* TouchBarLyricsItem.swift */; };
BB50787222014C3900B695C3 /* CFExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1B2FFC20E8780A002F1AF8 /* CFExtension.swift */; };
BB50787322014C3900B695C3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4141AD1E458BA800A51775 /* AppDelegate.swift */; };
BB50787422014C3900B695C3 /* LyricsMetaData+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB458C62201C5F4500740C3B /* LyricsMetaData+Extension.swift */; };
BB50787422014C3900B695C3 /* LyricsMetadata+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB458C62201C5F4500740C3B /* LyricsMetadata+Extension.swift */; };
BB50787622014C3900B695C3 /* PreferenceGeneralViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC7C5541E6AE28600E3EC4F /* PreferenceGeneralViewController.swift */; };
BB50787722014C3900B695C3 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBE8FC741F6BEA6200122AFA /* Then.swift */; };
BB50787822014C3900B695C3 /* Updater.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB34F7E51F21911700B7C484 /* Updater.swift */; };
Expand Down Expand Up @@ -228,7 +228,7 @@
BB4141B61E458BA900A51775 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BB4141BF1E45B67800A51775 /* KaraokeLyricsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KaraokeLyricsController.swift; sourceTree = "<group>"; };
BB4141C61E46CDD200A51775 /* SnapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SnapKit.framework; path = Carthage/Build/Mac/SnapKit.framework; sourceTree = "<group>"; };
BB458C62201C5F4500740C3B /* LyricsMetaData+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LyricsMetaData+Extension.swift"; sourceTree = "<group>"; };
BB458C62201C5F4500740C3B /* LyricsMetadata+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LyricsMetadata+Extension.swift"; sourceTree = "<group>"; };
BB4919351F00CD800054EA09 /* PreferenceShortcutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferenceShortcutViewController.swift; sourceTree = "<group>"; };
BB5078AD22014C3900B695C3 /* LyricsX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LyricsX.app; sourceTree = BUILT_PRODUCTS_DIR; };
BB5863F221EFFD9F0084D2C0 /* TouchBarLyricsItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchBarLyricsItem.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -518,7 +518,7 @@
BB947DFA23B4C60000C43BF2 /* SelectedPlayer.swift */,
BB34F7E51F21911700B7C484 /* Updater.swift */,
BB03C8881FDF6FC000FBE0DA /* ChineseConverter+Singleton.swift */,
BB458C62201C5F4500740C3B /* LyricsMetaData+Extension.swift */,
BB458C62201C5F4500740C3B /* LyricsMetadata+Extension.swift */,
BB89089D21ED69410078F522 /* Lyrics+Language.swift */,
BB5863F221EFFD9F0084D2C0 /* TouchBarLyricsItem.swift */,
BB58640621F2B7500084D2C0 /* TouchBarArtworkViewController.swift */,
Expand Down Expand Up @@ -922,7 +922,7 @@
BB5863F321EFFD9F0084D2C0 /* TouchBarLyricsItem.swift in Sources */,
BB1B2FFD20E8780A002F1AF8 /* CFExtension.swift in Sources */,
BB4141AE1E458BA800A51775 /* AppDelegate.swift in Sources */,
BB458C63201C5F4500740C3B /* LyricsMetaData+Extension.swift in Sources */,
BB458C63201C5F4500740C3B /* LyricsMetadata+Extension.swift in Sources */,
BBC7C5551E6AE28600E3EC4F /* PreferenceGeneralViewController.swift in Sources */,
BBE8FC751F6BEA6200122AFA /* Then.swift in Sources */,
BB34F7E61F21911700B7C484 /* Updater.swift in Sources */,
Expand Down Expand Up @@ -967,7 +967,7 @@
BB50787022014C3900B695C3 /* TouchBarLyricsItem.swift in Sources */,
BB50787222014C3900B695C3 /* CFExtension.swift in Sources */,
BB50787322014C3900B695C3 /* AppDelegate.swift in Sources */,
BB50787422014C3900B695C3 /* LyricsMetaData+Extension.swift in Sources */,
BB50787422014C3900B695C3 /* LyricsMetadata+Extension.swift in Sources */,
BB50787622014C3900B695C3 /* PreferenceGeneralViewController.swift in Sources */,
BB50787722014C3900B695C3 /* Then.swift in Sources */,
BB50787822014C3900B695C3 /* Updater.swift in Sources */,
Expand Down Expand Up @@ -1432,7 +1432,7 @@
repositoryURL = "https://github.com/cx-org/CombineX";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.3.0;
minimumVersion = 0.4.0;
};
};
BB22681A234C9085008FAFED /* XCRemoteSwiftPackageReference "SwiftCF" */ = {
Expand All @@ -1448,7 +1448,7 @@
repositoryURL = "https://github.com/cx-org/CXExtensions";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.3.0;
minimumVersion = 0.4.0;
};
};
BB6C75E6248B908500804AEB /* XCRemoteSwiftPackageReference "TouchBarHelper" */ = {
Expand All @@ -1464,7 +1464,7 @@
repositoryURL = "https://github.com/ddddxxx/MusicPlayer";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.7.3;
minimumVersion = 0.8.2;
};
};
BBA82EF9256AB1490076831F /* XCRemoteSwiftPackageReference "appcenter-sdk-apple" */ = {
Expand All @@ -1488,7 +1488,7 @@
repositoryURL = "https://github.com/ddddxxx/GenericID";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.6.0;
minimumVersion = 0.7.0;
};
};
BBB03F2E232FB40400A3879E /* XCRemoteSwiftPackageReference "Semver" */ = {
Expand All @@ -1512,7 +1512,7 @@
repositoryURL = "https://github.com/ddddxxx/LyricsKit";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.10.0;
minimumVersion = 0.11.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,44 @@
"repositoryURL": "https://github.com/cx-org/CombineX",
"state": {
"branch": null,
"revision": "b9afefe14653f02a80a9f5aa546859e99073d0c8",
"version": "0.3.1"
"revision": "98096c6b2a51481cb6e4bae8da0a808d8cab09a1",
"version": "0.4.0"
}
},
{
"package": "CXExtensions",
"repositoryURL": "https://github.com/cx-org/CXExtensions",
"state": {
"branch": null,
"revision": "6843af94bfaedfe90df1435c1a6c83cc3366a62b",
"version": "0.3.0"
"revision": "4790ecd6a6c0e796d776a28a820b552f7e8f6abd",
"version": "0.4.0"
}
},
{
"package": "CXShim",
"repositoryURL": "https://github.com/cx-org/CXShim",
"state": {
"branch": null,
"revision": "82fecc246c7ca9f0ac1656b8199b7956e64d68f3",
"version": "0.4.0"
}
},
{
"package": "CXTest",
"repositoryURL": "https://github.com/cx-org/CXTest",
"state": {
"branch": null,
"revision": "929ce7cbd3005bc9356ae826bb65ee2611379b17",
"version": "0.4.0"
}
},
{
"package": "GenericID",
"repositoryURL": "https://github.com/ddddxxx/GenericID",
"state": {
"branch": null,
"revision": "31594c0f73306bb338316d7beec505e9b8b40dc1",
"version": "0.6.0"
"revision": "c6da97cd19899174cde6a14c7a46c794cd5d9cf8",
"version": "0.7.0"
}
},
{
Expand All @@ -51,17 +69,17 @@
"repositoryURL": "https://github.com/ddddxxx/LyricsKit",
"state": {
"branch": null,
"revision": "1f8a3b3f40ff8b040d18fc8b402561bb3effed6c",
"version": "0.10.0"
"revision": "5506ee497ca689ed1686655ebb11e8ee29cc24cb",
"version": "0.11.0"
}
},
{
"package": "MusicPlayer",
"repositoryURL": "https://github.com/ddddxxx/MusicPlayer",
"state": {
"branch": null,
"revision": "34d5e23c5e1b4932124c83dd58d2be590fcf2b9f",
"version": "0.7.3"
"revision": "50904bac7aec79c5842f2ec3d1a1d858496dd6fe",
"version": "0.8.2"
}
},
{
Expand All @@ -78,8 +96,8 @@
"repositoryURL": "https://github.com/ddddxxx/Regex",
"state": {
"branch": null,
"revision": "df530c4955725c04190a88e09b9756ae5b0b8e95",
"version": "1.0.0"
"revision": "c0ad0a7e9a48989d9688c2b524a1e69b6293b733",
"version": "1.0.1"
}
},
{
Expand All @@ -100,6 +118,15 @@
"version": "1.26.0"
}
},
{
"package": "swift-atomics",
"repositoryURL": "https://github.com/apple/swift-atomics.git",
"state": {
"branch": null,
"revision": "3e95ba32cd1b4c877f6163e8eea54afc4e63bf9f",
"version": "0.0.3"
}
},
{
"package": "SwiftCF",
"repositoryURL": "https://github.com/ddddxxx/SwiftCF",
Expand Down
11 changes: 4 additions & 7 deletions LyricsX/Component/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,7 @@ class AppController: NSObject {
}

let duration = track.duration ?? 0
let req = LyricsSearchRequest(searchTerm: .info(title: title, artist: artist),
title: title,
artist: artist,
duration: duration,
limit: 5,
timeout: 10)
let req = LyricsSearchRequest(searchTerm: .info(title: title, artist: artist), duration: duration, limit: 5)
searchRequest = req
searchCanceller = lyricsManager.lyricsPublisher(request: req)
.timeout(.seconds(10), scheduler: DispatchQueue.lyricsDisplay.cx)
Expand All @@ -223,7 +218,8 @@ class AppController: NSObject {

func lyricsReceived(lyrics: Lyrics) {
guard let req = searchRequest,
lyrics.metadata.request == req else {
lyrics.metadata.request == req,
let track = selectedPlayer.currentTrack else {
return
}
if defaults[.strictSearchEnabled] && !lyrics.isMatched() {
Expand All @@ -232,6 +228,7 @@ class AppController: NSObject {
if let current = currentLyrics, current.quality >= lyrics.quality {
return
}
lyrics.associateWithTrack(track)
lyrics.filtrate()
lyrics.recognizeLanguage()
lyrics.metadata.needsPersist = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// LyricsMetaData+Extension.swift
// LyricsMetadata+Extension.swift
// LyricsX - https://github.com/ddddxxx/LyricsX
//
// This Source Code Form is subject to the terms of the Mozilla Public
Expand All @@ -10,28 +10,28 @@
import Foundation
import LyricsCore

extension Lyrics.MetaData.Key {
static var localURL = Lyrics.MetaData.Key("localURL")
static var title = Lyrics.MetaData.Key("title")
static var artist = Lyrics.MetaData.Key("artist")
static var needsPersist = Lyrics.MetaData.Key("needsPersist")
static var language = Lyrics.MetaData.Key("language")
extension Lyrics.Metadata.Key {
static var localURL = Lyrics.Metadata.Key("localURL")
static var title = Lyrics.Metadata.Key("title")
static var artist = Lyrics.Metadata.Key("artist")
static var needsPersist = Lyrics.Metadata.Key("needsPersist")
static var language = Lyrics.Metadata.Key("language")
}

extension Lyrics.MetaData {
extension Lyrics.Metadata {

var localURL: URL? {
get { return data[.localURL] as? URL }
set { data[.localURL] = newValue }
}

var title: String? {
get { return request?.title ?? data[.title] as? String }
get { return data[.title] as? String }
set { data[.title] = newValue }
}

var artist: String? {
get { return request?.artist ?? data[.artist] as? String }
get { return data[.artist] as? String }
set { data[.artist] = newValue }
}

Expand Down
2 changes: 1 addition & 1 deletion LyricsX/Component/TouchBarLyricsItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TouchBarLyricsItem: NSCustomTouchBarItem {
if let timetag = line.attachments.timetag {
let position = selectedPlayer.playbackTime
let timeDelay = line.lyrics?.adjustedTimeDelay ?? 0
let progress = timetag.tags.map { ($0.timeTag + line.position - timeDelay - position, $0.index) }
let progress = timetag.tags.map { ($0.time + line.position - timeDelay - position, $0.index) }
self.lyricsTextField.setProgressAnimation(color: self.progressColor, progress: progress)
}
}
Expand Down
2 changes: 1 addition & 1 deletion LyricsX/Controller/KaraokeLyricsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class KaraokeLyricsWindowController: NSWindowController {
let timetag = lrc.attachments.timetag {
let position = selectedPlayer.playbackTime
let timeDelay = AppController.shared.currentLyrics?.adjustedTimeDelay ?? 0
let progress = timetag.tags.map { ($0.timeTag + lrc.position - timeDelay - position, $0.index) }
let progress = timetag.tags.map { ($0.time + lrc.position - timeDelay - position, $0.index) }
upperTextField.setProgressAnimation(color: self.lyricsView.progressColor, progress: progress)
if !selectedPlayer.playbackState.isPlaying {
upperTextField.pauseProgressAnimation()
Expand Down
25 changes: 10 additions & 15 deletions LyricsX/Controller/SearchLyricsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,7 @@ class SearchLyricsViewController: NSViewController, NSTableViewDelegate, NSTable

let track = selectedPlayer.currentTrack
let duration = track?.duration ?? 0
let title = track?.title ?? ""
let artist = track?.artist ?? ""
let req = LyricsSearchRequest(searchTerm: .info(title: searchTitle, artist: searchArtist),
title: title,
artist: artist,
duration: duration,
limit: 8,
timeout: 10)
let req = LyricsSearchRequest(searchTerm: .info(title: searchTitle, artist: searchArtist), duration: duration, limit: 8)
searchRequest = req
searchCanceller = lyricsManager.lyricsPublisher(request: req)
.sink(receiveCompletion: { [unowned self] _ in
Expand All @@ -105,16 +98,18 @@ class SearchLyricsViewController: NSViewController, NSTableViewDelegate, NSTable
return
}

if let track = selectedPlayer.currentTrack {
if let index = defaults[.noSearchingTrackIds].firstIndex(of: track.id) {
defaults[.noSearchingTrackIds].remove(at: index)
}
if let index = defaults[.noSearchingAlbumNames].firstIndex(of: track.album ?? "") {
defaults[.noSearchingAlbumNames].remove(at: index)
}
guard let track = selectedPlayer.currentTrack else {
return
}
if let index = defaults[.noSearchingTrackIds].firstIndex(of: track.id) {
defaults[.noSearchingTrackIds].remove(at: index)
}
if let index = defaults[.noSearchingAlbumNames].firstIndex(of: track.album ?? "") {
defaults[.noSearchingAlbumNames].remove(at: index)
}

let lrc = searchResult[index]
lrc.associateWithTrack(track)
AppController.shared.currentLyrics = lrc
if defaults[.writeToiTunesAutomatically] {
AppController.shared.writeToiTunes(overwrite: true)
Expand Down
6 changes: 3 additions & 3 deletions LyricsX/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.6.1</string>
<string>1.6.2-beta.1</string>
<key>CFBundleVersion</key>
<string>2344</string>
<string>2347</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand All @@ -58,7 +58,7 @@
<key>LSUIElement</key>
<true/>
<key>LX_BUILD_TIME</key>
<integer>1622460550</integer>
<integer>1625917652</integer>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
Expand Down
2 changes: 1 addition & 1 deletion LyricsX/Supporting Files/fa.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"Search Lyrics" = "جستجو ترانه";

/* No comment provided by engineer. */
"Touch Bar lyrics is not supported in Mac App Store Version. Please download on GitHub." = "نمایش متن ترانه در تاچ بار در نسخه دانلود از استور پشتیبانی نمی شود. لطفا از نسخه موجود در گیت هاب استفاده کنید.";
"Touch Bar lyrics is not supported in Mac App Store Version. Please download on GitHub." = "نمایش متن ترانه در تاچ بار در نسخه دانلود شده از فروشگاه اپل پشتیبانی نمی شود. لطفا از نسخه موجود در گیتهاب استفاده کنید.";

/* alert title */
"Unable to enable Touch Bar lyrics." = "نمایش متن ترانه در تاچ بار فعال نشد.";
7 changes: 0 additions & 7 deletions LyricsX/Utility/CombineExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@

import CXShim

extension Publisher {

func signal() -> Publishers.Map<Self, Void> {
return self.map { _ in Void() }
}
}

extension Publisher where Output == Void {

func prepend() -> Publishers.Concatenate<Publishers.Sequence<[Void], Failure>, Self> {
Expand Down
Loading

0 comments on commit c774fde

Please sign in to comment.