Help with minor mod of the Kaleidascrape script?!
#1
Question 
I'm trying to modify the Kaleidascrape script to work for some new trivia slides I got. I know almost nothing about python, I basically just tried to figure it out by looking through the script and seeing what was doing what. Anyway, part of the script starts a slideshow, and some slides are supposed to be grouped together, in groups of two for the original script, because with the trivia questions, there's a question, and then an answer. In a new trivia slide pack I got, there is still a question and answer, but also a CLUE inbetween. So, I'm trying to make it so it will group these new ones together as well. The old slides use an A, B system, where like 101a.jpg would be the question and 101b.jpg would be the answer, a would show first and then b. I want to continue to use this, but also add the ability to do the three slide thing. The way the 3 slide groups are labels is q for question, c for clue, and r for response, so it would go, for example, 101q.jpg, then 101c.jpg, then 101r.jpg (the 101 is just filling the place for any arbitrary file name, by the way). Anyway, below you can see my efforts to achieve this, however it doesn't like it. I get a "TypeError: an integer is required" message for the line that says randInfo3 = re.sub(r'([^-]+)q.jpg', r'\1r.jpg', r'\1c.jpg', str(randInfo3))

I'm sure its a simple fix, but if somebody could help me out it would be great. By the way, I made all the lines I added bold, so, this is probably where you should check for problems haha. Also, in the actual script, I have the proper spacing, I believe, just when you copy and paste into here it removes all the tabs and stuff.

#Function to grab Trivia#

trivialist = index(triviaDir);

count = (len(trivialist))
queuecount = 0
mytrivia = Trivia()

xbmc.Player().play(mlist)
time.sleep(1)
mytrivia.show()
while queuecount < trivia_num:
randtriv = random.randint(1, count)
randInfo = trivialist[randtriv]
randInfo1 = trivialist[randtriv]
randInfo2 = trivialist[randtriv]
randInfo3 = trivialist[randtriv]
randInfo4 = trivialist[randtriv]
randInfo5 = trivialist[randtriv]

randInfo1 = re.sub(r'([^-]+)b.jpg', r'\1a.jpg', str(randInfo1))
randInfo2 = re.sub(r'([^-]+)a.jpg', r'\1b.jpg', str(randInfo2))
randInfo3 = re.sub(r'([^-]+)q.jpg', r'\1r.jpg', r'\1c.jpg', str(randInfo3))
randInfo4 = re.sub(r'([^-]+)r.jpg', r'\1q.jpg', r'\1c.jpg', str(randInfo4))
randInfo5 = re.sub(r'([^-]+)c.jpg', r'\1q.jpg', r'\1r.jpg', str(randInfo5))

match = re.match('.*?b.jpg', randInfo)
match2 = re.match('.*?a.jpg', randInfo)
match3 = re.match('.*?q.jpg', randInfo)
match4 = re.match('.*?r.jpg', randInfo)
match5 = re.match('.*?c.jpg', randInfo)

if match:
mytrivia.display(randInfo1)
mytrivia.display(randInfo2)
elif match2:
mytrivia.display(randInfo1)
mytrivia.display(randInfo2)
elif match3:
mytrivia.display(randInfo3)
mytrivia.display(randInfo4)
mytrivia.display(randInfo5)
elif match4:
mytrivia.display(randInfo3)
mytrivia.display(randInfo4)
mytrivia.display(randInfo5)
elif match5:
mytrivia.display(randInfo3)
mytrivia.display(randInfo4)
mytrivia.display(randInfo5)

else:
mytrivia.display(randInfo1)
queuecount = queuecount + 1
mytrivia.close()
xbmc.Player().stop(mlist)
del mytrivia
Reply
#2
Hi too !
Please
thank you
Reply
#3
...huh?
Reply
#4
bump!

