Kodi Community Forum
[RELEASE] RecentlyAdded Script (RecentlyAdded.py) Recently Added for Skins / Skinners - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+---- Forum: Skin helper addons (https://forum.kodi.tv/forumdisplay.php?fid=300)
+---- Thread: [RELEASE] RecentlyAdded Script (RecentlyAdded.py) Recently Added for Skins / Skinners (/showthread.php?tid=55907)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14


- mnegrisoli - 2009-11-11

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 ...


- Jezz_X - 2009-11-14

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.



- ronie - 2009-11-14

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.


- Hitcher - 2009-11-14

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.


(bug) recentlyadded.py causes library to not update - pre1014 - 2009-12-27

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.


- pre1014 - 2009-12-27

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=[]



Script Failed: RecentlyAdded.py - ijourneaux - 2010-01-17

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


- amet - 2010-01-17

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


- ijourneaux - 2010-01-17

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


- ronie - 2010-01-17

could you try if cleaning the library will fix it?
Settings > Videos > Library > Clean Library...


if not, see post above ;-)


- ijourneaux - 2010-01-18

I will try that when I have a chance and get back to the forum


- rudeboyx - 2010-01-19

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.


Change Episode Thumb to Seasons? - thewillum - 2010-01-22

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?


- charrua - 2010-03-18

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


- seedzero - 2010-03-19

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?