packages feed

musicScroll 0.2.3.1 → 0.2.3.2

raw patch · 2 files changed

+10/−6 lines, 2 files

Files

musicScroll.cabal view
@@ -4,7 +4,7 @@ -- http://haskell.org/cabal/users-guide/  name:                musicScroll-version:             0.2.3.1+version:             0.2.3.2 synopsis:            Supply your tunes info without leaving your music player.  description:         Automatically retrive the lyrics of of your current                      song on SMPlayer/VLC and update it on each change. See the
src/MusicScroll/Providers/MusiXMatch.hs view
@@ -6,8 +6,9 @@ import Data.Text (Text, replace, toTitle) import Network.HTTP.Req import Text.HTML.TagSoup-import Text.HTML.TagSoup.Match (tagOpenAttrLit)+import Text.HTML.TagSoup.Match (tagOpenLit, anyAttr) import Data.Traversable (mapAccumL)+import qualified Data.Set as Set -- import Data.Text.IO as T (readFile)  import MusicScroll.TrackInfo (TrackInfo(..))@@ -40,12 +41,15 @@ pipeline = parseTags >>> mapAccumL discriminate False              >>> snd >>> catMaybes >>> innerText >>> Lyrics +-- discriminate :: Bool -> Tag Text -> (Bool, Maybe (Tag Text)) discriminate onSpan@True tag | isTagText tag = (onSpan, pure tag) discriminate onSpan tag-  | tagOpenAttrLit "span" spanDiscr tag = (True, Nothing)-  | isTagCloseName "span" tag           = (False, Nothing)-  | otherwise                           = (onSpan, Nothing)+  | tagOpenLit "span" goodClasses tag = (True, Nothing)+  | isTagCloseName "span" tag         = (False, Nothing)+  | otherwise                         = (onSpan, Nothing)   where-    spanDiscr = ("class", "lyrics__content__ok")+    goodClasses = anyAttr (\attr -> Set.member attr spanDiscr)+    spanDiscr = Set.fromList [ ("class", "lyrics__content__ok")+                             , ("class", "lyrics__content__warning") ]