[RELEASE] RecentlyAdded Script (RecentlyAdded.py) Recently Added for Skins / Skinners

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
mnegrisoli Offline
Junior Member
Posts: 29
Joined: Jul 2009
Reputation: 0
Location: Brasil / SC
Post: #31
Hummm ... After change, the FanArt for TV Show really appears on backdrop.

However, in the episode thumb too.
That seeems the script read just one picture. I think that I must to search how to use two objects to split the code: one for fanart and another for thumbs ...

It´s complicated ...
I´m go search for another Includes_Last_Added.xml customization that I like ...
find quote
Jezz_X Offline
Team-XBMC Skinner
Posts: 5,289
Joined: Jun 2006
Reputation: 57
Location: Earth
Post: #32
I've been thinking about this lately and have come to a couple of conlusions
1) You can probably do away with <onfocus>Skin.SetBool(Startup)</onfocus> stuff and just run the script straight from startup.xml since the only time you see that is when xbmc starts up
2) this doesn't take into acount manually adding an item to the video library with the Info Key or refreshing a current item if it got scanned wrong (because dialogvideoscan.xml doesn't get called inthose cases)
3) this having to guess whenthe libraries have been updated anoys the crap out of me and I really want a better way to be able to tell that its been updated and thus run the script. Hell I'd even settle for xbmc setting a skin boolean everytime it changes the lib contents so we can check it if true run the script reset it until next time its set.

ronie Wrote:i've been looking for a way to run the RecentlyAdded script in a more 'intelligent' way.
Running it everytime you enter the Home Screen if far from ideal, since many users are complaining it temporary locks up xbmc.
Using the new timer function to run the script every 30 minutes might also be overkill, since i only update my library once every few weeks.

Ideally, the script should only run once at startup and for the rest it should only run if the library has been updated.

To accomplish this, i've made the following changes to DialogMusicScan.xml and DialogVideoScan.xml:
[HTML]
<defaultcontrol>1111</defaultcontrol>
....
<control type="button" id="1111">
<posx>-10</posx>
<posy>-10</posy>
<height>1</height>
<width>1</width>
<texturefocus></texturefocus>
<texturenofocus></texturenofocus>
<onfocus>Skin.SetBool(LibraryUpdated)</onfocus>
</control>
[/HTML]

Next, in Startup.xml add a button to set a 'Startup' boolean:
[HTML]
<defaultcontrol always="true">10</defaultcontrol>
....
<control type="button" id="10">
<onfocus>Skin.SetBool(Startup)</onfocus>
<onfocus>ReplaceWindow(Home)</onfocus>
<texturenofocus>-</texturenofocus>
<texturefocus>-</texturefocus>
</control>
[/HTML]

Finally, in Home.xml add three buttons:
[HTML]
<defaultcontrol always="true">5043</defaultcontrol>
....
<control type="button" id="5043">
<description>visible at startup</description>
<posx>-20</posx>
<posy>-20</posy>
<width>1</width>
<height>1</height>
<texturenofocus>-</texturenofocus>
<texturefocus>-</texturefocus>
<onfocus>XBMC.RunScript(special://skin/scripts/RecentlyAdded.py)</onfocus>
<onfocus>Skin.Reset(Startup)</onfocus>
<onfocus>SetFocus(9000)</onfocus>
<visible>Skin.HasSetting(Startup)</visible>
</control>
<control type="button" id="5043">
<description>visible after library update has finished</description>
<posx>-20</posx>
<posy>-20</posy>
<width>1</width>
<height>1</height>
<texturenofocus>-</texturenofocus>
<texturefocus>-</texturefocus>
<onfocus>XBMC.RunScript(special://skin/scripts/RecentlyAdded.py)</onfocus>
<onfocus>Skin.Reset(LibraryUpdated)</onfocus>
<onfocus>SetFocus(9000)</onfocus>
<visible>!Skin.HasSetting(Startup) + Skin.HasSetting(LibraryUpdated) + !Window.IsVisible(112) + !Window.IsVisible(133)</visible>
</control>
<control type="button" id="5043">
<description>visible in all other cases</description>
<posx>-20</posx>
<posy>-20</posy>
<width>1</width>
<height>1</height>
<texturenofocus>-</texturenofocus>
<texturefocus>-</texturefocus>
<onfocus>SetFocus(9000)</onfocus>
<visible>!Skin.HasSetting(Startup) + [!Skin.HasSetting(LibraryUpdated) | [Skin.HasSetting(LibraryUpdated) + [Window.IsVisible(112) | Window.IsVisible(133)]]]</visible>
</control>
[/HTML]

As far as i can tell this works like a charm, but maybe i've missed something?
Any feedback is appreciated.
find quote
ronie Offline
Team-XBMC Member
Posts: 9,092
Joined: Jan 2009
Reputation: 157
Post: #33
Jezz_X Wrote:I've been thinking about this lately and have come to a couple of conlusions
1) You can probably do away with <onfocus>Skin.SetBool(Startup)</onfocus> stuff and just run the script straight from startup.xml since the only time you see that is when xbmc starts up
true, didn't think of that, but it makes sense.

Jezz_X Wrote:2) this doesn't take into acount manually adding an item to the video library with the Info Key or refreshing a current item if it got scanned wrong (because dialogvideoscan.xml doesn't get called inthose cases)