I would be really appreciative if somebody would give this a lookover. I know it seems complicated at first glance, but I THINK it should be relatively simple, since it already has the function working for 2 slides...I just need it to work for a 3 slide setup in addition to the 2 slide one...Seems like you could just modify the 2 slide thing, but yeah, I don't know much about python. Anyway, I'd be really gratefull if somebody would help me out here. Thanks in advance Smile
Reply
#5
If you post your code I'll have a look. Just zip it into one file and put it up on a free site that way we can find exactly what the problem(s) are..put in a couple of samples of your slides to make testing easy as well..Im sure it can be resolved easily..
Server: FreeNas 9 NAS: 6*3TB - Kodi Sql Database
Kodi Systems: Nvidia Shield Pro, G-Box Q (OpenElec), RikoMagic MK802 IV[
Skin: reFocus
Reply
#6
Awesome, thanks.

Here's the unmodded Kaleidascrape script: http://www.filefactory.com/file/f3a154

Here's the one I TRIED modifying:
http://www.filefactory.com/file/65d794/

And here's a rar of the various types of pictures i'm trying to view:
http://www.filefactory.com/file/821799/

With the pictures, I separated them into folders.

Single Slides: single slides just by themselvs, not grouped in sets of questions and answers or antyhing

Q-C-A Triple Slide Sets: This is the way the slides come named in the set, so I suppose if it could be made to work with this naming system (while still maintaining the A/B naming system for the 2 slide sets) that would be optimum. But, I assumed that this wasn't possible, since the triple slide sets would then be assigning "a" to the third slide in each set, while in the double slide sets, the "a" is supposed to be attributed to the first slide in each set. Which brings me to my next category...

Q-C-R Triple Slide Sets: This was how I tried renaming some of the slides, with the Q meaning question, C meaning clue, and R meaning response (answer). Of course, like I said, if it would be just as easy to set it up to work with the Q-C-A naming scheme, that would be prefered.

A-B Double Slide Sets: This is the format already supported in the unmodded kaleidascrape.py. A shows, then B.

Q-A Double Slide Sets: This is the form found in the new sets. Instead of being a and b, its q and a (meaning question and answer, of course) If it could be made to check for this too, that would be great, but far from necessary, and like I said, I'm not sure its possible, since it has the A in it used as the second slide whereas its used as the first slide in the A-B scheme.

Anyway, thanks in advance, if you ever get around to this
Reply
#7
I forgot to mention....You probably would have figured this out yourself, but if you're trying to test it, you have to have put the Triva folder of slides in a folder called "Kaleidascrape" and place it on your E drive. I disabled all the other videos and stuff that would normally play since obviously you won't have those. You do need to queue up a movie first to test it though.
Reply
#8
Ok getting them now...I'll report back later..
Server: FreeNas 9 NAS: 6*3TB - Kodi Sql Database
Kodi Systems: Nvidia Shield Pro, G-Box Q (OpenElec), RikoMagic MK802 IV[
Skin: reFocus
Reply
#9
I have finished it...

What you need to do is change the following sections to where all your media is:

triviaDir = HOME + 'Trivia\\' # 'E:\\kaleidascrape\\Trivia\\'
triviaTime = int(5) # length of time between Trivia Displays
triviaNum = int(5) # The number of trivia slides to get.
musicDir = HOME + 'music\\' # 'E:\\kaleidascrape\\music\\'
videos_dir = HOME + 'Pre-Show\\' # 'E:\\kaleidascrape\\Pre-Show\\'
videos_num = 0
thx_dir = HOME + 'thx\\' # 'E:\\kaleidascrape\\thx\\'
thx_num = 0
intros_dir = HOME + 'Theatrical Intros\\' # 'E:\\kaleidascrape\\Theatrical Intros\\'
intros_num = 0
dts_dir = HOME + 'dts\\' # 'E:\\kaleidascrape\\dts\\'
dts_num = 0
cartoons_dir = HOME + 'animated shorts\\' # 'E:\\kaleidascrape\\animated shorts\\'
cartoons_num = 0
trailer_dir = HOME + 'Trailers\\' # 'F:\\Trailers\\'
trailer_num = 0
DOWNLOAD_DIR = HOME + 'Trailers\\' # 'F:\\Trailers\\'


- triviaNum is new and change this to the number of slide sets you want..
- PPlay = xbmc.PlayList(2) # Video Playlist set to 1 for xbmc versions after 16/12/06
- I have commented virtually every line of code so you can see what its doing..

Also for your trivia information I have done the following:
- Your directories are read to get the A-B etc information so it knows that it needs to find two matching slides one ending in 'a.jpg' and 'b.jpg'. !Note case is ignored.. This enables you to create new slides ie, you can create a directory called 'A-B-C-D-E-F Mega Slides' this tells the script to look for files ending in a.jpg,b.jpg,c.jpg,d.jpg,e.jpg and f.jpg and that they are part of the same set and should be treated as one slide set..

Hope this all makes sense..

Download it here: http://xbmc-torrrent-controller.googleco...default.py
Server: FreeNas 9 NAS: 6*3TB - Kodi Sql Database
Kodi Systems: Nvidia Shield Pro, G-Box Q (OpenElec), RikoMagic MK802 IV[
Skin: reFocus
Reply
#10
wow, thats awesome. Thanks a lot! I'll try this out soon.
Reply
#11
timdog82001 Wrote:wow, thats awesome. Thanks a lot! I'll try this out soon.

haha I posted my trivia script on AVS last summer for the Coke-slides and am updating the same thing now Smile I just requested the new slide set which has that third "hint" slide you are mentioning. I am re-writing my script, adding a smooth fader, and if I find time ... a gui to allow selecting certain settings like transition time, the trivia key-letter (ex: A,B,C or Q,H,R or whatever), and movie-countdown timer. I'll let you know if I actually get anything done on this Wink
Reply
#12
Ohhh, cool. You might consider teaming up with chunk_1970 on that. I don't know how much more he plans to work on this, but he also seems into the idea of some sort of interface where you could do things like specify directories for the various video types, choose whether to have those videos randomly selected, or to have the same exact video(s) play each time, how long to do the trivia, and so on. Your ideas sound great too. I'm partly thinking about reading up on some python to see if I can implement some of this stuff myself, but that will probably take me a while. I don't really know what I'm doing when it comes to python. I like the idea of the countdown timer during the trivia, but that's probably something that should have an option to turn off or on too. I also like the idea of fading....well maybe. I think it would seem a lot smoother if the video and audio could be made to fade out at the end of the trivia, and also if it coule be made where it didn't show the skin for a second while switch from the trivia to the video, though I don't know if that's possible. Are you MadDuck on xbox-scene and avs? If so, have you gotten the quicktime trailer grabber thing working?? haha
Reply
#13
I just finished adding a how to section to the explanation part at the top of the script, and added a bunch of links to where people can find stuff for all the different categories....I also readded a couple of video categories that I had previously removed. I realize you're working on an update of this, chunk_1970, but I should be able to fairly easily add this stuff to that once you finish that. I can upload it afterwards too if you would like to work off that version instead. I tried to make the descriptions and everything as n00b friendly as humanly possible.

http://www.filefactory.com/file/8b16af/
Reply
#14
Here a newer version:
http://xbmc-torrrent-controller.googleco...scrape.zip

- Configuration is now read from config.xml using module xmlos that I use for my other stuff 'config.xml'. This will enable a config menu to be setup easier.
- All sections now have support for multiple file extensions.
- Music is back to allow subdirectory support.

Have Fun..
Server: FreeNas 9 NAS: 6*3TB - Kodi Sql Database
Kodi Systems: Nvidia Shield Pro, G-Box Q (OpenElec), RikoMagic MK802 IV[
Skin: reFocus
Reply
#15
Awesome, looks great, much cleaner and simpler.

If I wish to add support for more filetypes (such as vob's) can I just add them to the lists in config.xml?

Also, just an idea....Is it possible to make the script automatically check the compile date of xbmc when it first runs, and then automatically adjust the pplay playlist number based on that? I personally have no problem changing it myself, but if other people start using this, I forsee a lot of people wondering why the script doesn't work...
Reply

Logout Mark Read Team Forum Stats Members Help
Help with minor mod of the Kaleidascrape script?!0