Top Level Namespace

Defined Under Namespace

Modules: Routinized

Instance Method Summary collapse

Instance Method Details

#find_exact_song(artist, album, song) ⇒ Object

skip the nuisance of escaping manually



8
9
10
11
12
13
14
15
16
17
# File 'lib/wrappers/itunes_play.rb', line 8

def find_exact_song(artist,album,song)
  itunes_location = Routinized.config['itunes_play']['directory']
  Dir.chdir(itunes_location)
  matched_artist = Dir.glob("*#{artist}*").first
  Dir.chdir(matched_artist)
  matched_album = Dir.glob("*#{album}*").first
  Dir.chdir(matched_album)
  matched_song = Dir.glob("*#{song}*").first
  return "#{itunes_location}/#{matched_artist}/#{matched_album}/#{matched_song}"
end

#itunes_play(artist, album, song) ⇒ Object



1
2
3
4
5
# File 'lib/wrappers/itunes_play.rb', line 1

def itunes_play(artist,album,song)
  bin = Routinized.config['itunes_play']['bin']
  full_path = find_exact_song(artist,album,song)
  return "#{bin} \"#{full_path}\" &"
end

#osx_notify(title, message = nil) ⇒ Object



1
2
3
4
5
6
7
8
# File 'lib/wrappers/osx_notify.rb', line 1

def osx_notify(title,message = nil)
  terminal_notifier = Routinized.config['osx_notify']['bin']
  if message
    return "#{terminal_notifier} -title \"#{title}\" -message \"#{message}\" "
  else #piped version
    return "#{terminal_notifier} -title \"#{title}\" -message"
  end
end

#pipeObject



1
2
3
# File 'lib/wrappers/pipe.rb', line 1

def pipe
  " | parallel "
end

#r(command, args) ⇒ Object



1
2
3
# File 'lib/wrappers/r.rb', line 1

def r(command,args)
  return "/usr/bin/env routinized command #{command} #{args}"
end

#say(message = nil) ⇒ Object



1
2
3
4
5
6
7
8
# File 'lib/wrappers/say.rb', line 1

def say(message = nil)
  bin = Routinized.config['say']['bin']
  if message
    return "#{bin} '#{message}'"
  else
    return "#{bin}"
  end
end

#sleep(seconds) ⇒ Object



1
2
3
# File 'lib/wrappers/sleep.rb', line 1

def sleep(seconds)
  "#{Routinized.config['sleep']['bin']} #{seconds} && "
end

#top(number) ⇒ Object



1
2
3
# File 'lib/wrappers/top.rb', line 1

def top(number)
  " | head -n #{number} "
end