add m4a file extension

This commit is contained in:
Azareal 2020-08-12 18:24:41 +10:00
parent 5de1f66973
commit fbed07a8b4

View File

@ -72,7 +72,7 @@ var AllowedFileExts = StringList{
"txt", "xml", "json", "yaml", "toml", "ini", "md", "html", "rtf", "js", "py", "rb", "css", "scss", "less", "eqcss", "pcss", "java", "ts", "cs", "c", "cc", "cpp", "cxx", "C", "c++", "h", "hh", "hpp", "hxx", "h++", "rs", "rlib", "htaccess", "gitignore", /*"go","php",*/ // text "txt", "xml", "json", "yaml", "toml", "ini", "md", "html", "rtf", "js", "py", "rb", "css", "scss", "less", "eqcss", "pcss", "java", "ts", "cs", "c", "cc", "cpp", "cxx", "C", "c++", "h", "hh", "hpp", "hxx", "h++", "rs", "rlib", "htaccess", "gitignore", /*"go","php",*/ // text
"wav", "mp3", "oga", // audio "wav", "mp3", "oga", "m4a", // audio
"mp4", "avi", "ogg", "ogv", "ogx", "wmv", "webm", // video "mp4", "avi", "ogg", "ogv", "ogx", "wmv", "webm", // video
@ -95,7 +95,7 @@ var WebVideoFileExts = StringList{
"mp4", "avi", "ogg", "ogv", "webm", "mp4", "avi", "ogg", "ogv", "webm",
} }
var WebAudioFileExts = StringList{ var WebAudioFileExts = StringList{
"wav", "mp3", "oga", "wav", "mp3", "oga","m4a",
} }
var ArchiveFileExts = StringList{ var ArchiveFileExts = StringList{
"bz2", "zip", "zipx", "gz", "7z", "tar", "cab", "rar", "kgb", "pea", "xz", "zz", "tgz", "bz2", "zip", "zipx", "gz", "7z", "tar", "cab", "rar", "kgb", "pea", "xz", "zz", "tgz",
@ -112,8 +112,8 @@ func init() {
// TODO: Write a test for this // TODO: Write a test for this
func (sl StringList) Contains(needle string) bool { func (sl StringList) Contains(needle string) bool {
for _, item := range sl { for _, it := range sl {
if item == needle { if it == needle {
return true return true
} }
} }
@ -126,14 +126,14 @@ var IDToTable = make(map[int]string)
func InitTables(acc *qgen.Accumulator) error { func InitTables(acc *qgen.Accumulator) error {
stmt := acc.Select("tables").Columns("id,name").Prepare() stmt := acc.Select("tables").Columns("id,name").Prepare()
if err := acc.FirstError(); err != nil { if e := acc.FirstError(); e != nil {
return err return e
} }
return eachall(stmt, func(r *sql.Rows) error { return eachall(stmt, func(r *sql.Rows) error {
var id int var id int
var name string var name string
if err := r.Scan(&id, &name); err != nil { if e := r.Scan(&id, &name); e != nil {
return err return e
} }
TableToID[name] = id TableToID[name] = id
IDToTable[id] = name IDToTable[id] = name
@ -155,8 +155,8 @@ func (inits dbInits) Run() error {
return nil return nil
} }
func (inits dbInits) Add(init ...func(acc *qgen.Accumulator) error) { func (inits dbInits) Add(i ...func(acc *qgen.Accumulator) error) {
DbInits = dbInits(append(DbInits, init...)) DbInits = dbInits(append(DbInits, i...))
} }
// TODO: Add a graceful shutdown function // TODO: Add a graceful shutdown function
@ -210,14 +210,14 @@ func Countf(stmt *sql.Stmt, args ...interface{}) (count int) {
} }
func eachall(stmt *sql.Stmt, f func(r *sql.Rows) error) error { func eachall(stmt *sql.Stmt, f func(r *sql.Rows) error) error {
rows, err := stmt.Query() rows, e := stmt.Query()
if err != nil { if e != nil {
return err return e
} }
defer rows.Close() defer rows.Close()
for rows.Next() { for rows.Next() {
if err := f(rows); err != nil { if e := f(rows); e != nil {
return err return e
} }
} }
return rows.Err() return rows.Err()