garbear / xbmc

XBMC Main Repository
http://xbmc.org
Other
132 stars 53 forks source link

xbmc.player ignoring m3u #110

Open zach-morris opened 5 years ago

zach-morris commented 5 years ago

Issue: Attempting to launch a game from m3u via IAGL is failing / being ignored.

Relevant IAGL Code:

xbmc.log(msg='IAGL:  Gameclient for Retroplayer set to: %(current_gameclient)s' % {'current_gameclient': current_gameclient}, level=xbmc.LOGNOTICE)
xbmc.log(msg='IAGL:  Attempting to play the following file through Retroplayer: %(url)s' % {'url': self.launch_filenames[0]}, level=xbmc.LOGNOTICE)
xbmc.Player().play(xbmc.translatePath(self.launch_filenames[0]),game_listitem)

Log:

NOTICE: IAGL:  Gameclient for Retroplayer set to: game.libretro.beetle-psx
NOTICE: IAGL:  Attempting to play the following file through Retroplayer: /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/Alone_in_the_Dark_The_New_Nightmare_USA/Alone in the Dark - The New Nightmare (USA).m3u

After the play call is sent, I see no attempt in the Kodi log to try and play the file. Pointing to the m3u through the Kodi GUI (via a Games Source) will launch the file just fine.

garbear commented 5 years ago

I tried to reproduce in Windows 10 and couldn't get IAGL to launch the game. Here's what I see in the log:

Debug Print: IAGL:  M3U File C:\Users\xxx\AppData\Roaming\Kodi\userdata\addon_data\plugin.program.iagl\temp_iagl\Alone_in_the_Dark_The_New_Nightmare_USA\Alone in the Dark - The New Nightmare (USA) (Disc 1).m3u was found for launching.
Debug Print: IAGL:  Offscreen listitem supported
Debug Print: CAddonSettings[plugin.program.iagl]: loading setting definitions
Debug Print: CAddonSettings[plugin.program.iagl]: trying to load setting definitions from old format...
Debug Print: CAddonSettings[plugin.program.iagl]: loading setting values
Debug Print: argument "entry0_1" for method "setInfo" must be unicode or str
Exception thrown at 0x00007FFEF416A388 in kodi.exe: Microsoft C++ exception: XBMCAddon::WrongTypeException at memory location 0x000000F5D6A3C5D0.
zach-morris commented 5 years ago

OK, a little more testing. I'm guessing Kodi assumes the m3u file is a playlist file to handle, which xbmc.player().play doesn't seem to handle. However, there are many libretro cores which m3u files are valid input files.

Changing the play call to (just pointing to the filepath for the m3u):

xbmc.Player().play(xbmc.translatePath(self.launch_filenames[0]))

Log shows:

