Skip to content

Commit

Permalink
Added avi as allowed video extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
wccrawford committed Apr 7, 2011
1 parent a3ee346 commit 4bb0993
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 11 additions & 3 deletions tvdirector/fileextensionfilter.mirah
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ package tvdirector

class FileExtensionFilter
implements FilenameFilter
def initialize extension:String
@extension = extension
def initialize extensions:String[]
@extensions = extensions
end

def accept(dir:File, name:String)
return name.endsWith('.'+@extension)
acceptable = false

@extensions.each { |extension|
if name.endsWith('.'+extension) then
acceptable = true
end
}

return acceptable
end
end

6 changes: 5 additions & 1 deletion tvdirector/mainframe.mirah
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ class MainFrame < JFrame

dir = File.new(getCurrentLocation)

extFilter = FileExtensionFilter.new('mkv')
exts = String[2]
exts[0] = 'mkv'
exts[1] = 'avi'

extFilter = FileExtensionFilter.new(exts)

children = dir.listFiles
children.each { |file|
Expand Down

0 comments on commit 4bb0993

Please sign in to comment.