-
Notifications
You must be signed in to change notification settings - Fork 1
/
globmodel.rb
44 lines (41 loc) · 1.43 KB
/
globmodel.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding:utf-8 -*-
class GlobServerFiles
def self.data(args = {})
@folders = args[:folders] ||= [
# "/var/smb/sdb1/music/iTunesMac/BAIDOKU",
# "/var/smb/sdb1/music/iTunes1",
# "/var/smb/sdb1/music/iTunes2",
# "/var/smb/sdb1/music/iTunes3",
"/var/smb/sdb1/music/iTunes2011",
# "/var/smb/sdb1/music/iTunesMac",
"/var/smb/sdb1/music/iTunesLossless",
"/var/smb/sdb1/video2/作成",
]
@ext = args[:ext] ||= [
'MP3',
'M4A',
'WAV',
'MKA',
'APE',
'FLAC',
'WMA',
'OGG',
]
[@folders,@ext]
end
def self.glob
@files = []
@filders,@ext = GlobServerFiles.data
@folders.each do |p|
@ext.each do |e|
Dir.glob("#{p}/**/*.#{e}") do |element|
@files << { 'path' => element }
end
Dir.glob("#{p}/**/*.#{e.downcase}") do |element|
@files << { 'path' => element }
end
end
end
return @files
end
end