Skip to content

Commit

Permalink
fix option passing in play
Browse files Browse the repository at this point in the history
  • Loading branch information
mugoh committed Aug 5, 2019
1 parent 2bb71c6 commit 9135a13
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 2 additions & 3 deletions convertor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def load_audio(ctx, playlist, recursive, player):
click.echo(click.style('Specify the file playlist location', fg='red'))
return

playlist = playlist[0] if not isinstance(playlist, str) else playlist
if recursive:
try:

Expand All @@ -152,6 +153,7 @@ def load_audio(ctx, playlist, recursive, player):
return

if not convertor_instance.is_video(playlist):
playlist = playlist[0] if not isinstance(playlist, str) else playlist
click.echo(click.style(
playlist + " is not a supported media type", fg='red'))
return
Expand All @@ -176,6 +178,3 @@ def flatten(iterable):


convertor_instance = Convertor()

if __name__ == '__main__':
main()
6 changes: 5 additions & 1 deletion convertor/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def is_video(self, given_file):
"""
video_extensions = ['mp4', 'flv', 'avi', 'mp3', 'flaac']

if not isinstance(given_file, str):
try: # iter in play cmd
given_file = given_file[0]
except TypeError:
given_file = given_file
return any([ext for ext in video_extensions
if given_file.endswith(ext)])

Expand Down Expand Up @@ -152,7 +157,6 @@ def open_player(self, cmd=[], play_items=[]):
system architecture.
"""
commands = [cmd] + play_items

try:
subprocess.check_call(commands)
except subprocess.CalledProcessError as er:
Expand Down
4 changes: 4 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from convertor.cli import main

if __name__ == '__main__':
main()

0 comments on commit 9135a13

Please sign in to comment.