diff --git a/app/choose.go b/app/choose.go index 4d07959..8a10e68 100644 --- a/app/choose.go +++ b/app/choose.go @@ -22,6 +22,7 @@ func PickNewFile() media.Probe { func SetFile(path string) media.Probe { f := media.ProbeFile(path) file = &f + copyTagsFromFile() return f } diff --git a/app/print.go b/app/print.go index 39673ee..25c7195 100644 --- a/app/print.go +++ b/app/print.go @@ -52,8 +52,21 @@ func print() { if err != nil { panic(err) } + rec := chooseRec(ids) + + fmt.Println(rec.Title) + + tags.Title = rec.Title + tags.MusicbrainzRecordingId = rec.Id + tags.Date = rec.FirstReleaseDate + + fmt.Printf("%+v\n", tags) +} + +func chooseRec(ids media.IdResults) brainz.Recording { var recs []list.Option var rec brainz.Recording + var err error i := 1 for _, res := range ids.Results { for _, rec = range res.Recordings { @@ -66,7 +79,5 @@ func print() { } } - rec = list.List("Which recording is the correct one?", recs, nil).(recOpt).rec - - fmt.Printf("%+v\n", rec.Title) + return list.List("Which recording is the correct one?", recs, nil).(recOpt).rec } diff --git a/app/run.go b/app/run.go index a42b1ab..409d974 100644 --- a/app/run.go +++ b/app/run.go @@ -51,7 +51,8 @@ func testMb() { } func testPrint() { - SetFile("/home/drj/MyFiles/Videos/WebShows/YouTube/Dolly_Parton_-_Topic/Just_Because_I_m_a_Woman.Dolly_Parton_-_Topic.Fmv-XQerVkM.webm") + // SetFile("/home/drj/MyFiles/Videos/WebShows/YouTube/Dolly_Parton_-_Topic/Just_Because_I_m_a_Woman.Dolly_Parton_-_Topic.Fmv-XQerVkM.webm") + SetFile("/home/drj/MyFiles/Videos/WebShows/YouTube/Whitney_Houston/I_Will_Always_Love_You_Ultimate_Collection_Edit.Whitney_Houston.rB7z_l8mBxw.mp4") print() quit() diff --git a/app/tags.go b/app/tags.go new file mode 100644 index 0000000..98f2fb3 --- /dev/null +++ b/app/tags.go @@ -0,0 +1,17 @@ +package app + +import ( + "errors" + + t "codeberg.org/danjones000/strip-beats/media/tags" +) + +var tags t.Tags + +func copyTagsFromFile() { + if file == nil { + panic(errors.New("Missing file")) + } + + tags = file.FullTags() +} diff --git a/media/tags/tags.go b/media/tags/tags.go index 035379a..fc0f020 100644 --- a/media/tags/tags.go +++ b/media/tags/tags.go @@ -20,6 +20,7 @@ type Tags struct { MusicbrainzReleaseGroupId uuid.UUID `json:"MUSICBRAINZ_RELEASEGROUPID"` MusicbrainzAlbumId uuid.UUID `json:"MUSICBRAINZ_ALBUMID"` MusicbrainzAlbumArtistId uuid.UUID `json:"MUSICBRAINZ_ALBUMARTISTID"` + MusicbrainzRecordingId uuid.UUID AlbumArtistSort string ReleaseCountry string Label string