Skip to content

Instantly share code, notes, and snippets.

@mendelgusmao
Created November 16, 2012 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mendelgusmao/4091801 to your computer and use it in GitHub Desktop.
Save mendelgusmao/4091801 to your computer and use it in GitHub Desktop.
/^(?<collection_path>.*(?<collection_name>MP\d))\\(?<genre_name>.*)\\((?<artist_name>.*)(\s\((?<country_name>.{3})\))?)\\(?<album_year>\d{4})\s-\s(?<album_title>.*)\\/
// !OK
"D:\\MP3\\Genre\\Artist (Cty)\\2004 - Album Title\\01 - Song Title.mp3" => {
"collection_path"=>"D:\\MP3",
"collection_name"=>"MP3",
"genre_name"=>"Genre",
"artist_name"=>"Artist (Cty)",
"country_name"=>nil,
"album_year"=>"2004",
"album_title"=>"Album Title"
}
// OK
"D:\\MP3\\Genre\\Artist With No Country\\2004 - Album Title\\01 - Song Title.mp3" => {
"collection_path"=>"D:\\MP3",
"collection_name"=>"MP3",
"genre_name"=>"Genre",
"artist_name"=>"Artist With No Country",
"country_name"=>nil,
"album_year"=>"2004",
"album_title"=>"Album Title"
}
/^(?<collection_path>.*(?<collection_name>MP\d))\\(?<genre_name>.*)\\(((?<artist_name>.*)\s\((?<country_name>.{3})\))|(?<artist_name>.*))\\(?<album_year>\d{4})\s-\s(?<album_title>.*)\\/
// OK
"D:\\MP3\\Genre\\Artist (Cty)\\2004 - Album Title\\01 - Song Title.mp3" => {
"collection_path"=>"D:\\MP3",
"collection_name"=>"MP3",
"genre_name"=>"Genre",
"artist_name"=>"Artist",
"country_name"=>"Cty",
"album_year"=>nil,
"album_title"=>"2004"
}
// !OK
"D:\\MP3\\Genre\\Artist With No Country\\2004 - Album Title\\01 - Song Title.mp3" => {
"collection_path"=>"D:\\MP3",
"collection_name"=>"MP3",
"genre_name"=>"Genre",
"artist_name"=>nil,
"country_name"=>nil,
"album_year"=>"Artist With No Country",
"album_title"=>"2004"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment