this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

implement folder index without recursiveness

+23 -14
+1 -1
src/formats/flac.odin
··· 177 177 comment.album_artist = strings.clone(value) 178 178 case "TITLE": 179 179 comment.title = strings.clone(value) 180 - case "TRACK NUMBER": 180 + case "TRACKNUMBER": 181 181 track_number, ok := strconv.parse_int(value) 182 182 if !ok { 183 183 track_number = 0
+22 -13
src/library/library.odin
··· 13 13 return strings.ends_with(fi.name, ".flac") 14 14 } 15 15 16 + ReadError :: enum { 17 + None, 18 + UnknownError, 19 + Unable_To_Resolve_Absolute_Path, 20 + Unable_To_Read_Dir, 21 + } 22 + 16 23 read_dir :: proc( 17 24 path: string, 18 25 allocator: mem.Allocator = context.allocator, 19 26 ) -> ( 20 27 result: []formats.VorbisComment, 21 - ok: bool, 28 + error: ReadError, 22 29 ) { 23 30 real_path, err := os.get_absolute_path(path, allocator) 24 31 defer delete(real_path) 25 32 26 - 27 33 if err != nil { 28 - return nil, false 34 + return nil, .Unable_To_Resolve_Absolute_Path 29 35 } 30 36 31 37 dir_entries: []os.File_Info 32 38 dir_entries, err = os.read_all_directory_by_path(real_path, allocator) 33 - defer delete(dir_entries) 39 + defer os.file_info_slice_delete(dir_entries, allocator) 34 40 35 41 fmt.printfln("Dir entries: %v", dir_entries) 36 42 37 43 if err != nil { 38 - return nil, false 44 + return nil, .Unable_To_Read_Dir 39 45 } 40 46 41 47 dir_slice := dir_entries[:] ··· 57 63 58 64 fmt.printfln("entry %v", entry) 59 65 file, ferr = os.open(entry.fullpath, {.Read}) 60 - defer os.close(file) 61 66 if ferr != nil { 62 - return nil, false 67 + os.close(file) 68 + continue 63 69 } 64 70 comment, err := formats.flac_read(file) 65 71 if err != nil { 66 - return nil, false 72 + os.close(file) 73 + continue 67 74 } 68 75 res[i] = comment 69 76 os.close(file) 70 77 } 71 78 72 - return res, true 79 + fmt.printfln("\nFound: %v", len(res)) 80 + 81 + return res, nil 73 82 } 74 83 75 84 @(test) 76 85 should_read_dir :: proc(t: ^testing.T) { 77 - dir_path := "../../test-data" 86 + dir_path := "../../test-data/" 78 87 79 - result, ok := read_dir(dir_path) 88 + result, err := read_dir(dir_path) 80 89 81 - fmt.printfln("Results: %v", result) 90 + fmt.printfln("Results: %#v; Err: %v", result, err) 82 91 83 - testing.expect(t, ok) 92 + testing.expect(t, err == nil) 84 93 85 94 for x in result { 86 95 formats.destroy_vorbis_comment(x)
test-data/01 Pompeii.flac

This is a binary file and will not be displayed.