Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 78
Release TV Show Next Aired (Script) Addon, now w/TheTVDB data
#1
Hi, folks! The Next Aired script has been updated to v6.0.x to provide better performance and fix a bunch of bugs. This should take care of the slow updating that everyone was seeing and make the 7-day Guide view much more accurate. To do all this I switched the scraping over to using TheTVDB as its data source. It makes use of the update zip files to efficiently grab only shows that have changes, so it can update more frequently during the day (by default it checks every 8 hours) as well as updating when the user enters the guide display (also defaults to 8 hours).

I've taken over as maintainer from ronie, in order to make a variety of improvements, such as allowing skins to show more upcoming guide info and also improving the translation support.

Here are some improvements that you may notice:
  • There is now a Today-week guide that shows the upcoming shows beginning with today (or even yesterday) instead of the default Monday-Sunday guide.
  • You can choose to display more upcoming shows than just 7 days (including today). The Monday-week guide can also display 14 days (with next week's shows at the end of each day's list. The Today-week guide can display 15 upcoming days (Today + 2 weeks) plus the option of including Yesterday in the list.
  • The TV Guide now uses actual future episodes for displaying a show name on a particular date (not the former "normally appears on these days" info), so each day that has a show visible has real data behind it.
  • A show with multiple shows per week will display each show's unique info (title, episode num, etc.) rather than only showing the one next episode's info. (This does not include broadcast time, which is a per-show item in the available data, not per episode.)
  • A show can appear multiple times per day if there are going to be multiple shows that day.
  • Updating should be much faster. For instance, it typically takes my computer about 5 seconds to do an update after an 8 hour wait.
  • Since updating is more efficient, it occurs more frequently -- every 8 hours by default (see the settings to change this). The update times are elapsed times (not fixed at a particular hour and minute) which should help to distribute the updating over a wider range of times (the old code used to update most people at their local midnight hour).
  • A failure to grab updates does not cause shows to vanish from the list (which seemed to happen a lot before).
  • The way that dates get displayed for the future episodes can be a little more friendly now, with the day-of-the-week included and the current year omitted. This is particularly nice for a skin that shows next-show info as you visit a show's folder. Some examples (these in the US English form): "Sat, Feb 1" or "Tue, Dec 31, 2013". To see dates like this you need to enable it in the settings.
  • Changing the update values in the settings now affects the running background-updating process w/o needing to restart xbmc.
  • The GUI will now notice if the background updater is doing an update and just wait for it to finish (if it was time for a GUI-proc initiated update). (The older code would do multiple simultaneous updates in such a situation.)
  • Switching users no longer results in a proliferation of extra background update processes (which would all do redundant update work at the same time in the old code).
  • If the addon updates, the old background updater is stopped and a new one started.
Some data differences:
  • The Status field is more limited than before, though I improve the 3 values that TheTVDB provides (empty, Continuing, Ended) and try to intuit a few more based on the show's data. See the README.txt for the shorter list.

The end result is now in the addons, so anyone with this installed should have it by now. I'm also continuing to make my latest work available via zip file, so if you want to try any new features I mention later in this thread, snag the beta zip file and either unzip it into the XBMC/addons dir over the current code or use the menu prompts to install from zip. The file will include a unique 8-character string (right before the .zip suffix) for each changed version in order to work around a bug in the xbmc zip installer. If you use wget, be sure to use the --trust-server-names option if you plan to install the file via xbmc.

After installation, you should exit XBMC and start it up again so that the background updating process gets going on the new code (assuming that your skin starts it up).

If you're interested in helping out with the coding/fixing, feel free to check out the code's git repo.

This thread started out as a WIP discussion of the 6.0.0 version, as seen in the first comments below. Enjoy!

..wayne..
Reply
#2
Nice work! Updates are a lot faster.
Just noticed 2 minor problems.

1. format of the Genre string. You could use something like this to produce a more appealing format.
Code:
self.genre = node.findtext("Genre").strip('|').replace('|',' / ')

2. The airtime seems to be local (no adjustment for time diff).
Reply
#3
Ask here Smile

How do I get the next air date in a list container?
This doesnt seem to work.
$INFO[ListItem.Property(NextDate)]
Reply
#4
Nice I will try on a few hours

Thanks for the hard work

-------
its just me or the status id for thetvdb is just ended and continuing
Reply
#5
If you have a show in your database that hasn't had any episodes out yet, the script can't parse the first aired line(since it doesn't have one yet) and it crashes.

Here is the error from the log.

Edit:
The show for me is Bastard Executioner found @ http://www.thetvdb.com/?tab=series&id=276170
Reply
#6
(2014-02-13, 02:23)Steveb Wrote: 1. format of the Genre string.
2. The airtime seems to be local (no adjustment for time diff).
(2014-02-13, 05:48)Vaikin Wrote: If you have a show in your database that hasn't had any episodes out yet, the script can't parse the first aired line(since it doesn't have one yet) and it crashes.

Thanks for the quick feedback. I've fixed the genre string to be formatted as it was before (though a show won't change format until it gets an update or until the DB is reset). I've also fixed the crash for a show with no episodes. The timezone issue is already on my list of things to improve, and I'll be getting to it soon.

I've updated the zip file (mentioned in the first post) with the fixes.

..wayne..
Reply
#7
(2014-02-13, 08:27)WayneD Wrote: The timezone issue is already on my list of things to improve, and I'll be getting to it soon.

The timezones (and thus aired times) are now fixed up in the latest version of the zip file. I included a heuristic that will cause all the tv data to be refetched the first time you start up xbmc after the upgrade (assuming your skin starts the background updater) or the first time you enter the Guide (if it does not).

For those upgrading from my earlier 6.0.0 files: I haven't been incrementing the version yet, so upgrades seem to be a bit manual at the moment -- I actually just went into the XBMC/addons dir and unzipped the new script.tv.*.zip file there. I did this because trying to tell xbmc to install my latest 6.0.0 zip file didn't actually update any of the files (it presumably thought I already had 6.0.0, but still, it should really just install from the zip I point it at).

..wayne..
Reply
#8
(2014-02-13, 03:37)Tricky Wrote: How do I get the next air date in a list container?
This doesnt seem to work.
$INFO[ListItem.Property(NextDate)]

I assume you're asking about from a skin's perspective (which I haven't fiddled with). I do know that Ace and MQ5 make extensive use of Next Aired data, so you might try grepping through one of those for an answer. For instance, I see this in the 720p/IncludesVariables.xml file of Ace:
Code:
$INFO[Container(200).ListItem.Property(NextDate)]

..wayne..
Reply
#9
I seems to be getting a script error at little house on the prairie.

17:24:59 T:3500 NOTICE: script.tv.show.next.aired: ### getting series & episode information for Line of Duty
17:24:59 T:3500 NOTICE: script.tv.show.next.aired: ### getting series & episode information for Little House on the Prairie
17:25:00 T:3500 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ValueError'>
Error Contents: hour must be in 0..23
Traceback (most recent call last):
File "C:\Users\Home Server\AppData\Roaming\XBMC\addons\script.tv.show.next.aired\default.py", line 858, in <module>
NextAired()
File "C:\Users\Home Server\AppData\Roaming\XBMC\addons\script.tv.show.next.aired\default.py", line 119, in __init__
self.show_gui()
File "C:\Users\Home Server\AppData\Roaming\XBMC\addons\script.tv.show.next.aired\default.py", line 664, in show_gui
self.update_data()
File "C:\Users\Home Server\AppData\Roaming\XBMC\addons\script.tv.show.next.aired\default.py", line 310, in update_data
tid = self.check_show_info(tvdb, tid, current_show, prior_data)
File "C:\Users\Home Server\AppData\Roaming\XBMC\addons\script.tv.show.next.aired\default.py", line 454, in check_show_info
airtime = TheTVDB.convert_time(show.airs_time)
File "C:\Users\Home Server\AppData\Roaming\XBMC\addons\script.tv.show.next.aired\thetvdbapi.py", line 171, in convert_time
return datetime.time(hour, int(gd["minute"]))
ValueError: hour must be in 0..23
-->End of Python script error report<--
Reply
#10
(2014-02-14, 00:31)bill1972 Wrote: Error Contents: hour must be in 0..23

That's actually a bug in thetvdbapi.py (12:00pm -> 24:00). I've fixed it in my local (extended) version of that file, and will let someone know about it. I've also added a try-except block to catch any future failures of that code. The latest zip has this fixed.

Thanks!

..wayne..
Reply
#11
Thanks working now
Reply
#12
FYI, I've updated the zip file again with some more improvements: the updating algorithm got some fixing in the its scheduling, in how the background- and foreground-updating interacts, in how episode data is updated when we didn't re-grab the episodes (e.g. when the show's time changes it affects each episode's datetime value), and in some improvements to how a canceled update affects the data (we don't end up with partial data anymore). Also, the timezone code was improved to handle DST, the settings were tweaked a bit more to try to be a bit clearer, and some error-handling code was also improved.

I'm thinking that this version is now where I want it to be for an initial release, so we just need to hammer on it some more and ensure that it is bug-free enough for wider distribution. Be sure to glance at the last 2 addon settings (the ones that affect update intervals) and let me know if you think they are reasonably clear and useful (the idea is to support background-only updating, foreground-only updating, and a combination thereof).

A big "thank you" to everyone who is helping to test! Enjoy,

..wayne..
Reply
#13
Another note for those who are testing: I've made a few more changes to the addon, and uploaded it to the same zip file (as mentioned above).

Firstly, I discovered that the addon has had (for quite some time) a bad habit of starting up a new background update proc (w/o killing the old one) every time someone switches profiles in XBMC (if the skin starts it up). This makes me wonder how many people out there may be hammering tvrage in multiple simultaneous runs each day (for those users that leave their xbmc open a long time and like to switch profiles). Regardless, I've added some code to my latest version that notices if another background updater has started, which causes the older one to exit. This bug could also cause an issue with the wrong show list getting stored by the still-running update proc(s) if the profiles are configured to use different sources (the older update proc would get the current profile's list of shows, but save it to the old profile's data).

While I was fiddling around with the code I also improved the tv-db-parsing base class some more to make it faster (I switched it over to expat incremental parsing, which made a local parse of the full Jeopardy! xml data decrease from 1.8 seconds to 0.6 seconds in my testing). I also made it download the .zip version of the data (which makes the grabbed data much smaller).

Please let me know if I broke anything....

..wayne..
Reply
#14
i get this error with the last update 6hours ago


Code:
0:29:40 T:6088  NOTICE: script.tv.show.next.aired: ### getting series & episode information for Con el culo al aire
00:29:40 T:6088   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: ('EpisodeName',)
                                            Traceback (most recent call last):

is always happening with the spain seria "Con el culo al aire"
after removing the seri came back with another for Mike & Molly

Code:
00:33:21 T:5248  NOTICE: script.tv.show.next.aired: ### getting series & episode information for Mike & Molly
00:33:21 T:5248   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: ('EpisodeName',)
                                            Traceback (most recent call last):
Reply
#15
(2014-02-17, 08:32)warlion Wrote: Error Type: <type 'exceptions.KeyError'>
Error Contents: ('EpisodeName',)

This should be all fixed up now. Thanks for the report!

..wayne..
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 78

Logout Mark Read Team Forum Stats Members Help
TV Show Next Aired (Script) Addon, now w/TheTVDB data8
This forum uses Lukasz Tkacz MyBB addons.