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

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Thumbs Up  [RELEASE] RecentlyAdded Script (RecentlyAdded.py) Recently Added for Skins / Skinners
Post: #1
Here is a new version of RecentlyAdded.py

http://xbmc-addons.googlecode.com/svn/pa...lyAdded.py

*new: "alarm" parameter.
most skins run this script whenever you enter home. with the new alarm parameter, if you have a control in home.xml to execute the script, you can set <defaultcontrol always="false"> then the script does not have to run everytime you enter home. if you can have the control in startup.xml. the bad thing about startup.xml, if you have a setting to enable this. you will have to restart xbmc once enabled.

you can pass the following optional parameters:
PHP Code:
limit=#                ; # to limit returned results (default=5)
partial=True         True to returned only items unfinished (default=False)
albums=True        True to return albums instead of songs (default=False)
unplayed=True      True to return only items that have not been played (default=False)
totals=True          True to return database totals (default=False)
trailer=True          True to play the trailer (if available) (default=False)
alarm=#              ; every # minutes run script (default=0, no alarm) 

* when alums=True, only one song is still played (developers any help)

separate parameters with "&amp;" minus quotes

example (the setproperty and visible is for aeon, when the main menu loses focus control 8999 can gain focus with navigating. you skin may not need this):
PHP Code:
<defaultcontrol always="false">8999</defaultcontrol>
 
 
        <
control type="button" id="8999">
            <
posx>-100</posx>
            <
posy>-100</posy>
            <
width>0</width>
            <
height>0</height>
   <
