Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 8350f9edf6249fb2f4308d005b40328f04ff2503 @blakesmith committed Oct 26, 2010
Showing with 275 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 lib/rubycue.rb
  3. +20 −0 lib/rubycue/cuesheet.rb
  4. +215 −0 spec/fixtures/test.cue
  5. +8 −0 spec/spec_helper.rb
  6. +28 −0 spec/unit/cuesheet_spec.rb
@@ -0,0 +1 @@
+*.swp
@@ -0,0 +1,3 @@
+$:.unshift File.join(File.dirname(__FILE__), "rubycue")
+
+require 'cuesheet'
@@ -0,0 +1,20 @@
+module RubyCue
+ class Cuesheet
+ attr_reader :cuesheet, :tracks
+
+ def initialize(cuesheet)
+ @cuesheet = cuesheet
+ @reg = {
+ :track => %r(TRACK (\d{1,3}) AUDIO),
+ :performer => %r(PERFORMER "(.*)"),
+ :title => %r(TITLE "(.*)"),
+ :index => %r(INDEX \d{1,3} (\d{1,3}):(\d{1,2}):(\d{1,2}))
+ }
+ end
+
+ def parse!
+ @tracks = @cuesheet.scan(@reg[:title]).map{|title| {:title => title.first}}
+ @tracks.delete_at(0)
+ end
+ end
+end
@@ -0,0 +1,215 @@
+PERFORMER "Netsky"
+TITLE "Essential Mix (2010-10-09)"
+FILE "2010-10-09 - Essential Mix - Netsky.mp3" MP3
+ TRACK 01 AUDIO
+ PERFORMER "Essential Mix"
+ TITLE "Intro"
+ INDEX 01 00:00:00
+ TRACK 02 AUDIO
+ PERFORMER "Shameboy vs. Friction, Camo & Krooked feat. Dynamite MC"
+ TITLE "Strobot (Netsky Remix) vs. Stand Up"
+ INDEX 01 01:50:07
+ TRACK 03 AUDIO
+ PERFORMER "Danny Byrd feat. I-Kay"
+ TITLE "Ill Behaviour"
+ INDEX 01 05:26:67
+ TRACK 04 AUDIO
+ PERFORMER "Die & Interface feat. William Cartwright"
+ TITLE "Bright Lights (Netsky Remix)"
+ INDEX 01 07:16:59
+ TRACK 05 AUDIO
+ PERFORMER "Nu:Tone feat. Natalie Williams"
+ TITLE "Shine In"
+ INDEX 01 10:33:72
+ TRACK 06 AUDIO
+ PERFORMER "Netsky"
+ TITLE "Porcelain VIP vs. I Refuse (Acapella)"
+ INDEX 01 12:56:64
+ TRACK 07 AUDIO
+ PERFORMER "Netsky"
+ TITLE "Do It Do It vs. I Refuse (Acapella)"
+ INDEX 01 15:52:31
+ TRACK 08 AUDIO
+ PERFORMER "Brookes Brothers"
+ TITLE "Beautiful"
+ INDEX 01 17:31:10
+ TRACK 09 AUDIO
+ PERFORMER "Muffler"
+ TITLE "Uplifter"
+ INDEX 01 20:26:47
+ TRACK 10 AUDIO
+ PERFORMER "Indivision & Livewire feat. Nelver"
+ TITLE "Irresistible"
+ INDEX 01 22:15:03
+ TRACK 11 AUDIO
+ PERFORMER "Bcee & S.P.Y."
+ TITLE "Is There Anybody Out There?"
+ INDEX 01 23:44:12
+ TRACK 12 AUDIO
+ PERFORMER "Nu:Logic vs. Brooklyn"
+ TITLE "Bleeper vs. With All My Heart"
+ INDEX 01 25:33:68
+ TRACK 13 AUDIO
+ PERFORMER "Chords"
+ TITLE "Radio"
+ INDEX 01 27:23:42
+ TRACK 14 AUDIO
+ PERFORMER "Danny Byrd feat. Netsky"
+ TITLE "Tonight"
+ INDEX 01 29:46:15
+ TRACK 15 AUDIO
+ PERFORMER "Leftfield"
+ TITLE "Release The Pressure (Netsky Remix)"
+ INDEX 01 31:24:68
+ TRACK 16 AUDIO
+ PERFORMER "Danny Byrd feat. London Elektricity"
+ TITLE "Failsafe"
+ INDEX 01 35:04:31
+ TRACK 17 AUDIO
+ PERFORMER "Netsky"
+ TITLE "Everyday"
+ INDEX 01 37:16:06
+ TRACK 18 AUDIO
+ PERFORMER "Zero 7"
+ TITLE "In The Waiting Line (D+B Remix)"
+ INDEX 01 38:21:66
+ TRACK 19 AUDIO
+ PERFORMER "Legion feat. Adam Wright"
+ TITLE "Both Sides"
+ INDEX 01 39:27:57
+ TRACK 20 AUDIO
+ PERFORMER "New Zealand Shapeshifter"
+ TITLE "The Touch (Netsky Remix)"
+ INDEX 01 44:12:70
+ TRACK 21 AUDIO
+ PERFORMER "Swedish House Mafia"
+ TITLE "One (Netsky Remix)"
+ INDEX 01 46:23:20
+ TRACK 22 AUDIO
+ PERFORMER "Netsky"
+ TITLE "Pirate Bay VIP"
+ INDEX 01 48:36:23
+ TRACK 23 AUDIO
+ PERFORMER "Danny Byrd feat. Cyantific"
+ TITLE "Judgement Day VIP"
+ INDEX 01 51:09:68
+ TRACK 24 AUDIO
+ PERFORMER "Netsky vs. Sidney Samson"
+ TITLE "Tomorrow's Another Dub VIP vs. Riverside (Breakage Remix)"
+ INDEX 01 53:21:46
+ TRACK 25 AUDIO
+ PERFORMER "The Bloody Beetroots feat. Steve Aoki"
+ TITLE "Warp (Dirtyphonics Remix)"
+ INDEX 01 55:37:44
+ TRACK 26 AUDIO
+ PERFORMER "Danny Byrd vs. Burial"
+ TITLE "We Can Have It All vs. Archangel (Edit)"
+ INDEX 01 56:05:01
+ TRACK 27 AUDIO
+ PERFORMER "DJ Fresh & Sigma vs. Netsky"
+ TITLE "Lassitude VIP vs. Escape"
+ INDEX 01 59:03:20
+ TRACK 28 AUDIO
+ PERFORMER "Commix"
+ TITLE "Painted Smile"
+ INDEX 01 63:04:52
+ TRACK 29 AUDIO
+ PERFORMER "Eastcolors"
+ TITLE "Go To Nowhere"
+ INDEX 01 66:00:20
+ TRACK 30 AUDIO
+ PERFORMER "Nu:Logic"
+ TITLE "Bigfoot"
+ INDEX 01 67:49:73
+ TRACK 31 AUDIO
+ PERFORMER "Random Movement"
+ TITLE "Can't Resist (S.P.Y. Remix)"
+ INDEX 01 69:17:50
+ TRACK 32 AUDIO
+ PERFORMER "Netsky"
+ TITLE "Iron Heart"
+ INDEX 01 71:07:31
+ TRACK 33 AUDIO
+ PERFORMER "Unicorn Kid vs. DJ Fresh & Sigma"
+ TITLE "Wild Life (Nu:Tone Remix) vs. Cylon"
+ INDEX 01 74:02:69
+ TRACK 34 AUDIO
+ PERFORMER "Agent Alvin"
+ TITLE "Move"
+ INDEX 01 76:35:15
+ TRACK 35 AUDIO
+ PERFORMER "S.P.Y."
+ TITLE "Go With The Flow"
+ INDEX 01 78:01:51
+ TRACK 36 AUDIO
+ PERFORMER "Metrik"
+ TITLE "T 1000"
+ INDEX 01 79:37:45
+ TRACK 37 AUDIO
+ PERFORMER "Culture Shock"
+ TITLE "Cathedral"
+ INDEX 01 81:21:27
+ TRACK 38 AUDIO
+ PERFORMER "Blokhe4d"
+ TITLE "The Way Life Used To Be"
+ INDEX 01 83:33:35
+ TRACK 39 AUDIO
+ PERFORMER "Hamilton"
+ TITLE "Soundboy"
+ INDEX 01 85:45:13
+ TRACK 40 AUDIO
+ PERFORMER "Squash"
+ TITLE "Divine"
+ INDEX 01 87:34:63
+ TRACK 41 AUDIO
+ PERFORMER "Above & Beyond & Gareth Emery"
+ TITLE "On A Good Day (J Majik & Wickaman Remix)"
+ INDEX 01 89:24:45
+ TRACK 42 AUDIO
+ PERFORMER "Metrik"
+ TITLE "Arrival (Instrumental)"
+ INDEX 01 91:36:16
+ TRACK 43 AUDIO
+ PERFORMER "Spy"
+ TITLE "By Your Side (Logistics Remix)"
+ INDEX 01 94:09:53
+ TRACK 44 AUDIO
+ PERFORMER "Netsky"
+ TITLE "Come Back Home"
+ INDEX 01 97:05:34
+ TRACK 45 AUDIO
+ PERFORMER "Axwell & Sebastian Ingrosso"
+ TITLE "Together (D+B Remix)"
+ INDEX 01 99:16:36
+ TRACK 46 AUDIO
+ PERFORMER "Netsky"
+ TITLE "Rise & Shine"
+ INDEX 01 101:28:54
+ TRACK 47 AUDIO
+ PERFORMER "Apex"
+ TITLE "String Theory"
+ INDEX 01 102:56:39
+ TRACK 48 AUDIO
+ PERFORMER "DJ Marky & S.P.Y."
+ TITLE "Touch Me"
+ INDEX 01 105:52:04
+ TRACK 49 AUDIO
+ PERFORMER "Subwave"
+ TITLE "Road Rage"
+ INDEX 01 107:19:56
+ TRACK 50 AUDIO
+ PERFORMER "Joe Syntax"
+ TITLE "Slingshot"
+ INDEX 01 109:53:36
+ TRACK 51 AUDIO
+ PERFORMER "Pendulum"
+ TITLE "Witchcraft (Netsky Remix)"
+ INDEX 01 110:58:14
+ TRACK 52 AUDIO
+ PERFORMER "London Elektricity"
+ TITLE "The Great Drum & Bass Swindle (Logistics Remix)"
+ INDEX 01 112:27:02
+ TRACK 53 AUDIO
+ PERFORMER "Netsky vs. Genetic Bros"
+ TITLE "The Lotus Symphony vs. Uplifting"
+ INDEX 01 115:22:47
@@ -0,0 +1,8 @@
+require 'rubygems'
+require 'rspec'
+
+require File.join(File.dirname(__FILE__), "../lib/rubycue")
+
+def load_cuesheet(cuename)
+ File.read(File.join(File.dirname(__FILE__), "fixtures/#{cuename}.cue"))
+end
@@ -0,0 +1,28 @@
+require File.join(File.dirname(__FILE__), "../spec_helper")
+
+describe RubyCue::Cuesheet do
+ before do
+ @cuesheet_file = load_cuesheet("test")
+ end
+
+ it "stores the cuesheet string" do
+ cuesheet = RubyCue::Cuesheet.new(@cuesheet_file)
+ cuesheet.cuesheet.should == @cuesheet_file
+ end
+
+ describe "#parse" do
+ before do
+ @cuesheet = RubyCue::Cuesheet.new(@cuesheet_file)
+ end
+
+ it "has the right first track" do
+ @cuesheet.parse!
+ @cuesheet.tracks.first[:title].should == "Intro"
+ end
+
+ it "has the right amonut of tracks" do
+ @cuesheet.parse!
+ @cuesheet.tracks.size.should == 53
+ end
+ end
+end

0 comments on commit 8350f9e

Please sign in to comment.