MathewWi / xbmc-addons

Automatically exported from code.google.com/p/xbmc-addons
0 stars 0 forks source link

[cinema.experience] Music playback over trivia breaks script #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Steps to Reproduce
1. Enable Trivia
2. Enable Trivia Music File
3. Run Script

In my test example the music playlist total length was less than the trivia 
time. I would like to test behavior when music playlist is longer than trivia 
playback.

I would expect that the music would play over the trivia slides, and once the 
slides were completed the video playlist would continue. Instead, the music 
plays over the trivia slides, then once the slides complete the music playlist 
starts again. Sometimes with a black screen, sometimes with a single slide 
flashing on / off.

XBMC details:
XBMC 10.0
Duplicated on windows (windows 7 64-bit) and linux (XBMC Live Dharma beta 4 
upgraded to 10.0)
Cinema Experience - latest SVN

I've noticed that len(self.playlist) in class Trivia changes after:

xbmc.Player( xbmc.PLAYLIST_MUSIC ).play( self.settings[ "trivia_music_file" ] )

I suspect that xbmc.Playlist has become a single instance class constructor and 
that since self.playlist is passed by reference it is getting clobbered on 
calls to xbmc.Player.

Original issue reported on code.google.com by brian.wa...@gmail.com on 27 Dec 2010 at 4:48

GoogleCodeExporter commented 9 years ago

Original comment by brian.wa...@gmail.com on 27 Dec 2010 at 8:07

GoogleCodeExporter commented 9 years ago
I can confirm that calls to xbmc.Player() clobber the xbmc.Playlist reference. 
Attached is the json out of the VideoPlaylist.GetItems method before the music 
playlist is loaded, and after.

I've considered switching Main.playlist to a list, but can't figure out how to 
queue the selected movie first.

Original comment by brian.wa...@gmail.com on 28 Dec 2010 at 3:42

Attachments:

GoogleCodeExporter commented 9 years ago
Brainstorming other options:
* Persist the video playlist to a file ( or to JSON perhaps ), then rebuild the 
playlist after trivia is done.
* Create a temp playlist to enqueue the selected video, then use 
xbmc.Playlist[0] to extract the filename and description and store in another 
structure (python list).

Questions:
* Is it possible to get the thumbnail and fanart from the filename? Through a 
SQL db or API call perhaps? How does the theme know which to display?
* Is there a JSON parser built in to the XBMC python environment? The output 
from VideoPlaylist.GetItems already has everything we need to rebuild the 
playlist later, but I don't want to recreate the wheel to parse out the JSON, 
and its a little too complex for regex.

Original comment by brian.wa...@gmail.com on 28 Dec 2010 at 4:34

GoogleCodeExporter commented 9 years ago
braintorm:
1 & 2 - is the video playlist not contained as 'self.playlist = kwargs[ 
"playlist" ]'? 

- or -
3. Parse the music playlist down to a list(of music files).  This would allow 
the addition of allowing the users to add a music folder instead of a playlist 
with ease.  Though would not work with a smart playlist(not sure what damage a 
smart playlist does at the moment).  

Questions:
1. Thumbnails - yes - 'thumb = xbmc.getCacheThumbName('f:\\videos\\movie.avi')' 
thumb.  And if you notice, fanart is named the same as the thumbnail, just 
stored in the special://masterprofile/Thumbnails/Video/Fanart/ folder.
2.  No JSON parser modules built into XBMC's Python environment, though very 
easy to parse

Original comment by giftie61@gmail.com on 30 Dec 2010 at 12:37

GoogleCodeExporter commented 9 years ago
disregard the 1 & 2.  I see self.playlist is be clobbered...

Original comment by giftie61@gmail.com on 30 Dec 2010 at 12:48

GoogleCodeExporter commented 9 years ago
currently i scrapped httpapi for fetching directors as xbmc supports smb:// now.

if you insist on using executeJSON() know the return value is a repr() dict. so 
if you trust the source (XBMC) you simply.

true = True
false = False
null = None
response = xbmc.executeJSONRPC( command )
if ( response.startswith( "{" ) ):
  response = eval( response )

now you have a dict(). the if is for safety. the true, false, null is json's 
equivalents.

Original comment by nuka1195@gmail.com on 30 Dec 2010 at 1:31

GoogleCodeExporter commented 9 years ago
I'd rather not use the http or jsonapi to get the work done, but since I 
consider this behavior to be a bug on XBMC's part (since a call to xbmc.Player( 
xbmc.PLAYLIST_MUSIC ) shouldn't wipe out the video playlist) I think the fix 
should be least intrusive so that it can be refactored if and when XBMC behaves 
sane.