onfocus>XBMC.RunScript(special://skin/extras/RecentlyAdded.py,limit=5&amp;alarm=30&amp;albums=True&amp;unplayed=True&amp;totals=$INFO[Skin.HasSetting(WidgetLatestAddedTotals)])</onfocus>
            
<onfocus>SetFocus(300)</onfocus>
        </
control


properties available:

totals:
PHP Code:
"Movies.Count"
"Movies.Watched"
"Movies.UnWatched"
"Movies.LastWatchedTitle"
"Movies.LastWatchedYear"
"Movies.LastWatchedRuntime"
"Movies.LastWatchedGenre"
"Movies.LastWatchedDate"
 
"MusicVideos.Count"
"MusicVideos.Watched"
"MusicVideos.UnWatched"
 
"TVShows.Count"
"TVShows.Watched"
"TVShows.UnWatched"
"Episodes.Count"
"Episodes.Watched"
"Episodes.UnWatched"
 
"Music.SongsCount"
"Music.AlbumsCount"
"Music.ArtistsCount" 

movies %d=1 to LIMIT:
PHP Code:
"LatestMovie.%d.Title"
"LatestMovie.%d.Rating"
"LatestMovie.%d.Year"
"LatestMovie.%d.RunningTime"
"LatestMovie.%d.Path"
"LatestMovie.%d.Trailer"
"LatestMovie.%d.Fanart"
"LatestMovie.%d.Thumb" 

tv shows %d=1 to LIMIT:
PHP Code:
"LatestEpisode.%d.ShowTitle"
"LatestEpisode.%d.EpisodeTitle"
"LatestEpisode.%d.EpisodeNo"
"LatestEpisode.%d.Rating"
"LatestEpisode.%d.Path"
"LatestEpisode.%d.Fanart"
"LatestEpisode.%d.Thumb" 

music %d=1 to LIMIT:
PHP Code:
"LatestSong.%d.Title"
"LatestSong.%d.Year"
"LatestSong.%d.Artist"
"LatestSong.%d.Album"
"LatestSong.%d.Path"
"LatestSong.%d.Fanart"
"LatestSong.%d.Thumb" 

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
(This post was last modified: 2009-08-06 19:55 by Nuka1195.)
find quote
FourTwentySmilz Offline
Fan
Posts: 356
Joined: Jul 2008
Reputation: 0
Location: N. Carolina
Post: #2
So if I replace the recently_added.py i already have, with this one it should work fine without me having to change code in my Home.xml?
find quote
Jezz_X Offline
Team-XBMC Skinner
Posts: 5,289
Joined: Jun 2006
Reputation: 57
Location: Earth
Post: #3
got to admit I'm confused too you saying we don't have to run it anymore ? or that we still have to run it but the script decides if it needs to bother updating or not ?
find quote
ronie Offline
Team-XBMC Member
Posts: 9,097
Joined: Jan 2009
Reputation: 157
Post: #4
you're not alone. ;-)

if i use alarm=30, does this counter keep running if i navigate away from the homescreen?
or does it only update the recently added stuff if you stay on the homepage for half an hour?

edit:
i also can't seem to see the logic in this:
Code:
<onfocus>SetProperty(LastAddedRun,1)</onfocus>
<visible>IsEmpty(Window(Home).Property(LastAddedRun))</visible>

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.
(This post was last modified: 2009-08-06 00:12 by ronie.)
find quote
Jezz_X Offline
Team-XBMC Skinner
Posts: 5,289
Joined: Jun 2006
Reputation: 57
Location: Earth
Post: #5
I think it means that you just run it once in startup.xml for example and then it sets a xbmc internal alarm to rerun the script every X amount of minutes if you have it set.

I wonder what effect this would have if it decided to fire off the script while your using another like the full AMT script (since I heard about issues running 2 scripts at once)
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #6
no the script doesn't decide. the script starts an AlarmClock()

you still need to run the script "once". if you pass alarm=30, then the script will run every 30 minutes. so then there is no need to run it everytime you enter the home menu. (which i don't like). you enter movies back out and the script runs again.

as i said in the first post you can set always="false" for you're control so it only runs once. right?

was the example not clear?

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Jezz_X Offline
Team-XBMC Skinner
Posts: 5,289
Joined: Jun 2006
Reputation: 57
Location: Earth
Post: #7
ronie Wrote:you're not alone. ;-)

if i use alarm=30, does this counter keep running if i navigate away from the homescreen?
or does it only update the recently added stuff if you stay on the homepage for half an hour?

edit:
i also can't seem to see the logic in this:
Code:
<onfocus>SetProperty(LastAddedRun,1)</onfocus>
<visible>IsEmpty(Window(Home).Property(LastAddedRun))</visible>

This is just the way to launch it and he then sets a variable to say its been launched
<onfocus>SetProperty(LastAddedRun,1)</onfocus>
and hides the launcher because its allready been launched so you wont launch it again
<visible>IsEmpty(Window(Home).Property(LastAddedRun))</visible>
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #8
jmasrshall, was to apply a patch for that jezz. i have it in my builds and don't have any issues.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #9
you could launch it from autoexec.py with the params also.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #10
yes jezz in aeon that control can gain focus again if i lose focus by bumping the mouse. then try and navigate to the menu with the keyboard.

probably with proper skinning it isn't needed.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
ronie Offline
Team-XBMC Member
Posts: 9,097
Joined: Jan 2009
Reputation: 157
Post: #11
Nuka1195 Wrote:no the script doesn't decide. the script starts an AlarmClock()

you still need to run the script "once". if you pass alarm=30, then the script will run every 30 minutes. so then there is no need to run it everytime you enter the home menu. (which i don't like). you enter movies back out and the script runs again.

as i said in the first post you can set always="false" for you're control so it only runs once. right?

yup, i got that one.

Nuka1195 Wrote:was the example not clear?

it's the 'plus if your in home it will update automatically' bit that got me confused.
i was unsure if the alarmclock kept running once you navigate away from home.

thanx for the explanation Nuka1195, and for all the neat scripts you've been releasing lately.

cheers.

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
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #12
upon re-reading. the first post wasn't very clear.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
emal011 Offline
Senior Member
Posts: 200
Joined: Nov 2008
Reputation: 0
Location: Munich
Post: #13
I already made the update, and not works!

Pytho Script Failed:
skin/extras/recentlyadded.py


I just made the update von SVN and Aeon Hitcher...
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,633
Joined: Aug 2007
Reputation: 91
Location: Eastleigh, UK
Post: #14
Just to clarify things a bit, some people are getting an error using my mod and the latest added script. Everything works great for me (Windows) so I'm wondering if it's a Linux problem.

All I've done is add the Hide Unwatched and Totals conditions -
Code:
<onfocus>XBMC.RunScript(special://skin/extras/RecentlyAdded.py,limit=6&amp;albums=True&amp;unplayed=True&amp;totals=True)</onfocus>

shassino Wrote:I have the same problem RecentlyAdded.py script failed.
Running on ubuntu 9.04.
I got Aeon Hitched at 1.30pm via git.
I should have latest RecentlyAdded.py.

Code:
#15:06:19 T:2842688400 M:1402363904  NOTICE:   File "/home/xbmc/.xbmc/skin/Aeon_Hitched/extras/RecentlyAdded.py", line 130, in _fetch_totals
#15:06:19 T:2842688400 M:1402363904  NOTICE: self.WINDOW.setProperty( "TVShows.Watched" , tvshows_totals[ 2 ] )
#15:06:19 T:2842688400 M:1402363904  NOTICE: IndexError
#15:06:19 T:2842688400 M:1402363904  NOTICE: :
#15:06:19 T:2842688400 M:1402363904  NOTICE: list index out of range
#15:06:19 T:2842688400 M:1402363904   ERROR: Scriptresult: Error

Full debug log:
http://pastebin.com/f706d8019
find quote
Avigrace Offline
Senior Member
Posts: 132
Joined: Mar 2009
Reputation: 0
Post: #15
With the Hitcher mod xbmc will become unresponsive and I have to forcably kill the process with the following in the log

20:39:28 T:1308 M:1122537472 ERROR: CThread::staticThread : Access violation at 0x1e0ac802: Writing location 0x00000000

Happens within 10 seconds of running up the skin and in that time it looks like the RecentlyAdded part works as I can see added movies and the totals.

However if I rename the 'extras' folder to something else then I don't get the crash, the only file inside the folder is the RecentlyAdded.py file.

XBMC is todays SVN and Hitchers mod is fresh from git today, OS is Windows 7 RC
find quote
Post Reply