2010-05-23, 13:00
I have been working on a script that will display the what the next episode is for a given series.
I am doing this mainly as a learning experience as I'm still new to python, this is a standalone script and not to be run in xbmc. Once I am happy with the script I may try to add it to xbmc.
I have added a lot more features to my script than just next episode. So far there are two scripts one that deals with single shows and one that deals with multiple shows.
Here are the functions of each, so far:
Single show:
There are several ways you can create a show instance. There are 3 optional arguments. Name, Series id and search. Name and series id are pretty self explanatory, search is a boolean to be used in conjunction with name. If search is true which it is by default it will return a list of shows based on the name you gave. If its false it will select the first show in the search results.
Show all episodes: Does what it says, it prints a table with the season and episode numbers, the episode title and the air date. Separates the seasons into separate tables to make it easier to read. This has one optional argument call "spec" which by default is set to False, if set to true it will also display episodes that are listed as specials.
Show Season: This shows all the episodes in the season specified by the user.
Show Next Episode: This shows the next episode, based on todays date.
Show Upcoming Episodes: This will show the upcoming episodes, has one optional argument called "num". This controls how many episodes to see, its set to 100 as default, if you set it to 2, you will only see the next 2 upcoming episodes.
Show Latest Episode: This shows the latest episode.
Multi Show Script:
When you run the script it checks to see if a database of show names and show ids exists in the same directory as the script. If it doesn't it will ask you to enter the name of the show you want to add. This will search tvdb for the show and present results if there is more than one. It will then get the show id and add this to the database. It will continue to ask you to enter a show name until you enter no name, this is so you can easily add multiple shows when you first create your database.
Add Show: This is used to add new shows to your database by again searching tvdb for the show.
Delete Show: This is used to present the use with a list of current shows in order to select one to delete.
We have the same, Latest episodes, next episode and upcoming episodes as the single script, only this time it will do it for each show.
See Shows: Will present the user with a list of current shows in the database.
Show Episodes: Has one optional argument and that is the show name. If this is given it will search the database for that show and then show all the episodes for it. If its not given it will present the user with a list of shows to select from.
Show Seasons: This has two optional arguments, show name and season number, if these are given then it will display all the episodes for the given season in the show given. If not it will again present the user with a list of shows to select from and then ask them to select a season number, telling them how many seasons there are in that show.
Show Show Name: This is used to display a list of show names, these are different from show titles, show names are what the user used to create the show, these are used in the above functions optional argument show names.
I hope to post a copy of the scripts online later today, I'm a little hesitant to do so as I am very new to python so scripts are a little untidy.
I am just wondering are there any other features people would like, as I said I am doing this as a learning experience so don't expect miracles.
The only issue I have with the scripts at the moment, apart from them being untidy is the fact that each time the multishow script is run it redownloads the information for all the shows, thus making it a little slow at first. Reason I did it like this is that I wanted it to always have the latest information for the show, so I didn't want to save any of the information on a file, as then I would need to find a way to see if there have been any changes to the show and then update the file.
Thanks all for reading, please feel free to make any suggestions.
I am doing this mainly as a learning experience as I'm still new to python, this is a standalone script and not to be run in xbmc. Once I am happy with the script I may try to add it to xbmc.
I have added a lot more features to my script than just next episode. So far there are two scripts one that deals with single shows and one that deals with multiple shows.
Here are the functions of each, so far:
Single show:
There are several ways you can create a show instance. There are 3 optional arguments. Name, Series id and search. Name and series id are pretty self explanatory, search is a boolean to be used in conjunction with name. If search is true which it is by default it will return a list of shows based on the name you gave. If its false it will select the first show in the search results.
Show all episodes: Does what it says, it prints a table with the season and episode numbers, the episode title and the air date. Separates the seasons into separate tables to make it easier to read. This has one optional argument call "spec" which by default is set to False, if set to true it will also display episodes that are listed as specials.
Show Season: This shows all the episodes in the season specified by the user.
Show Next Episode: This shows the next episode, based on todays date.
Show Upcoming Episodes: This will show the upcoming episodes, has one optional argument called "num". This controls how many episodes to see, its set to 100 as default, if you set it to 2, you will only see the next 2 upcoming episodes.
Show Latest Episode: This shows the latest episode.
Multi Show Script:
When you run the script it checks to see if a database of show names and show ids exists in the same directory as the script. If it doesn't it will ask you to enter the name of the show you want to add. This will search tvdb for the show and present results if there is more than one. It will then get the show id and add this to the database. It will continue to ask you to enter a show name until you enter no name, this is so you can easily add multiple shows when you first create your database.
Add Show: This is used to add new shows to your database by again searching tvdb for the show.
Delete Show: This is used to present the use with a list of current shows in order to select one to delete.
We have the same, Latest episodes, next episode and upcoming episodes as the single script, only this time it will do it for each show.
See Shows: Will present the user with a list of current shows in the database.
Show Episodes: Has one optional argument and that is the show name. If this is given it will search the database for that show and then show all the episodes for it. If its not given it will present the user with a list of shows to select from.
Show Seasons: This has two optional arguments, show name and season number, if these are given then it will display all the episodes for the given season in the show given. If not it will again present the user with a list of shows to select from and then ask them to select a season number, telling them how many seasons there are in that show.
Show Show Name: This is used to display a list of show names, these are different from show titles, show names are what the user used to create the show, these are used in the above functions optional argument show names.
I hope to post a copy of the scripts online later today, I'm a little hesitant to do so as I am very new to python so scripts are a little untidy.
I am just wondering are there any other features people would like, as I said I am doing this as a learning experience so don't expect miracles.
The only issue I have with the scripts at the moment, apart from them being untidy is the fact that each time the multishow script is run it redownloads the information for all the shows, thus making it a little slow at first. Reason I did it like this is that I wanted it to always have the latest information for the show, so I didn't want to save any of the information on a file, as then I would need to find a way to see if there have been any changes to the show and then update the file.
Thanks all for reading, please feel free to make any suggestions.