Skip to content

Commit

Permalink
Merge pull request #469 from psmgeelen/master
Browse files Browse the repository at this point in the history
Fixing missing assignment of MP3 Codec when specified, in conjucture with the Node backend
  • Loading branch information
xsdg authored Jun 3, 2024
2 parents 1d14cdf + 7046fa3 commit 28a0ea8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mkchromecast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __init__(self, args = None):
if args.codec != "mp3":
print(colors.warning(f"Setting codec from {args.codec} to mp3, "
"as required by node backend"))
self.codec = "mp3"
self.codec = "mp3"
else: # not source_url and backend != "node"
if args.codec not in codec_choices:
print(colors.options(f"Selected audio codec: {args.codec}."))
Expand Down
16 changes: 16 additions & 0 deletions tests/test_instantiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ def testInstantiate(self):
mock_args.input_file = None
mkcc = mkchromecast.Mkchromecast(mock_args)

def testMP3CodecNodeBackend(self):
"""This test evaluates the assignment of the MP3 codec when the Node Backend is selected"""

mock_args = mock.Mock()
# Here we set the minimal required args for __init__ to not sys.exit.
mock_args.encoder_backend = 'node'
mock_args.bitrate = constants.DEFAULT_BITRATE
mock_args.codec = 'mp3'
mock_args.command = None
mock_args.resolution = None
mock_args.chunk_size = 64
mock_args.sample_rate = 44100
mock_args.youtube = None
mock_args.input_file = None
mkcc = mkchromecast.Mkchromecast(mock_args)

def testTrayModeInstantiation(self):
mock_config = mock.create_autospec(config.Config, spec_set=True)
self.enterContext(mock.patch.object(config, "Config", return_value=mock_config))
Expand Down

0 comments on commit 28a0ea8

Please sign in to comment.