Skip to content

Commit

Permalink
Update proc target to enforce force copy and set permissions
Browse files Browse the repository at this point in the history
This change modifies the proc command in spot.yml to enforce the force copy of the mp3 file and to set the permissions of the copied mp3 file. It also adjusts proc_mp3.go and proc_mp3_test.go to reflect these changes. The verbosity flag has been removed from the spot command in proc_mp3.go and a flag for default concurrency has been added to the deploy to nodes task. Finally, the dbg flag has been removed from the proc-mp3 target in the Makefile.
  • Loading branch information
umputun committed Jan 2, 2024
1 parent 7793afa commit bca2593
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion publisher/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ prep-show-post:

# set necessary tags to episode mp3 file and upload it to master and all nodes
proc-mp3:
@docker-compose run --rm -it publisher proc --file="$$FILE" --dbg
@docker-compose run --rm -it publisher proc --file="$$FILE"

# deploy new podcast episode page to https://radio-t.com and regenerate site
deploy-site:
Expand Down
4 changes: 2 additions & 2 deletions publisher/app/cmd/proc_mp3.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func (p *Proc) Do(mp3file string) error {
return nil
}

p.Run("spot", "-p /etc/spot.yml", "-e mp3:"+mp3file, `--task="deploy to master"`, "-v")
p.Run("spot", "-p /etc/spot.yml", "-e mp3:"+mp3file, `--task="deploy to nodes"`, "-v")
p.Run("spot", "-p /etc/spot.yml", "-e mp3:"+mp3file, `--task="deploy to master"`)
p.Run("spot", "-p /etc/spot.yml", "-e mp3:"+mp3file, `--task="deploy to nodes"`, "-c 2")
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions publisher/app/cmd/proc_mp3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func TestProc_Do(t *testing.T) {
require.Equal(t, 2, len(ex.RunCalls()))
assert.Equal(t, "spot", ex.RunCalls()[0].Cmd)
assert.Equal(t, []string{"-p /etc/spot.yml", "-e mp3:/tmp/publisher_test/rt_podcast123/rt_podcast123.mp3",
"--task=\"deploy to master\"", "-v"}, ex.RunCalls()[0].Params)
"--task=\"deploy to master\""}, ex.RunCalls()[0].Params)

assert.Equal(t, "spot", ex.RunCalls()[1].Cmd)
assert.Equal(t, []string{"-p /etc/spot.yml", "-e mp3:/tmp/publisher_test/rt_podcast123/rt_podcast123.mp3",
"--task=\"deploy to nodes\"", "-v"}, ex.RunCalls()[1].Params)
"--task=\"deploy to nodes\"", "-c 2"}, ex.RunCalls()[1].Params)
}

func TestProc_setMp3Tags(t *testing.T) {
Expand Down
6 changes: 5 additions & 1 deletion publisher/spot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ tasks:
options: {local: true}

- name: copy mp3 file
copy: {src: "$mp3", dst: "$DST_MP3_FILE_NAME", mkdir: true}
copy: {src: "$mp3", dst: "$DST_MP3_FILE_NAME", mkdir: true, force: true}

- name: set permissions
script: chmod 644 $DST_MP3_FILE_NAME
options: {sudo: true}

- name: clean old files
script: find /srv/media/radio-t -type f -mtime +60 -mtime -1200 -iname *.mp3 -exec rm {} \;
Expand Down

0 comments on commit bca2593

Please sign in to comment.