guess my proposed way isn't perfect after all.
another issue is, the script currently won't run after switching skins in settings > appearance.
i guess xbmc doesn't load startup.xml when you change skins.

there's probably a way to detect if a user switched skins (kinda like the way Aeon does to show the welcome screen) but i haven't looked into it yet.

Jezz_X Wrote:3) this having to guess whenthe libraries have been updated anoys the crap out of me and I really want a better way to be able to tell that its been updated and thus run the script. Hell I'd even settle for xbmc setting a skin boolean everytime it changes the lib contents so we can check it if true run the script reset it until next time its set.

when the script was first released, there was some talk about having this recently added functionality natively supported in xbmc. imo that would be the only reliable way.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-XBMC members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,624
Joined: Aug 2007
Reputation: 91
Location: Eastleigh, UK
Post: #34
ronie Wrote:when the script was first released, there was some talk about having this recently added functionality natively supported in xbmc. imo that would be the only reliable way.
Agreed.
find quote
pre1014 Offline
Senior Member
Posts: 180
Joined: Dec 2003
Reputation: 6
Post: #35
As the title states, having the recentlyadded.py from the qualar mod causes my movie library to not update when i turn on the system. This is on the xbox platform running r24613.
Setting the skin to "HIDE RECENT MOVIES" does not resolve this, however deleting the recentlyadded.py from the skins scripts folder does.

xbmc log:
http://xbmc.pastebin.com/f23a17ace

