Class: ItunesController::RemoveFilesCommand

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

Overview

This command is used to remove files registered with the FILE command from the itunes library then clear the file list.

Instance Attribute Summary

Attributes inherited from ServerCommand

#name, #requiredLoginState, #singleThreaded

Instance Method Summary collapse

Methods inherited from ServerCommand

#processLine

Constructor Details

#initialize(state, itunes) ⇒ RemoveFilesCommand

The constructor

Parameters:



337
338
339
# File 'lib/itunesController/controllserver.rb', line 337

def initialize(state,itunes)
    super(ItunesController::CommandName::REMOVEFILES,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:



349
350
351
352
353
354
# File 'lib/itunesController/controllserver.rb', line 349

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

#processData(line, io) ⇒ Object



341
342
343
344
# File 'lib/itunesController/controllserver.rb', line 341

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