Class: ItunesController::AddFilesCommand

Inherits:
ServerCommand show all
Defined in:
lib/itunesController/controllserver.rb

Overview

This command is used to add files registered with the FILE command to itunes then clear the file list. This will return a code 220 if it successeds, or 504 if their is a error.

Instance Attribute Summary

Attributes inherited from ServerCommand

#name, #requiredLoginState, #singleThreaded

Instance Method Summary collapse

Methods inherited from ServerCommand

#processLine

Constructor Details

#initialize(state, itunes) ⇒ AddFilesCommand

The constructor

Parameters:



283
284
285
# File 'lib/itunesController/controllserver.rb', line 283

def initialize(state,itunes)
    super(ItunesController::CommandName::ADDFILES,ServerState::AUTHED,true,state,itunes)
end

Instance Method Details

#executeSingleThreaded(state) ⇒ Object

This is executed when the command is popped from the job queue. It is used to force single threaded access to itunes

Parameters:



295
296
297
298
299
300
# File 'lib/itunesController/controllserver.rb', line 295

def executeSingleThreaded(state)
    @itunes.cacheTracks()
    state.files.each do | path |
        @itunes.addTrack(path)
    end            
end

#processData(line, io) ⇒ Object



287
288
289
290
# File 'lib/itunesController/controllserver.rb', line 287

def processData(line,io)
    @state.files=[]            
    return true, "220 ok\r\n"
end