diff --git a/CHANGELOG.md b/CHANGELOG.md index 05b3c4c..43e2fe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ MumbleDJ Changelog ================== +### October 24, 2014 +* Switched volume change method. The volume is now changed directly through `piepan` instead of `ffmpeg`. +* Fixed another bug with volume changing. + ### October 23, 2014 * Fixed a bug that would not allow audio encoding to complete successfully while on Debian. * Fixed a stupid typo that broke the `!volume` command. diff --git a/mumbledj/config.lua b/mumbledj/config.lua index c80e2b9..2b7ede1 100644 --- a/mumbledj/config.lua +++ b/mumbledj/config.lua @@ -24,17 +24,17 @@ config.COMMAND_PREFIX = "!" -- DEFAULT VALUE: true config.OUTPUT = true --- Default volume (256 being normal volume) --- DEFAULT VALUE: 32 -config.VOLUME = 32 +-- Default volume (1 being normal volume) +-- DEFAULT VALUE: 0.5 +config.VOLUME = 0.5 -- Lowest volume allowed --- DEFAULT VALUE: 16 -config.LOWEST_VOLUME = 16 +-- DEFAULT VALUE: 0.01 +config.LOWEST_VOLUME = 0.01 -- Highest volume allowed --- DEFAULT VALUE: 512 -config.HIGHEST_VOLUME = 512 +-- DEFAULT VALUE: 1.5 +config.HIGHEST_VOLUME = 1.5 -- Ratio that must be met or exceeded to trigger a song skip. -- DEFAULT VALUE: 0.5 @@ -80,7 +80,7 @@ config.ENABLE_ADMINS = true -- commands. -- EXAMPLE: -- config.ADMINS = {"Matt", "Matthieu"} -config.ADMINS = {"Matt"} +config.ADMINS = {"Matt", "DrumZ"} -- Make add an admin command? -- DEFAULT VALUE: false @@ -133,6 +133,9 @@ config.NO_ARGUMENT = "The command you issued requires an argument and you did no -- Message shown to users when they try to change the volume to a value outside the volume range. config.NOT_IN_VOLUME_RANGE = "The volume you tried to supply is not in the allowed volume range. The value must be between " .. config.LOWEST_VOLUME .. " and " .. config.HIGHEST_VOLUME .. "." +-- Message shown to users when they successfully change the volume. +config.VOLUME_SUCCESS = "You have successfully changed the volume to the following: " .. config.VOLUME .. "." + ---------------------- -- HTML CONFIGURATION diff --git a/mumbledj/download_audio.py b/mumbledj/download_audio.py index f0976af..492a489 100644 --- a/mumbledj/download_audio.py +++ b/mumbledj/download_audio.py @@ -16,7 +16,6 @@ from os import remove, system from time import sleep url = argv[1] -volume = argv[2] video = pafy.new(url) try: @@ -31,7 +30,7 @@ while isfile('song.ogg.temp'): sleep(1) if isfile('song.ogg'): - system('ffmpeg -i song.ogg -acodec libvorbis -ar 48000 -ac 1 -loglevel quiet -vol ' + str(volume) + ' song-converted.ogg -y') + system('ffmpeg -i song.ogg -acodec libvorbis -ar 48000 -ac 1 -loglevel quiet song-converted.ogg -y') else: with open('.video_fail', 'w+') as f: f.close() diff --git a/mumbledj/mumbledj.lua b/mumbledj/mumbledj.lua index c5bf766..b37a1b3 100644 --- a/mumbledj/mumbledj.lua +++ b/mumbledj/mumbledj.lua @@ -80,8 +80,9 @@ function parse_command(message) if config.OUTPUT then print(message.user.name .. " has changed the volume to the following: " .. argument .. ".") if argument ~= nil then - if config.LOWEST_VOLUME < tonumber(argument) < config.HIGHEST_VOLUME then + if config.LOWEST_VOLUME <= tonumber(argument) and tonumber(argument) <= config.HIGHEST_VOLUME then config.VOLUME = tonumber(argument) + message.user:send(config.VOLUME_SUCCESS) else message.user:send(config.NOT_IN_VOLUME_RANGE) end @@ -294,7 +295,7 @@ end -- Downloads/encodes the audio file and then begins to play it. function start_song(info) - os.execute("python download_audio.py " .. info.id .. " " .. config.VOLUME) + os.execute("python download_audio.py " .. info.id) if not file_exists(".video_fail") then while not file_exists("song-converted.ogg") do os.execute("sleep " .. tonumber(2)) @@ -302,7 +303,7 @@ function start_song(info) if piepan.Audio:isPlaying() then piepan.Audio:stop() end - piepan.me.channel:play("song-converted.ogg", get_next_song) + piepan.me.channel:play({filename="song-converted.ogg", volume=config.VOLUME}, get_next_song) else return false end