async def create_ffmpeg_player(self, filepath):
        """Creates a streamer that plays from a file"""
        self.current_download_elapsed = 0

        self.streamer = self.vclient.create_ffmpeg_player(filepath, after=self.vafter_ts)
        self.state = "ready"
        await self.setup_streamer()

        try:
            # Read from the info json
            info_filename = "{}.info.json".format(filepath)
            with open(info_filename, 'r') as file:
                info = json.load(file)

                self.nowplayinglog.debug(info["title"])
                self.is_live = False

                if "duration" in info and info["duration"] is not None:
                    self.current_duration = info["duration"]
                else:
                    self.current_duration = 0

                if "uploader" in info:
                    self.nowplayingauthorlog.info(info["uploader"])
                else:
                    self.nowplayingauthorlog.info("Unknown")

                self.nowplayingsourcelog.info(api_music.parse_source(info))

                play_state = "Streaming" if self.is_live else "Playing"
                await self.set_topic("{} {}".format(play_state, info["title"]))
                self.statuslog.debug(play_state)
        except Exception as e:
            logger.exception(e)
async def create_ffmpeg_player ( self , filepath ) : self . current_download_elapsed = 0 self . streamer = self . vclient . create_ffmpeg_player ( filepath , after = self . vafter_ts ) self . state = "ready" await self . setup_streamer ( ) try : info_filename = "{}.info.json" . format ( filepath ) with open ( info_filename , 'r' ) as file : info = json . load ( file ) self . nowplayinglog . debug ( info [ "title" ] ) self . is_live = False if "duration" in info and info [ "duration" ] is not None : self . current_duration = info [ "duration" ] else : self . current_duration = 0 if "uploader" in info : self . nowplayingauthorlog . info ( info [ "uploader" ] ) else : self . nowplayingauthorlog . info ( "Unknown" ) self . nowplayingsourcelog . info ( api_music . parse_source ( info ) ) play_state = "Streaming" if self . is_live else "Playing" await self . set_topic ( "{} {}" . format ( play_state , info [ "title" ] ) ) self . statuslog . debug ( play_state ) except Exception as e : logger . exception ( e )
Creates a streamer that plays from a file