I've already written a simple function that converts a python list into an xbmc 
playlist, the only hurdle is that the script currently uses "Action(Queue)" to 
put the selected movie in the playlist, so I'd have to build a listinfo object 
manually. I can mock it up to test, and we can then figure out how to fill the 
listinfo object with useful data (like the plot, which I can't find in the sql 
db anywhere)

Original comment by brian.wa...@gmail.com on 30 Dec 2010 at 1:51

GoogleCodeExporter commented 9 years ago
now for the firstime i understand what you guys are talking about :) yes 
setting a music playlist did not use to wipe out the video playlist. open an 
xbmc trac for it.

Original comment by nuka1195@gmail.com on 30 Dec 2010 at 3:45

GoogleCodeExporter commented 9 years ago
:)  Yep. that is the problem..  Also found a work around.  If we build the 
xbmc.PLAYLIST_MUSIC in trivia, then send that playlist to xbmc.Player, it does 
not overwrite the Video Playlist.  Parsing a m3u file proved quite simple.

The following is little rough but does work, Video Playlist is untouched.

Original comment by giftie61@gmail.com on 30 Dec 2010 at 4:29

Attachments:

GoogleCodeExporter commented 9 years ago
The patch worked on my Windows 7 64-bit machine, haven't tested it yet on linux.

I noticed that this patch also includes an partial implementation for #69, but 
I couldn't get it to work.

Original comment by brian.wa...@gmail.com on 30 Dec 2010 at 5:36

GoogleCodeExporter commented 9 years ago
btw - awesome work on finding the workaround. I would have never thought of 
that.

Original comment by brian.wa...@gmail.com on 30 Dec 2010 at 5:39

GoogleCodeExporter commented 9 years ago
Works on Linux(My main test bed)

Actually just started to work on #69 right now(both parts) 

Glad it worked on the Windows machine..

Original comment by giftie61@gmail.com on 30 Dec 2010 at 6:04

GoogleCodeExporter commented 9 years ago
Here is a new patch(against the current svn) that should have #67 and #69 fixed.

I also fixed some of the labels that had failed to show up in the Dialog box

Hope it works...

Original comment by giftie61@gmail.com on 30 Dec 2010 at 7:53

Attachments:

GoogleCodeExporter commented 9 years ago
Looks like choosing a network share on my windows box broke the script. I've 
attached my xbmc.log, and I'm going to try a few different things.

Original comment by brian.wa...@gmail.com on 30 Dec 2010 at 1:09

Attachments:

GoogleCodeExporter commented 9 years ago
On Windows your second patch works with:
Local Paths

Doesn't work with
Mapped Drive Letters
smb:// paths

I'm digging in now to see if I can find out why.

Original comment by brian.wa...@gmail.com on 30 Dec 2010 at 1:18

GoogleCodeExporter commented 9 years ago
Ok - here's a new version of your patch that uses the XBMC httpapi to get the 
directory list, so it should work with any path that XBMC supports.

This approach mirrors nuka's in xbmcscript_player.py in the function _get_items.

My only concern with this approach is if you point it at a directory with a ton 
of files and subfolders (like the root of your music library) the script 
"hangs" while it is recursively searching those folders for music files.

Perhaps we should remove the recursive check in the call to dirEntries

Original comment by brian.wa...@gmail.com on 30 Dec 2010 at 1:57

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I forgot about smb://(I mount/map all my network shares)  

darn Windows...  Linux sometimes is much more forgiving...  :)

I rewrote the module, using JSON RPC instead of HTTP API.  works quite well, it 
is much smaller and most important, it does work on Windows and smb:// files :) 

Disabling the recursive feature is as easy as removing the "True" in the call.

for example

track_location = dirEntries( self.settings[ "trivia_music_folder" ], "music", 
"True" )
becomes

track_location = dirEntries( self.settings[ "trivia_music_folder" ], "music", )

This may be useful in stripping out some HTTP API calls, as the media types can 
be video, music, pictures, files, programs

Original comment by giftie61@gmail.com on 31 Dec 2010 at 4:22

Attachments:

GoogleCodeExporter commented 9 years ago
I submitted your patch to SVN since it fixed this issue. I'm still testing the 
folder paths part of the patch with windows file paths. I'll update with 
results in issue #69.

Original comment by brian.wa...@gmail.com on 2 Jan 2011 at 1:19

GoogleCodeExporter commented 9 years ago

Original comment by brian.wa...@gmail.com on 2 Jan 2011 at 3:08