Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Commit

Permalink
Tweak logging
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeplum committed Dec 6, 2015
1 parent e79f9fb commit db9deb3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rycooder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ class RyCooder {

private let runLoop = NSRunLoop.currentRunLoop()
private let stdinHandle = NSFileHandle.fileHandleWithStandardInput()
private let musicFiles: [NSURL]
private let songs: [AVPlayerItem]
private let player: AVQueuePlayer

private var currentSongIndex = 0

init(pathToStage: String) {
let musicFiles = RyCooder.musicFilesInDirectory(pathToStage)
musicFiles = RyCooder.musicFilesInDirectory(pathToStage)
songs = musicFiles.map { musicFileURL -> AVPlayerItem in
return AVPlayerItem(URL: musicFileURL)
}
Expand Down Expand Up @@ -75,6 +76,7 @@ extension RyCooder {
return
}

print("\n=====> 🎵 RyCooder has taken the stage...")
jumpToSongAtIndex(0)

case "n", "next":
Expand Down Expand Up @@ -118,6 +120,11 @@ extension RyCooder {
player.play()

currentSongIndex = index

guard let fileName = musicFiles[index].lastPathComponent else {
return
}
logStart(fileName)
}

private func jumpToPreviousSong() {
Expand All @@ -129,8 +136,8 @@ extension RyCooder {
jumpToSongAtIndex(previous)
}

private func logStart() {
print("\n=====> 🎵 RyCooder has taken the stage...")
private func logStart(nameOfSong: String) {
print("\n=====> Now playing: \(nameOfSong)")
}

private func logInputTips() {
Expand Down

0 comments on commit db9deb3

Please sign in to comment.