15:03:26.643 T:123145360613376  NOTICE: IAGL:  Attempting to play the following file through Retroplayer: /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).m3u
15:03:26.647 T:123145360613376   DEBUG: IAGL:  History file list cache found, cache file /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/list_cache/game_history.json
15:03:26.649 T:123145354633216   DEBUG: CAnnouncementManager - Announcement: OnAdd from xbmc
15:03:26.650 T:123145354633216   DEBUG: GOT ANNOUNCEMENT, type: 2, from xbmc, message OnAdd
15:03:26.650 T:123145354633216   DEBUG: CAnnouncementManager - Announcement: OnRemove from xbmc
15:03:26.650 T:123145354633216   DEBUG: GOT ANNOUNCEMENT, type: 2, from xbmc, message OnRemove
15:03:26.651 T:123145354633216   DEBUG: CAnnouncementManager - Announcement: OnAdd from xbmc
15:03:26.651 T:123145354633216   DEBUG: GOT ANNOUNCEMENT, type: 2, from xbmc, message OnAdd
15:03:26.653 T:123145360613376   DEBUG: IAGL:  Saving game history cache file
15:03:26.653 T:123145360613376   DEBUG: IAGL:  ATV Racers (USA) added to gameplay history
15:03:26.654 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers(/Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).cue)
15:03:26.654 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: system rules
15:03:26.655 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: system rules
15:03:26.655 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mms/udp
15:03:26.655 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout
15:03:26.655 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtmp
15:03:26.655 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtsp
15:03:26.655 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: streams
15:03:26.655 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvd
15:03:26.655 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: sdp/asf
15:03:26.656 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: nsv
15:03:26.656 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: radio
15:03:26.656 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers: matched 0 rules with players
15:03:26.656 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers: adding videodefaultplayer (VideoPlayer)
15:03:26.656 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=0
15:03:26.656 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=1
15:03:26.656 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers: added 1 players
15:03:26.658 T:4645807552   DEBUG: Radio UECP (RDS) Processor - new CDVDRadioRDSData
15:03:26.658 T:4645807552  NOTICE: VideoPlayer::OpenFile: /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).m3u
15:03:26.658 T:4645807552   DEBUG: OnPlayBackStarted: CApplication::OnPlayBackStarted
15:03:26.659 T:123145357393920   DEBUG: Thread VideoPlayer start, auto delete: false
15:03:26.659 T:123145357393920  NOTICE: Creating InputStream
15:03:26.660 T:123145360613376   DEBUG: IAGL:  InfoDialog Action ID 7
15:03:26.660 T:123145357393920  NOTICE: Creating Demuxer
15:03:26.661 T:123145357393920   ERROR: Open - error probing input format, /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).cue
15:03:26.661 T:123145357393920   ERROR: OpenDemuxStream - Error creating demuxer
15:03:26.661 T:123145357393920  NOTICE: CVideoPlayer::OnExit()
15:03:26.662 T:123145357393920   DEBUG: Thread VideoPlayer 123145357393920 terminating
15:03:26.664 T:123145353023488   DEBUG: Loading settings for /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).m3u
15:03:26.668 T:123145356857344   DEBUG: DoWork - Saving file state for video item /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).m3u
15:03:26.669 T:4645807552   DEBUG: CVideoGUIInfo::InitCurrentItem(/Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).m3u)
15:03:26.781 T:123145354096640   DEBUG: OnPlayBackStopped: CApplication::OnPlayBackStopped
15:03:26.786 T:123145354633216   DEBUG: CAnnouncementManager - Announcement: OnStop from xbmc
15:03:26.786 T:123145354633216   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnStop
15:03:26.887 T:123145354633216   DEBUG: CAnnouncementManager - Announcement: OnChanged from xbmc
15:03:26.888 T:123145354633216   DEBUG: GOT ANNOUNCEMENT, type: 1024, from xbmc, message OnChanged
15:03:26.891 T:123145354633216   DEBUG: CAnnouncementManager - Announcement: OnPlay from xbmc
15:03:26.892 T:123145354633216   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnPlay
15:03:26.960 T:123145361149952   ERROR: EXCEPTION: XBMC is not playing any media file
15:03:26.962 T:123145361149952   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.RuntimeError'>
                                            Error Contents: XBMC is not playing any media file
                                            Traceback (most recent call last):
                                              File "/Users/xxx/Library/Application Support/Kodi/addons/plugin.video.youtube/resources/lib/youtube_plugin/kodion/utils/player.py", line 74, in onPlayBackStarted
                                                self.current_video_total_time = self.getTotalTime()
                                            RuntimeError: XBMC is not playing any media file
                                            -->End of Python script error report<--
15:03:26.989 T:4645807552   DEBUG: ------ Window Init (DialogBusy.xml) ------
15:03:26.989 T:4645807552   DEBUG: Window DialogBusy.xml was already loaded
15:03:26.989 T:4645807552   DEBUG: Alloc resources: 0.05ms
15:03:26.991 T:4645807552  NOTICE: CVideoPlayer::CloseFile()

Changing the play call to:

xbmc.Player().play(game_listitem)

Where the listitem contains the url, gameclient, etc

Log shows:

15:08:50.433 T:123145356857344   DEBUG: IAGL:  M3U File /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).m3u was found for launching.
15:08:50.433 T:123145356857344   DEBUG: IAGL:  Offscreen listitem supported
15:08:50.435 T:123145356857344   DEBUG: CAddonSettings[plugin.program.iagl]: loading setting definitions
15:08:50.435 T:123145356857344   DEBUG: CAddonSettings[plugin.program.iagl]: trying to load setting definitions from old format...
15:08:50.437 T:123145356857344   DEBUG: CAddonSettings[plugin.program.iagl]: loading setting values
15:08:50.438 T:123145356857344  NOTICE: IAGL:  Gameclient for Retroplayer set to: game.libretro.beetle-psx
15:08:50.438 T:123145356857344  NOTICE: IAGL:  Attempting to play the following file through Retroplayer: /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).m3u
15:08:50.439 T:123145356857344   ERROR: EXCEPTION: Failed to convert to input type to either a std::string or a p.PlayList
15:08:50.439 T:123145356857344   DEBUG: IAGL Error:  Attempt to play game failed with exception Failed to convert to input type to either a std::string or a p.PlayList

