0

in my code I need to play a playlist of songs were downloaded to the device so I need to know how to open songs in external apps in this question i found how to open a single song as os.runfile(fileName) worked fine for me with single songs .. so is there is some thins like os.runfiles which obliviously isn't available

Ahmed Yasser
  • 109
  • 12

1 Answers1

0

Don't use os. Use

import shlex
import subprocess
import sys

externalApp = 'vlc'
command = shlex.split('{} ~/Videos/*mp4'.format(externalApp))
subprocess.run(command)

That is if you're using linux. If not, modify command accordingly.

Suspended
  • 1,184
  • 2
  • 12
  • 28
  • unfortunately i'm using windows and i keep getting file not found error .. can you explain how can i modify the command please ? – Ahmed Yasser Jan 21 '21 at 07:40
  • I think you just need to make path to input file look windows-like, like so: "C:/Users/Username/Videos/someVideo.mp4", or wherever it is you keep your media files. – Suspended Jan 21 '21 at 21:28