Hi,

I believe that you should be able to keep a reference to the latest username 
used at login. Something like this:
```
last_user = ref ""

def harbor_auth(port,user,password) = 
  last_user := user
  (port == 8080 and user == "user1" and password == "pass1") or
  (port == 8080 and user == "user2" and password == "pass2")
end
auth1 = harbor_auth(8080)
```

This way, `last_user` keeps a reference to the latest username that you can use 
later in your script.

Secondly, you should look at `output.file` instead of the `dumpfile` parameter. 
`dumpfile` was mostly added for debugging purposes but `output.file` should 
have all you need.

I believe the simplest way to go would be use the `on_close` callback. 
Something like this:
```
moderator = input.harbor(id="Mod Harbor",port=8080,auth=auth1,icy=true,"modi")

def on_close(filename) =
  user = !last_user
  # Generate new file name:
  new_filename = "/path/to/recorded/dumps/#{user}_#{basename(filename)}"
  # Move to the new location
  system("mv #{filename} #{new_filename}")
end

output.file(on_close=on_close,%mp3,fallible=true,moderator)
```

The code isn't tested but it should give enough information to reproduce it. 
I'll close this ticket since I believe there's no new functionalities needed or 
bug to fix for it. All the best with your liquidsoap project!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/savonet/liquidsoap/issues/661#issuecomment-439935854
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to