However, when I just browse to the m3u file and select it, Kodi finds it to be Retroplayable:

15:17:00.839 T:4645807552 WARNING: CApplication::PlayMedia called to play a playlist /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).m3u but no idea which playlist to use, playing first item
15:17:00.840 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers(/Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).cue)
15:17:00.840 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: system rules
15:17:00.840 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: system rules
15:17:00.840 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mms/udp
15:17:00.840 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout
15:17:00.841 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtmp
15:17:00.841 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtsp
15:17:00.841 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: streams
15:17:00.841 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvd
15:17:00.841 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: sdp/asf
15:17:00.841 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: nsv
15:17:00.841 T:4645807552   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: radio
15:17:00.842 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers: matched 0 rules with players
15:17:00.842 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers: adding retroplayer
15:17:00.842 T:4645807552   DEBUG: CPlayerCoreFactory::GetPlayers: added 1 players
15:17:00.843 T:4645807552   DEBUG: CAddonDatabase: SELECT repo.id FROM repo .. took 1 ms
15:17:00.851 T:123145357393920   DEBUG: Thread GUIDialogCache 123145357393920 terminating (autodelete)
15:17:00.851 T:4645807552   DEBUG: CAddonDatabase: query  SELECT * FROM addons JOIN addonlinkrepo ON addons.id=addonlinkrepo.idAddon WHERE addonlinkrepo.idRepo IN (2,3) ORDER BY addons.addonID returned 1156 rows in 8 ms
15:17:00.989 T:4645807552   DEBUG: CAddonDatabase::GetAddons took 147 ms
15:17:00.998 T:4645807552   DEBUG: Select game client dialog: Found 11 candidates
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.beetle-pce-fast as a candidate
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.beetle-supergrafx as a candidate
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.beetle-pcfx as a candidate
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.reicast as a candidate
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.genplus as a candidate
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.picodrive as a candidate
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.beetle-saturn as a candidate
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.yabause as a candidate
15:17:00.998 T:4645807552   DEBUG: Adding game.libretro.beetle-psx as a candidate
15:17:00.999 T:4645807552   DEBUG: Adding game.libretro.pcsx-rearmed as a candidate
15:17:00.999 T:4645807552   DEBUG: Adding game.libretro.4do as a candidate
15:17:00.999 T:4645807552   DEBUG: Select game client dialog: Loading savestate metadata
15:17:00.999 T:4645807552   DEBUG: Loading savestate from /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).sav
15:17:00.999 T:4645807552   ERROR: Failed to open savestate file /Users/xxx/Library/Application Support/Kodi/userdata/addon_data/plugin.program.iagl/temp_iagl/ATV_Racers_USA/ATV Racers (USA).sav
...
15:17:09.129 T:4645807552   DEBUG: Select game client dialog: User selected emulator game.libretro.beetle-psx
15:17:09.130 T:4645807552    INFO: RetroPlayer[PROCESS]: Created process info for macOS
15:17:09.130 T:4645807552   DEBUG: RetroPlayer[PLAYER]: ---------------------------------------
15:17:09.131 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Game tag loaded
15:17:09.131 T:4645807552   DEBUG: RetroPlayer[PLAYER]: URL:
15:17:09.131 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Title:
15:17:09.131 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Platform:
15:17:09.131 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Genres:
15:17:09.131 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Developer:
15:17:09.131 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Game Code:
15:17:09.131 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Region:
15:17:09.132 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Publisher:
15:17:09.132 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Format:
15:17:09.132 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Cartridge type:
15:17:09.132 T:4645807552   DEBUG: RetroPlayer[PLAYER]: Game client: game.libretro.beetle-psx
15:17:09.132 T:4645807552   DEBUG: RetroPlayer[PLAYER]: ---------------------------------------
garbear commented 5 years ago

This issue should be relatively straight forward to fix. I suspect that xbmc.Player().play(game_listitem) uses PlayFile(), whereas playlist detection probably occurs in PlayMedia() (which later calls PlayFile()). We just need a bit of refactoring.

There's a chance I can fix this before 18 release, but I don't have access to the hardware these days. If you know anyone wanting to pick some low-hanging fruit and get some code into Kodi, they'll get my full assistance.