You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
420 B
20 lines
420 B
{-# LANGUAGE OverloadedStrings #-}
|
|
module Utils where
|
|
|
|
import Types
|
|
import qualified Data.Text as TIO
|
|
import Data.Text.Encoding
|
|
import Data.Maybe
|
|
import Control.Applicative
|
|
import Data.Attoparsec.Text
|
|
|
|
isSep = string "by" <|>
|
|
string " - " <|>
|
|
string "- "
|
|
|
|
isTrack = do
|
|
artist <- manyTill anyChar isSep
|
|
title <- many1 anyChar
|
|
return (TIO.pack artist, TIO.pack title)
|
|
|
|
parseTrack = parseOnly isTrack
|
|
|