this repo has no description
0
fork

Configure Feed

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

fix album insert on mb_id

+40 -10
+3
justfile
··· 5 5 6 6 drop: 7 7 rm -rf oudio.db 8 + 9 + sync: 10 + odin run ./src/library/
+1 -1
src/db/migrations/01-init.sql
··· 6 6 7 7 CREATE TABLE album ( 8 8 id TEXT PRIMARY KEY, 9 - title TEXT NOT NULL, 9 + title TEXT NOT NULL UNIQUE, 10 10 mb_id TEXT UNIQUE, 11 11 mb_rg_id TEXT UNIQUE 12 12 );
+11 -6
src/db/repo/album.odin
··· 17 17 err: db_pkg.DatabaseErrors, 18 18 ) { 19 19 20 + fmt.printfln("New Album: %#v", album) 21 + 20 22 ok: bool 21 - mb_id, mb_rg_id: string 22 23 23 24 id := db_pkg.gen_id("album", allocator) 24 25 new_id = id ··· 30 31 delete(c_title, allocator) 31 32 } 32 33 33 - query: cstring = "INSERT INTO album (id, title, mb_id, mb_rg_id) VALUES (?, ?, ?, ?)" 34 + query: cstring = "INSERT INTO album (id, title, mb_id, mb_rg_id) VALUES (?, ?, ?, ?) ON CONFLICT DO NOTHING" 34 35 35 36 stmt: ^sqlite.Statement 36 37 ··· 62 63 return new_id, .UnknownError 63 64 } 64 65 66 + 67 + c_mb_id, c_mb_rg_id: cstring 68 + defer delete(c_mb_id, allocator) 69 + defer delete(c_mb_rg_id, allocator) 70 + 65 71 if mb_id, ok := album.mb_id.?; ok { 66 - c_mb_id := strings.clone_to_cstring(mb_id, allocator) 67 - defer delete(c_mb_id, allocator) 72 + c_mb_id = strings.clone_to_cstring(mb_id, allocator) 73 + fmt.printfln("%s %s", mb_id, c_mb_id) 68 74 69 75 if rc := sqlite.bind_text( 70 76 stmt, ··· 81 87 82 88 83 89 if mb_rg_id, ok := album.mb_rg_id.?; ok { 84 - c_mb_rg_id := strings.clone_to_cstring(mb_rg_id, allocator) 85 - defer delete(c_mb_rg_id, allocator) 90 + c_mb_rg_id = strings.clone_to_cstring(mb_rg_id, allocator) 86 91 87 92 if rc := sqlite.bind_text( 88 93 stmt,
+21 -1
src/formats/flac.odin
··· 27 27 album_artist: string, 28 28 track_number: u8, 29 29 artists: []string, 30 + mb_id: Maybe(string), 31 + mb_rg_id: Maybe(string), 32 + mb_artist_id: Maybe(string), 30 33 } 31 34 32 35 destroy_vorbis_comment :: proc(c: VorbisComment, allocator: mem.Allocator = context.allocator) { 33 36 delete(c.title, allocator) 34 37 delete(c.album, allocator) 35 38 delete(c.album_artist, allocator) 36 - delete(c.artists) 39 + delete(c.artists, allocator) 40 + if mb_id, ok := c.mb_id.?; ok { 41 + delete(mb_id, allocator) 42 + } 43 + 44 + if mb_rg_id, ok := c.mb_rg_id.?; ok { 45 + delete(mb_rg_id, allocator) 46 + } 47 + 48 + if mb_artist_id, ok := c.mb_artist_id.?; ok { 49 + delete(mb_artist_id, allocator) 50 + } 37 51 } 38 52 39 53 check_is_flac :: proc(r: ^bufio.Reader) -> bool { ··· 178 192 comment.album_artist = strings.clone(value) 179 193 case "TITLE": 180 194 comment.title = strings.clone(value) 195 + case "MUSICBRAINZ_ALBUMID": 196 + comment.mb_id = strings.clone(value) 197 + case "MUSICBRAINZ_RELEASEGROUPID": 198 + comment.mb_rg_id = strings.clone(value) 199 + case "MUSICBRAINZ_ARTISTID": 200 + comment.mb_artist_id = strings.clone(value) 181 201 case "TRACKNUMBER": 182 202 track_number, ok := strconv.parse_int(value) 183 203 if !ok {
+4 -2
src/library/sync.odin
··· 83 83 assert(flac_err == nil) 84 84 85 85 album := types.Album { 86 - id = "", 87 - title = flac.album, 86 + id = "", 87 + title = flac.album, 88 + mb_id = flac.mb_id, 89 + mb_rg_id = flac.mb_rg_id, 88 90 } 89 91 90 92 artist := types.Artist {
test-data/04. Image.flac

This is a binary file and will not be displayed.