AzuraCast / azuracast.com

Online and peer-editable documentation for the AzuraCast web radio management suite.
https://azuracast.com/
MIT License
7 stars 40 forks source link

Add Text-File Now Playing Method #104

Closed Coolguy3289 closed 3 months ago

Coolguy3289 commented 3 months ago

Proposed changes:

gAlleb commented 3 months ago

Now that is strange) I've already made a PR.

Also note I've made amendments to my initial code to send only title when artist is empty. So no need to double it.

def write_txt(m) =

  if m["artist"] != "" then
    ignore(file.write(data="#{m[\"artist\"]} - #{m[\"title\"]}", append=false, "/var/azuracast/www/web/static/nowplaying.txt"))
  else
    ignore(file.write(data="#{m[\"title\"]}", append=false, "/var/azuracast/www/web/static/nowplaying.txt"))
  end

end
radio.on_metadata(write_txt)

https://github.com/AzuraCast/azuracast.com/pull/103

Coolguy3289 commented 3 months ago

Updated my code snippet to match your artist check! As mentioned on Discord, I wasn't paying attention to whether a PR was made already in reference to this discussion. That being said I attempted to write my PR with the same consistency of styling currently used by the existing methods on this page, including adding some brief advantages/disadvantages of using this method.

BusterNeece commented 3 months ago

Not necessary; see #103.