Skip to content

Commit

Permalink
Merge 75e2b6b into ffc9300
Browse files Browse the repository at this point in the history
  • Loading branch information
brotherlogic committed Mar 9, 2019
2 parents ffc9300 + 75e2b6b commit 96e6429
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cdprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ func (s *Server) resolve() string {
return s.Registry.Identifier
}

func (s *Server) fileExists(file string) bool {
if _, err := os.Stat(file); os.IsNotExist(err) {
return false
}
return true
}

func (pr *prodRipper) ripToMp3(ctx context.Context, pathIn, pathOut string) {
conn, err := pr.dial("executor", pr.server())
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions cdprocessorutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ func (s *Server) makeLinks(ctx context.Context, ID int32) error {
}

func (s *Server) buildLink(ctx context.Context, track *pbgd.Track, record *pbgd.Release) {
// Verify that the track exists
if !s.fileExists(fmt.Sprintf("%v%v/track%v.cdda.mp3", s.dir, record.Id, expand(track.Position))) {
s.RaiseIssue(ctx, "Missing Tracks", fmt.Sprintf("%v is missing tracks", record.Id), false)
return
}

s.ripper.runCommand(ctx, []string{"ln", "-s", fmt.Sprintf("%v%v/track%v.cdda.mp3", s.dir, record.Id, expand(track.Position)), fmt.Sprintf("%v%v", s.mp3dir, record.Id)})
s.ripper.runCommand(ctx, []string{"mp3info", "-n", fmt.Sprintf("%v", track.Position), fmt.Sprintf("%v%v/track%v.cdda.mp3", s.mp3dir, record.Id, expand(track.Position))})
s.ripper.runCommand(ctx, []string{"mp3info", "-t", fmt.Sprintf("%v", track.Title), fmt.Sprintf("%v%v/track%v.cdda.mp3", s.mp3dir, record.Id, expand(track.Position))})
Expand Down

0 comments on commit 96e6429

Please sign in to comment.