You can see that it just comes back with a:
Code:
16:00:50 M: 28946432   DEBUG: VIDEO::CVideoInfoScanner::DoScan Skipping dir 'smb://xbox:xbox@SERVTASTIC/DVD/' due to no change
16:00:50 M: 28946432   DEBUG: Hash[movies,smb://xbox:xbox@SERVTASTIC/DVD/]:DB=[],Computed=[]

The library system doesn't seem to calculate a hash because the recentlyadded.py is running.

ANYWAYS; there are also other errors about unreferenced DLLs, but is there any way the python script or skin, or something can be changed to check to see if a library update is being run (or if DialogVideoScan.xml is initiated), and if so to NOT run the recentlyadded.py at that time....because the script is definitely what causes the library to not update like it should (maybe its just python running that is causing it though).

not sure where I am supposed to put this so it can be moved to the "unsupported" xbox specific section if needed.
(This post was last modified: 2009-12-27 00:39 by pre1014.)
find quote
pre1014 Offline
Senior Member
Posts: 180
Joined: Dec 2003
Reputation: 6
Post: #36
The above example i addes "Shreck 2 (2004).iso" to my movie folder, but the system didn't see it or update it. removing the recenlyadded.py and rebooting the xbox caused the system to see it and update the library correctly. rebooting again shows how the system would normally calcluate the hash:
Code:
16:26:29 M: 28737536   DEBUG: VIDEO::CVideoInfoScanner::DoScan Rescanning dir 'smb://xbox:xbox@SERVTASTIC/DVD/' due to change
16:26:29 M: 28762112   DEBUG: Hash[movies,smb://xbox:xbox@SERVTASTIC/DVD/]:DB=[9367F46C23A0ACD23786EFBA326E2D47],Computed=[]
find quote
ijourneaux Offline
Fan
Posts: 521
Joined: Mar 2009
Reputation: 3
Location: Wisconsin, USA
Post: #37
I am runing a SVN 26903 with Transparency 2.11. I get the following script error when ever XBMC is launched. DOes anyone have the required correction to the script? Perhaps the fix is in the Transparency SVN?

12:13:55 T:2664 M:1433468928 NOTICE: -->Python Interpreter Initialized<--
12:13:56 T:2664 M:1426853888 ERROR: Error Type: exceptions.IndexError
12:13:56 T:2664 M:1426853888 ERROR: Error Contents: list index out of range
12:13:56 T:2664 M:1426718720 ERROR: Traceback (most recent call last):
File "C:\Program Files\XBMC\skin\Transparency!\scripts\RecentlyAdded.py", line 260, in ?
Main()
File "C:\Program Files\XBMC\skin\Transparency!\scripts\RecentlyAdded.py", line 71, in __init__
self._fetch_totals()
File "C:\Program Files\XBMC\skin\Transparency!\scripts\RecentlyAdded.py", line 133, in _fetch_totals
self.WINDOW.setProperty( "TVShows.Watched" , tvshows_totals[ 2 ] or "" )
IndexError: list index out of range
find quote
amet Offline
How do ya like them apples?
Posts: 4,083
Joined: Jul 2009
Reputation: 39
Location: Novi Sad / Dubai
Post: #38
ijourneaux Wrote:I am runing a SVN 26903 with Transparency 2.11. I get the following script error when ever XBMC is launched. DOes anyone have the required correction to the script? Perhaps the fix is in the Transparency SVN?

12:13:55 T:2664 M:1433468928 NOTICE: -->Python Interpreter Initialized<--
12:13:56 T:2664 M:1426853888 ERROR: Error Type: exceptions.IndexError
12:13:56 T:2664 M:1426853888 ERROR: Error Contents: list index out of range
12:13:56 T:2664 M:1426718720 ERROR: Traceback (most recent call last):
File "C:\Program Files\XBMC\skin\Transparency!\scripts\RecentlyAdded.py", line 260, in ?
Main()
File "C:\Program Files\XBMC\skin\Transparency!\scripts\RecentlyAdded.py", line 71, in __init__
self._fetch_totals()
File "C:\Program Files\XBMC\skin\Transparency!\scripts\RecentlyAdded.py", line 133, in _fetch_totals
self.WINDOW.setProperty( "TVShows.Watched" , tvshows_totals[ 2 ] or "" )
IndexError: list index out of range

I have seen this before, only way I was able to fix is to rebuild the database.

Backup/remove your MyVideos34.db and XBMC will rebuild it.

Zeljko


Always read the XBMC_Online_Manual,Frequently_Asked_Questions and search the forum before posting.
For troubleshooting and bug reporting use -> Log_file.
find quote
ijourneaux Offline
Fan
Posts: 521
Joined: Mar 2009
Reputation: 3
Location: Wisconsin, USA
Post: #39
Thanks for the tip. I will have to time doing that as I am guessing the rebuilding will take some time when you have many movies.

Take Care
find quote
ronie Offline
Team-XBMC Member
Posts: 9,092
Joined: Jan 2009
Reputation: 157
Post: #40
could you try if cleaning the library will fix it?
Settings > Videos > Library > Clean Library...


if not, see post above ;-)

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-XBMC members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
ijourneaux Offline
Fan
Posts: 521
Joined: Mar 2009
Reputation: 3
Location: Wisconsin, USA
Post: #41
I will try that when I have a chance and get back to the forum
find quote
rudeboyx Offline
Posting Freak
Posts: 750
Joined: Dec 2007
Reputation: 0
Location: Burnley, UK
Post: #42
i have had this problem a few times. I just replace the recentlyadded.py file in the skins script folder with a fresh one and it fixes the problem for me. iv had to do this 3 times now. it works fine one day. then the next it fails on every boot. so i delete and replace the .py file. and it boots up fine next time. for some reason it gets corrupted. dont know if its my xbox or if the weather plugin has a effect on boot. iv dissabled the weather plugin and am going to monitor for now. i'll keep you posted

PS. I never had to rebuild my library to fix this problem. however i do occasionally rebuild my library for maximum compatability with SVN release's.
find quote
thewillum Offline
Junior Member
Posts: 19
Joined: Jan 2010
Reputation: 0
Post: #43
Is it possible to have "LatestEpisode.#.Thumb" grab a TV show's Season thumb instead of the episode screenshot thumb? Is this a change that would have to be made in the skin or the script?
find quote
charrua Offline
Senior Member
Posts: 273
Joined: Nov 2008
Reputation: 14
Post: #44
As I'd posted before the forum db corruption, the view tvshowview doesn't exist in the db anymore since svn r28114.
You should update the queries in RecentlyAdded.py that use that view.

If anybody is interested, I already modified the script not to use tvshowview.
Here is the link to download the updated version:
RecentlyAdded.py
(This post was last modified: 2010-03-18 18:04 by charrua.)
find quote
redtapemedia Offline
UMM Project
Posts: 551
Joined: Mar 2009
Post: #45
Is there any way to show the items added only in the last "x" number of hours? Sort of a "New for today" type thing. I have a feeling that it isn't because I seem to remember someone saying the DB doesn't have a date / time added field?
find quote
Post Reply