- xbs08 - 2009-06-25
skunkm0nkee Wrote:Great idea, might see how this looks in MiniMeedia later too ![Nod Nod](https://forum.kodi.tv/images/smilies/yes4lo.gif)
Can't wait to see this in MM
- CF2009 - 2009-06-25
thanks for the script nuka
i have added some lines to the code to get tv shows names,but as is my 1st time playing with scripts it's i'm not 100% sure if it's the best way to do it...
Code: import xbmc
from xbmcgui import Window
from urllib import quote_plus
import re
# limit number to
RECENT_NUMBER = 4
# grab the home window
WINDOW = Window( 10000 )
# sql statements
sql_movies = "select * from movieview order by idMovie desc limit %d" % ( RECENT_NUMBER, )
sql_episodes = "select * from episodeview order by idepisode desc limit %d" % ( RECENT_NUMBER, )
# format our records start and end
xbmc.executehttpapi( "SetResponseFormat(OpenRecord,%s)" % ( "<record>", ) )
xbmc.executehttpapi( "SetResponseFormat(CloseRecord,%s)" % ( "</record>", ) )
# query the database
movies_xml = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( sql_movies ), )
episodes_xml = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( sql_episodes ), )
# separate the records
movies = re.findall( "<record>(.+?)</record>", movies_xml, re.DOTALL )
episodes = re.findall( "<record>(.+?)</record>", episodes_xml, re.DOTALL )
# enumerate thru our records and set our properties
for count, movie in enumerate( movies ):
# separate individual fields
fields = re.findall( "<field>(.*?)</field>", movie, re.DOTALL )
# set title
WINDOW.setProperty( "LatestMovie.%d.Label" % ( count + 1, ), fields[ 1 ] )
# set year
WINDOW.setProperty( "LatestMovie.%d.Label2" % ( count + 1, ), fields[ 8 ] )
# set running time (uncomment below if you want running time for label2)
#WINDOW.setProperty( "LatestMovie.%d.Label2" % ( count + 1, ), fields[ 12 ] )
# set path
WINDOW.setProperty( "LatestMovie.%d.OnClick" % ( count + 1, ), fields[ 24 ] + fields[ 23 ] )
# set thumbnail
thumbnail = xbmc.getCacheThumbName( fields[ 24 ] + fields[ 23 ] )
WINDOW.setProperty( "LatestMovie.%d.Thumb" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( thumbnail[ 0 ], thumbnail, ) )
# enumerate thru our records and set our properties
for count, episode in enumerate( episodes ):
# separate individual fields
fields = re.findall( "<field>(.*?)</field>", episode, re.DOTALL )
# set title
WINDOW.setProperty( "LatestEpisode.%d.Label" % ( count + 1, ), fields[ 1 ] )
[b] # get tvshow name
tvname_xml = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( "select tvshow.c%02d from tvshow,tvshowlinkepisode where tvshowlinkepisode.idepisode=%d and tvshowlinkepisode.idshow=tvshow.idshow" % ( 0, int( fields[ 0 ] ), ) ), )
tvname = tvname_xml.replace('<record><field>','')
tvname = tvname.replace('</field></record>','')[/b]
# set season/episode
WINDOW.setProperty( "LatestEpisode.%d.Label2" % ( count + 1, ), [b]tvname +[/b] " - s%02de%02d" % ( int( fields[ 13 ] ), int( fields[ 14 ] ), ) )
# set path
WINDOW.setProperty( "LatestEpisode.%d.OnClick" % ( count + 1, ), fields[ 24 ] + fields[ 23 ] )
# set thumbnail
thumbnail = xbmc.getCacheThumbName( fields[ 24 ] + fields[ 23 ] )
WINDOW.setProperty( "LatestEpisode.%d.Thumb" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( thumbnail[ 0 ], thumbnail, ) )
- Nuka1195 - 2009-06-25
so skinners are interested.
i can add more info. looks like jezz added showtitle already cf2009. so i can add any info skinners want.
i can put this in the svn once skinners decide what all info you want.
it would be best to name them according to their info.
so far i have
PHP Code: # enumerate thru our records and set our properties for count, movie in enumerate( movies ): # separate individual fields fields = re.findall( "<field>(.*?)</field>", movie, re.DOTALL ) # set title WINDOW.setProperty( "LatestMovie.%d.Title" % ( count + 1, ), fields[ 1 ] ) # set year WINDOW.setProperty( "LatestMovie.%d.Year" % ( count + 1, ), fields[ 8 ] ) # set running time WINDOW.setProperty( "LatestMovie.%d.RunningTime" % ( count + 1, ), fields[ 12 ] ) # set path WINDOW.setProperty( "LatestMovie.%d.Path" % ( count + 1, ), fields[ 24 ] + fields[ 23 ] ) # set cached thumb name cache_name = xbmc.getCacheThumbName( fields[ 24 ] + fields[ 23 ] ) # set fanart WINDOW.setProperty( "LatestMovie.%d.Fanart" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( "Fanart", cache_name, ) ) # set thumbnail WINDOW.setProperty( "LatestMovie.%d.Thumb" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( cache_name[ 0 ], cache_name, ) ) # enumerate thru our records and set our properties for count, episode in enumerate( episodes ): # separate individual fields fields = re.findall( "<field>(.*?)</field>", episode, re.DOTALL ) # set show title WINDOW.setProperty( "LatestEpisode.%d.ShowTitle" % ( count + 1, ), fields[ 27 ] ) # set episode title WINDOW.setProperty( "LatestEpisode.%d.EpisodeTitle" % ( count + 1, ), fields[ 1 ] ) # set season/episode WINDOW.setProperty( "LatestEpisode.%d.EpisodeNo" % ( count + 1, ), "s%02de%02d" % ( int( fields[ 13 ] ), int( fields[ 14 ] ), ) ) # set path WINDOW.setProperty( "LatestEpisode.%d.Path" % ( count + 1, ), fields[ 24 ] + fields[ 23 ] ) # set cached thumb name cache_name = xbmc.getCacheThumbName( fields[ 24 ] + fields[ 23 ] ) # set fanart WINDOW.setProperty( "LatestEpisode.%d.Fanart" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( "Fanart", cache_name, ) ) # set thumbnail WINDOW.setProperty( "LatestEpisode.%d.Thumb" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( cache_name[ 0 ], cache_name, ) )
here is the info available with correspomding number. not sure what all fields are.
movies
PHP Code: <record> 0 <field>9</field> 1 <field>Valkyrie</field> 2 <field>In Nazi Germany during World War II, as the tide turned in favor of The Allies, a cadre of senior German officers and politicians desperately plot to topple the Nazi regime before the nation is crushed in a near-inevitable defeat. To this end, Colonel Claus von Stauffenberg, an Army officer convinced he must save Germany from Hitler, is recruited to mastermind a real plan. To do so, he arranges for the internal emergency measure, Operation: Valkyrie, to be changed to enable his fellows to seize control of Berlin after the assassination of the Fuhrer. However, even as the plan is put into action, a combination of bad luck and human failings conspire on their own to create a tragedy that would prolong the greater one gripping Europe.</field> 3 <field>Based on actual events, a plot to assassinate Hitler is unfurled during the height of WWII.</field> 4 <field>Many saw evil. They dared to stop it.</field> 5 <field>32,676</field> 6 <field>7.400000</field> 7 <field>Christopher McQuarrie / Nathan Alexander</field> 8 <field>2008</field> 9 <field> <thumbs> <thumb>http://www.impawards.com/2008/posters/valkyrie.jpg</thumb> <thumb>http://www.impawards.com/2008/posters/valkyrie_ver2.jpg</thumb> <thumb>http://www.impawards.com/2008/posters/valkyrie_ver3.jpg</thumb> <thumb>http://www.impawards.com/2008/posters/valkyrie_ver4.jpg</thumb> <thumb>http://www.impawards.com/2008/posters/valkyrie_ver5.jpg</thumb> <thumb>http://ia.media-imdb.com/images/M/MV5BMTI3NTI4MDgyNl5BMl5BanBnXkFtZTcwNjM5OTU5MQ@@._V1._SX512_SY512_.jpg</thumb> </thumbs> </field> 10 <field>tt0985699</field> 11 <field></field> 12 <field>121 min</field> 13 <field>Rated PG-13 for violence and brief strong language.</field> 14 <field>0</field> 15 <field>Drama / History / Thriller / War</field> 16 <field>Bryan Singer</field> 17 <field></field> 18 <field></field> 19 <field>United Artists</field> 20 <field>rtmp://amazonimdb.fcod.llnwd.net/a2643/o25/s/theaters/MV5/BMT/M0N/DMw/MV5BMTM0NDMwMzg4N15BNl5BZmx2XkFtZTcwNDUyOTMwMg4040?e=1245286464&h=04b7d0d4f46ccf3a39ad863ad4645859</field> 21 <field> <fanart url="http://themoviedb.org/image/backdrops"> <thumb preview="/24854/Valkyrie_poster.jpg">/24854/Valkyrie.jpg</thumb> <thumb preview="/28025/Valkyrie-fanart_poster.jpg">/28025/Valkyrie-fanart.jpg</thumb> <thumb preview="/39356/Valkryie_poster.jpg">/39356/Valkryie.jpg</thumb> <thumb preview="/45872/valkyrie_art_poster.jpg">/45872/valkyrie_art.jpg</thumb> </fanart> </field> 22 <field>76</field> 23 <field>Valkyrie (2008).avi</field> 24 <field>smb://MEDIANAS/Public/Shared Videos/Movies/Valkyrie (2008)/</field> 25 <field></field> 26 <field></field> </record>
tvshows
PHP Code: <record> 0 <field>17</field> 1 <field>Cause and Effect</field> 2 <field>When the Sheriff of Nottingham decides to sell all the local men to Finn, the rightful King of Ireland (who seeks to liberate Ireland), a young village girl named Kate does everything she can to save her brother from conscription- which involves betraying Robin... </field> 3 <field></field> 4 <field>0.000000</field> 5 <field></field> 6 <field>2009-04-04</field> 7 <field> <thumb>http://www.thetvdb.com/banners/</thumb> </field> 8 <field></field> 9 <field></field> 10 <field></field> 11 <field></field> 12 <field></field> 13 <field>3</field> 14 <field>2</field> 15 <field></field> 16 <field>-1</field> 17 <field>-1</field> 18 <field>-1</field> 19 <field></field> 20 <field></field> 21 <field></field> 22 <field>27</field> 23 <field>Robin.Hood.S03E02.avi</field> 24 <field>smb://192.168.1.200/Public/Shared Videos/TV Shows/Robin Hood/Season 3/</field> 25 <field></field> 26 <field></field> 27 <field>Robin Hood</field> 28 <field></field> 29 <field>2</field> 30 <field>2006-10-07</field> </record>
- CF2009 - 2009-06-25
Nuka1195 Wrote:so skinners are interested.
i can add more info. looks like jezz added showtitle already cf2009. so i can add any info skinners want.
i can put this in the svn once skinners decide what all info you want.
it would be best to name them according to their info. Music?
- Nuka1195 - 2009-06-25
untested
PHP Code: import xbmc from xbmcgui import Window from urllib import quote_plus import re # limit number to RECENT_NUMBER = 5 # grab the home window WINDOW = Window( 10000 ) # sql statements sql_movies = "select * from movieview order by idMovie desc limit %d" % ( RECENT_NUMBER, ) sql_episodes = "select * from episodeview order by idepisode desc limit %d" % ( RECENT_NUMBER, ) sql_song = "select songview.* from albumview join songview on (songview.idAlbum = albumview.idAlbum) where albumview.idalbum in (select idAlbum from albumview order by idAlbum desc limit %d)" % ( RECENT_NUMBER, ) # format our records start and end xbmc.executehttpapi( "SetResponseFormat(OpenRecord,%s)" % ( "<record>", ) ) xbmc.executehttpapi( "SetResponseFormat(CloseRecord,%s)" % ( "</record>", ) ) # query the databases movies_xml = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( sql_movies ), ) episodes_xml = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( sql_episodes ), ) songs_xml = xbmc.executehttpapi( "QueryMusicDatabase(%s)" % quote_plus( sql_song ), ) # separate the records movies = re.findall( "<record>(.+?)</record>", movies_xml, re.DOTALL ) episodes = re.findall( "<record>(.+?)</record>", episodes_xml, re.DOTALL ) songs = re.findall( "<record>(.+?)</record>", songs_xml, re.DOTALL ) # enumerate thru our records and set our properties for count, movie in enumerate( movies ): # separate individual fields fields = re.findall( "<field>(.*?)</field>", movie, re.DOTALL ) # set title WINDOW.setProperty( "LatestMovie.%d.Title" % ( count + 1, ), fields[ 1 ] ) # set year WINDOW.setProperty( "LatestMovie.%d.Year" % ( count + 1, ), fields[ 8 ] ) # set running time WINDOW.setProperty( "LatestMovie.%d.RunningTime" % ( count + 1, ), fields[ 12 ] ) # set path WINDOW.setProperty( "LatestMovie.%d.Path" % ( count + 1, ), fields[ 24 ] + fields[ 23 ] ) # set cached thumb name cache_name = xbmc.getCacheThumbName( fields[ 24 ] + fields[ 23 ] ) # set fanart WINDOW.setProperty( "LatestMovie.%d.Fanart" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( "Fanart", cache_name, ) ) # set thumbnail WINDOW.setProperty( "LatestMovie.%d.Thumb" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( cache_name[ 0 ], cache_name, ) ) # enumerate thru our records and set our properties for count, episode in enumerate( episodes ): # separate individual fields fields = re.findall( "<field>(.*?)</field>", episode, re.DOTALL ) # set show title WINDOW.setProperty( "LatestEpisode.%d.ShowTitle" % ( count + 1, ), fields[ 27 ] ) # set episode title WINDOW.setProperty( "LatestEpisode.%d.EpisodeTitle" % ( count + 1, ), fields[ 1 ] ) # set season/episode WINDOW.setProperty( "LatestEpisode.%d.EpisodeNo" % ( count + 1, ), "s%02de%02d" % ( int( fields[ 13 ] ), int( fields[ 14 ] ), ) ) # set path WINDOW.setProperty( "LatestEpisode.%d.Path" % ( count + 1, ), fields[ 24 ] + fields[ 23 ] ) # set cached thumb name cache_name = xbmc.getCacheThumbName( fields[ 24 ] + fields[ 23 ] ) # set fanart WINDOW.setProperty( "LatestEpisode.%d.Fanart" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( "Fanart", cache_name, ) ) # set thumbnail WINDOW.setProperty( "LatestEpisode.%d.Thumb" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( cache_name[ 0 ], cache_name, ) ) # enumerate thru our records and set our properties for count, movie in enumerate( songs ): # separate individual fields fields = re.findall( "<field>(.*?)</field>", movie, re.DOTALL ) # set title WINDOW.setProperty( "LatestSong.%d.Title" % ( count + 1, ), fields[ 3 ] ) # set year WINDOW.setProperty( "LatestSong.%d.Year" % ( count + 1, ), fields[ 6 ] ) # set artist WINDOW.setProperty( "LatestSong.%d.Artist" % ( count + 1, ), fields[ 24 ] ) # set album WINDOW.setProperty( "LatestSong.%d.Album" % ( count + 1, ), fields[ 21 ] ) # set path WINDOW.setProperty( "LatestSong.%d.Path" % ( count + 1, ), fields[ 22 ] + fields[ 8 ] ) # set fanart ##WINDOW.setProperty( "LatestSong.%d.Fanart" % ( count + 1, ), "special://profile/Thumbnails/Video/%s/%s" % ( "Fanart", cache_name, ) ) # set thumbnail WINDOW.setProperty( "LatestSong.%d.Thumb" % ( count + 1, ), fields[ 27 ] )
PHP Code: <record> 0 <field>5</field> 1 <field></field> 2 <field></field> 3 <field>"Highway Blues"</field> 4 <field>1</field> 5 <field>96</field> 6 <field>1999</field> 7 <field>1970653482l</field> 8 <field>New Stories (Highway Blues).wma</field> 9 <field></field> 10 <field></field> 11 <field></field> 12 <field></field> 13 <field></field> 14 <field>0</field> 15 <field>0</field> 16 <field>0</field> 17 <field></field> 18 <field>0</field> 19 <field></field> 20 <field>5</field> 21 <field>Speakin' Out</field> 22 <field>E:\Profiles\All Users\Documents\My Music\Sample Music\</field> 23 <field>7</field> 24 <field>Marc Seales, composer. New Stories. Ernie Watts, saxophone.</field> 25 <field>6</field> 26 <field>Jazz</field> 27 <field>special://masterprofile/Thumbnails/Music/6/6fd595cb.tbn</field> 28 <field></field> 29 <field></field> 30 <field></field> </record>
- Nuka1195 - 2009-06-25
it may be possible to use unfinished movies or tv shows with the proper query.
changed properties and added artist to latest songs
- skunkm0nkee - 2009-06-25
Great stuff Nukka, thanks for this
- Nuka1195 - 2009-06-25
PHP Code: sql_movies = "select movieview.*, bookmark.timeInSeconds from movieview join bookmark on (movieview.idFile = bookmark.idFile) order by movieview.c00 limit %d" % ( RECENT_NUMBER, )
that returns a list of movies that are unfinished. i set the same properties, so it is not an issue.
so i need to know how skinners wish to determine which list the script should return.
i can add script settings or skinners could add a skin setting that i can check. the issue with skin setting is you're probably limited to a bool, which means only two types of sources. the issue with script settings is the script would have to be in the scripts window unless the skinner has a setting that calls the script with a parameter. then the script can open the settings.
np skunkmonkee, i'm glad skinners are using this, i like the idea.
- pilluli - 2009-06-25
Jezz_X Wrote:This works really well nuka I had a quick play and its easy to get this sort of thing
http://img261.imageshack.us/img261/129/screenshot050c.jpg
I think that looks really cool
jezz_x, did you actually implemented it from the code above?? pleaaassee share the skin code!! ![Rolleyes Rolleyes](https://forum.kodi.tv/images/smilies/eyeroll.png)
nuka many thanks for the script, i might give it a try later this week!
- rwparris2 - 2009-06-25
Jezz_X Wrote:This works really well nuka I had a quick play and its easy to get this sort of thing
http://img261.imageshack.us/img261/129/screenshot050c.jpg
Sexay.
Is any of that stuff selectable?
- skunkm0nkee - 2009-06-25
rwparris2 Wrote:Sexay.
Is any of that stuff selectable?
Yep, selecting an item should start it playing
I've just released a new version of MiniMeedia, it hasn't made it into this release but I have got some code up and running so it should be in the next release. I just needa a bit more time to perfect and polish how it looks and fits in with the rest of the Home screen.
Nice idea dt1000 and nice python coding Nuka (btw I would think that passing a parameter to the script would probably be the most flexible way to call it?)
- dt1000 - 2009-06-25
Wow...
That's pretty impressive stuff. Nice job, Nuka. Thanks very much.
I'll try to integrate it into my MediaStream Hack tonight.
Questions:
How do I run the script and what code do I need to add to the skin?
Jezz_X, could you share your method please? (I prefer it to my original design - excellent work!)
Suggestions:
My original intention was that this list would not display watched items.
Is there a way to filter the data so it only contains unwatched media?
Also, I would love Latest TV to be grouped by series. That way, for example, if you have just added two episodes of, say, Dexter, it will show you the first of the two only, and then any other new series beneath it.
This way it would avoid cluttering the menu with multiple episodes from the same season when all you should be interested in is the first unwatched one.
I have to say that i am well impressed at how quickly you guys have turned a rough concept into an actionable implementation. I can't wait to get it working. Great stuff, everyone!
Request for this functionality to be supported nativly via XBMC's skinning-engine? - Gamester17 - 2009-06-25
Is there anyway to get this supported nativly in XBMC's skinning-engine, without using python?
Someone submit a request on trac for it? ![Huh Huh](https://forum.kodi.tv/images/smilies/question.png)
...I got nothing against python for plugins/script, but skins should IMHO not need to use python.
- Jezz_X - 2009-06-26
rwparris2 Wrote:Sexay.
Is any of that stuff selectable? It can be but the version I did is not (was only a quick test after all)
dt1000 Wrote:Wow...
How do I run the script and what code do I need to add to the skin?
Jezz_X, could you share your method please? (I prefer it to my original design - excellent work!) I added a dummy default control to the home window that ran the script each time the window opened And I added a dummy one a well not to run it based on a skin condition
PHP Code: <control type="button" id="8999"> <description>Run Recently added</description> <posx>-20</posx> <posy>-20</posy> <width>1</width> <height>1</height> <label>-</label> <font>-</font> <onfocus>XBMC.RunScript(special://skin/scripts/recentadded.py)</onfocus> <onfocus>SetFocus(9000)</onfocus> <texturenofocus>-</texturenofocus> <texturefocus>-</texturefocus> <visible>!Skin.HasSetting(homepageShowRecentlyAdded)</visible> </control> <control type="button" id="8999"> <description>Don't run Recently added</description> <posx>-20</posx> <posy>-20</posy> <width>1</width> <height>1</height> <label>-</label> <font>-</font> <onfocus>SetFocus(9000)</onfocus> <texturenofocus>-</texturenofocus> <texturefocus>-</texturefocus> <visible>Skin.HasSetting(homepageShowRecentlyAdded)</visible> </control>
note in this case <onfocus>SetFocus(9000)</onfocus> is the main menu of my Mediastream. but the window points to always="true" 8999
The disadvantage of this is if you have "Update the Library on startup" turned on the info may be out of date until you exit and enter the home screen (causing the script to run again)
- dt1000 - 2009-06-26
OK, so I got it working...
![Full sized picture Image](http://www.mediafire.com/imgbnc.php/e4ad7c3b92e789ba4e18932f92c52c966g.jpg)
It took me a while to get the script to fire so I've only had time to do a panel for movies. I ended up just including it in the autoexec script.
Once I get Movies perfect I'll duplicate it for TV.
You can click on the movie names to play them, no problem, although I've noticed that the auto-resume functionality doesn't work. If anyone has any tips on that I'd appreciate it...
Also, the image scaling on the Fanart is really poor quality - maximum jaggies. Is there anything I can do to make it a little better?
Will have some more input in the morning. Must... get... some... sleep...
|