mp3 - Python VLC module not working with no tags -


i using vlc module in python play music downloaded youtube mp3 converter project. problem is, have discovered these files don't cooperate , python ends throwing load of red @ me. believe because mp3 file has no tags, when module checks them , don't exist throws error @ me. here code:

import vlc import os import time  def playtrack(fileid, songname):     filename = fileid + ".mp3"     print('now playing: ' + songname)     music = vlc.mediaplayer(filename)     music.play()     print(music.get_state())     time.sleep(60)     print("finished.")     #os.remove(filename)  playtrack("tvj0zts4wf4", "foo") 

here output "very long...":

now playing: foo state.nothingspecial warning: option --plugin-path no longer exists. warning: option --plugin-path no longer exists. taglib: mpeg::header::parse() -- next frame not consistent frame. taglib: mpeg::header::parse() -- next frame not consistent frame. 

there way more errors this, stackoverflow limits me putting them all. they're same, anyway.

taglib: mpeg::header::parse() -- next frame not consistent  taglib: mpeg::header::parse() -- invalid mpeg version bits. taglib: mpeg::header::parse() -- invalid mpeg layer bits. taglib: mpeg::header::parse() -- invalid mpeg version bits. taglib: mpeg::header::parse() -- invalid bit rate. taglib: mpeg::header::parse() -- invalid mpeg version bits. taglib: mpeg::header::parse() -- next frame not consistent frame. taglib: mpeg::header::parse() -- invalid bit rate. taglib: mpeg::header::parse() -- not read next frame header. taglib: mpeg::header::parse() -- next frame not consistent frame. taglib: mpeg::properties::read() -- not find valid first mpeg frame in stream. finished.  process finished exit code 0 

here's downloader, if it's necessary:

import youtube_dl import os   class invalidurl(exception):     pass   class songexists(exception):     pass   def download(url):     try:         options = {             'format': 'bestaudio/best',             'extractaudio': true,  # keep audio             'audioformat': "mp3",  # convert wav             'outtmpl': '%(id)s.mp3',  # name file id of video             'noplaylist': true,  # download single song, not playlist         }         youtube_dl.youtubedl(options) ydl:             r = ydl.extract_info(url, download=false)             if os.path.isfile(str(r["id"])):                 raise songexists('this song has been requested.')             print("downloading" + str(r["title"]))             ydl.download([url])             print("downloaded" + str(r["title"]))             return r["title"], r["id"]     except youtube_dl.utils.downloaderror:         raise invalidurl('this url invalid.')  if __name__ == "__main__":     download("https://www.youtube.com/watch?v=tvj0zts4wf4") 

i have tried code on machine , works. think using outdated version or outdated library. try code @ below, , let me know if figure out more reliable solution....

sudo pip uninstall vlc sudo pip uninstall python-vlc sudo pip install python-vlc 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -