 import LyricsProvider
 import MusicPlayer
 import GenericID
+import OpenCC
 
 class MenuBarLyrics: NSObject {
     

            lyricsItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
            lyricsItem?.highlightMode = false
        }
        lyricsItem?.title = displayLyrics
    }
    
    func updateCombinedStatusLyrics() {
        lyricsItem = nil
        
        setTextStatusItem(string: displayLyrics)
        if statusItem.isVisibe {
            return
        }
        
        // truncation
        var components = displayLyrics.components(options: [.byWords])
        while !components.isEmpty, !statusItem.isVisibe {
            components.removeLast()
            let proposed = components.joined() + "..."

        guard !defaults[.DisableLyricsWhenPaused] || AppController.shared.playerManager.player?.playbackState == .playing,
            let lyrics = AppController.shared.currentLyrics,
            let index = AppController.shared.currentLineIndex else {
            screenLyrics = ""
            updateStatusItem()
            return
        }
        var newScreenLyrics = lyrics.lines[index].content
        if let converter = ChineseConverter.shared {
            newScreenLyrics = converter.convert(newScreenLyrics)
        }
        if newScreenLyrics == screenLyrics {
            return
        }
        screenLyrics = newScreenLyrics
        updateStatusItem()
    }
    
    @objc func updateStatusItem() {
        guard defaults[.MenuBarLyricsEnabled], !screenLyrics.isEmpty else {
            setImageStatusItem()
            lyricsItem = nil
            return
