├── TVDBSharp ├── TVDBSharp │ ├── App.config │ ├── Models │ │ ├── Enums │ │ │ ├── Frequency.cs │ │ │ ├── Status.cs │ │ │ ├── Interval.cs │ │ │ └── ContentRating.cs │ │ ├── Updates.cs │ │ ├── DAO │ │ │ ├── DataProvider.cs │ │ │ └── IDataProvider.cs │ │ ├── Episode.cs │ │ ├── Show.cs │ │ └── Builder.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Utilities │ │ ├── Extensions.cs │ │ └── Utils.cs │ ├── TVDB.cs │ └── TVDBSharp.csproj ├── Tests │ ├── App.config │ ├── Models │ │ ├── Data.cs │ │ ├── TestEpisode.cs │ │ ├── TestShow.cs │ │ └── Conversion.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── TestDataProvider.cs │ ├── MainTests.cs │ ├── Tests.csproj │ └── TestData.cs ├── Examples │ ├── App.config │ ├── DisplaySearchResult.cs │ ├── DisplayEpisodeTitles.cs │ ├── DisplayUpdates.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── DisplayEpisodeDetails.cs │ ├── DisplayShowDetails.cs │ ├── Program.cs │ └── Examples.csproj └── TVDBSharp.sln ├── README.md ├── .gitignore └── LICENSE /TVDBSharp/TVDBSharp/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /TVDBSharp/Tests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /TVDBSharp/Examples/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/Enums/Frequency.cs: -------------------------------------------------------------------------------- 1 | namespace TVDBSharp.Models.Enums 2 | { 3 | public enum Frequency 4 | { 5 | Monday, 6 | Tuesday, 7 | Wednesday, 8 | Thursday, 9 | Friday, 10 | Saturday, 11 | Sunday, 12 | Daily 13 | } 14 | } -------------------------------------------------------------------------------- /TVDBSharp/Tests/Models/Data.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace Tests.Models 4 | { 5 | /// 6 | /// Simulation of the real XML tree. 7 | /// 8 | [XmlRoot("Data")] 9 | public class Data 10 | { 11 | /// 12 | /// The XML tree's show object. 13 | /// 14 | [XmlElement("Series")] 15 | public TestShow TestShow { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /TVDBSharp/Examples/DisplaySearchResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using TVDBSharp.Models; 4 | 5 | namespace Examples 6 | { 7 | public class DisplaySearchResult 8 | { 9 | public static void Print(List searchResults) 10 | { 11 | foreach (var show in searchResults) 12 | { 13 | Console.WriteLine("{0}:\t{1}", show.Name, show.Id); 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /TVDBSharp/Examples/DisplayEpisodeTitles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using TVDBSharp.Models; 4 | 5 | namespace Examples 6 | { 7 | /// 8 | /// This example will demonstrate how to retrieve the titles of every episode in a season. 9 | /// 10 | public class DisplayEpisodeTitles 11 | { 12 | public static void Print(List episodes) 13 | { 14 | foreach (var episode in episodes) 15 | { 16 | Console.WriteLine(episode.Title); 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/Enums/Status.cs: -------------------------------------------------------------------------------- 1 | namespace TVDBSharp.Models.Enums 2 | { 3 | /// 4 | /// Describes the current status of a show. 5 | /// 6 | public enum Status 7 | { 8 | /// 9 | /// No more episodes are being released. 10 | /// 11 | Ended, 12 | 13 | /// 14 | /// The show is ongoing. 15 | /// 16 | Continuing, 17 | 18 | /// 19 | /// Default value if no status is specified. 20 | /// 21 | Unknown 22 | } 23 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/Enums/Interval.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TVDBSharp.Models.Enums 4 | { 5 | public enum Interval 6 | { 7 | Day, 8 | Week, 9 | Month, 10 | All 11 | } 12 | 13 | public static class IntervalHelpers 14 | { 15 | public static string Print(Interval interval) 16 | { 17 | switch (interval) 18 | { 19 | case Interval.Day: 20 | return "day"; 21 | case Interval.Week: 22 | return "week"; 23 | case Interval.Month: 24 | return "month"; 25 | case Interval.All: 26 | return "all"; 27 | default: 28 | throw new ArgumentException("Unsupported interval enum: " + interval); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /TVDBSharp/Examples/DisplayUpdates.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using TVDBSharp.Models; 3 | 4 | namespace Examples 5 | { 6 | public class DisplayUpdates 7 | { 8 | public static void Print(Updates updates) 9 | { 10 | Console.WriteLine("{0} updated shows (ids) ----", updates.UpdatedSeries.Count); 11 | foreach (var show in updates.UpdatedSeries) 12 | { 13 | Console.WriteLine("show #{0}; {1}", show.Id, show.Timestamp); 14 | } 15 | Console.WriteLine(); 16 | Console.WriteLine("{0} updated episodes (ids) ----", updates.UpdatedEpisodes.Count); 17 | foreach (var episode in updates.UpdatedEpisodes) 18 | { 19 | Console.WriteLine("{0} (serie #{1}); {2}", episode.Id, episode.SerieId, episode.Timestamp); 20 | } 21 | Console.WriteLine(); 22 | Console.WriteLine("{0} updated banners ----", updates.UpdatedBanners.Count); 23 | foreach (var banner in updates.UpdatedBanners) 24 | { 25 | Console.WriteLine("{0} (serie #{1}) - {2}; {3}", banner.Path, banner.SerieId, banner.Format, 26 | banner.Timestamp); 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /TVDBSharp/Tests/Models/TestEpisode.cs: -------------------------------------------------------------------------------- 1 | namespace Tests.Models 2 | { 3 | /// 4 | /// Used to create an original XML representation of an episode. 5 | /// 6 | public class TestEpisode 7 | { 8 | #pragma warning disable 1591 // Disables XML warnings 9 | public string id { get; set; } 10 | public string Director { get; set; } 11 | public string EpisodeName { get; set; } 12 | public string EpisodeNumber { get; set; } 13 | public string FirstAired { get; set; } 14 | public string GuestStars { get; set; } 15 | public string IMDB_ID { get; set; } 16 | public string Language { get; set; } 17 | public string Overview { get; set; } 18 | public string Rating { get; set; } 19 | public string RatingCount { get; set; } 20 | public string SeasonNumber { get; set; } 21 | public string Writer { get; set; } 22 | public string filename { get; set; } 23 | public string lastupdated { get; set; } 24 | public string seasonid { get; set; } 25 | public string seriesid { get; set; } 26 | public string thumb_height { get; set; } 27 | public string thumb_width { get; set; } 28 | public string tms_export { get; set; } 29 | #pragma warning restore 1591 // Enables XML warnings 30 | } 31 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/Enums/ContentRating.cs: -------------------------------------------------------------------------------- 1 | namespace TVDBSharp.Models.Enums 2 | { 3 | /// 4 | /// Different content ratings. View http://en.wikipedia.org/wiki/TV_Parental_Guidelines for more info. 5 | /// 6 | public enum ContentRating 7 | { 8 | /// 9 | /// Not suitable for children under 14. 10 | /// 11 | TV14, 12 | 13 | /// 14 | /// This program contains material that parents may find unsuitable for younger children. 15 | /// 16 | TVPG, 17 | 18 | /// 19 | /// This program is designed to be appropriate for all children. 20 | /// 21 | TVY, 22 | 23 | /// 24 | /// This program is designed for children age 7 and above. 25 | /// 26 | TVY7, 27 | 28 | /// 29 | /// Most parents would find this program suitable for all ages. 30 | /// 31 | TVG, 32 | 33 | /// 34 | /// This program is specifically designed to be viewed by adults and therefore may be unsuitable for children under 17. 35 | /// 36 | TVMA, 37 | 38 | /// 39 | /// Default value if no rating is given. 40 | /// 41 | Unknown 42 | } 43 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/Updates.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace TVDBSharp.Models 5 | { 6 | public class Updates : UnixTimestampedObject 7 | { 8 | public List UpdatedBanners { get; set; } 9 | public List UpdatedEpisodes { get; set; } 10 | public List UpdatedSeries { get; set; } 11 | } 12 | 13 | public class UnixTimestampedObject 14 | { 15 | private static DateTime _startDate = new DateTime(1970, 1, 1); 16 | private int _unixTimestamp; 17 | 18 | public DateTime Timestamp 19 | { 20 | get { return _startDate.AddSeconds(_unixTimestamp); } 21 | } 22 | 23 | public int Time 24 | { 25 | set { _unixTimestamp = value; } 26 | } 27 | } 28 | 29 | public class UpdatedSerie : UnixTimestampedObject 30 | { 31 | public int Id { get; set; } 32 | } 33 | 34 | public class UpdatedEpisode : UnixTimestampedObject 35 | { 36 | public int Id { get; set; } 37 | public int SerieId { get; set; } 38 | } 39 | 40 | public class UpdatedBanner : UnixTimestampedObject 41 | { 42 | public int SerieId { get; set; } 43 | public string Format { get; set; } 44 | public string Language { get; set; } 45 | public string Path { get; set; } 46 | public string Type { get; set; } 47 | public int? SeasonNumber { get; set; } 48 | } 49 | } -------------------------------------------------------------------------------- /TVDBSharp/Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("4889622a-b427-49b8-b4d8-3f8b8f55a3b7")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /TVDBSharp/Examples/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Examples")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Examples")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("6c3598f4-01a6-4936-9358-fcb0c299c865")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("TVDBSharp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TVDBSharp")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("c78961a8-afda-4a36-910b-bf5a090eebb3")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /TVDBSharp/Tests/Models/TestShow.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace Tests.Models 5 | { 6 | /// 7 | /// Used to create an original XML representation of a show. 8 | /// 9 | public class TestShow 10 | { 11 | #pragma warning disable 1591 // Disables XML warnings 12 | public string id { get; set; } 13 | public string Actors { get; set; } 14 | public string Airs_DayOfWeek { get; set; } 15 | public string Airs_Time { get; set; } 16 | public string ContentRating { get; set; } 17 | public string FirstAired { get; set; } 18 | public string Genre { get; set; } 19 | public string IMDB_ID { get; set; } 20 | public string Language { get; set; } 21 | public string Network { get; set; } 22 | public string Overview { get; set; } 23 | public string Rating { get; set; } 24 | public string RatingCount { get; set; } 25 | public string Runtime { get; set; } 26 | public string SeriesName { get; set; } 27 | public string Status { get; set; } 28 | public string banner { get; set; } 29 | public string fanart { get; set; } 30 | public string lastupdated { get; set; } 31 | public string poster { get; set; } 32 | public string zap2it_id { get; set; } 33 | 34 | [XmlElement("Episode")] 35 | public List Episodes { get; set; } 36 | #pragma warning restore 1591 // Enables XML warnings 37 | } 38 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/DAO/DataProvider.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Net; 3 | using System.Xml.Linq; 4 | using TVDBSharp.Models.Enums; 5 | 6 | namespace TVDBSharp.Models.DAO 7 | { 8 | /// 9 | /// Standard implementation of the interface. 10 | /// 11 | public class DataProvider : IDataProvider 12 | { 13 | public string ApiKey { get; set; } 14 | private const string BaseUrl = "http://thetvdb.com"; 15 | 16 | public XDocument GetShow(int showID) 17 | { 18 | return GetXDocumentFromUrl(string.Format("{0}/api/{1}/series/{2}/all/", BaseUrl, ApiKey, showID)); 19 | } 20 | 21 | public XDocument GetEpisode(int episodeId, string lang) 22 | { 23 | return GetXDocumentFromUrl(string.Format("{0}/api/{1}/episodes/{2}/{3}.xml", BaseUrl, ApiKey, episodeId, lang)); 24 | } 25 | 26 | public XDocument GetUpdates(Interval interval) 27 | { 28 | return GetXDocumentFromUrl(string.Format("{0}/api/{1}/updates/updates_{2}.xml", BaseUrl, ApiKey, IntervalHelpers.Print(interval))); 29 | } 30 | 31 | public XDocument Search(string query) 32 | { 33 | return GetXDocumentFromUrl(string.Format("{0}/api/GetSeries.php?seriesname={1}&language=all", BaseUrl, query)); 34 | } 35 | 36 | private static XDocument GetXDocumentFromUrl(string url) 37 | { 38 | using (var web = new WebClient()) 39 | using (var memoryStream = new MemoryStream(web.DownloadData(url))) 40 | return XDocument.Load(memoryStream); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/DAO/IDataProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Linq; 2 | using TVDBSharp.Models.Enums; 3 | 4 | namespace TVDBSharp.Models.DAO 5 | { 6 | /// 7 | /// Defines a Dataprovider API. 8 | /// 9 | public interface IDataProvider 10 | { 11 | /// 12 | /// The API key provided by TVDB. 13 | /// 14 | string ApiKey { get; set; } 15 | 16 | /// 17 | /// Retrieves the show with the given id and returns the corresponding XML tree. 18 | /// 19 | /// ID of the show you wish to lookup. 20 | /// Returns an XML tree of the show object. 21 | XDocument GetShow(int showID); 22 | 23 | /// 24 | /// Retrieves the episode with the given id and returns the corresponding XML tree. 25 | /// 26 | /// ID of the episode to retrieve 27 | /// ISO 639-1 language code of the episode 28 | /// XML tree of the episode object 29 | XDocument GetEpisode(int episodeId, string lang); 30 | 31 | /// 32 | /// Retrieves updates on tvdb (Shows, Episodes and Banners) 33 | /// 34 | /// The interval for the updates 35 | /// XML tree of the Updates object 36 | XDocument GetUpdates(Interval interval); 37 | 38 | /// 39 | /// Returns an XML tree representing a search query for the given parameter. 40 | /// 41 | /// Query to perform the search with. 42 | /// Returns an XML tree of a search result. 43 | XDocument Search(string query); 44 | } 45 | } -------------------------------------------------------------------------------- /TVDBSharp/Tests/Models/Conversion.cs: -------------------------------------------------------------------------------- 1 | namespace Tests.Models 2 | { 3 | /// 4 | /// A helper class to translate an object to its XML value and vice versa. 5 | /// 6 | public class Conversion 7 | { 8 | /// 9 | /// The XML representation for either an element tag or a value. 10 | /// 11 | public string XmlValue { get; set; } 12 | 13 | /// 14 | /// The object representation for either a property or a value. 15 | /// 16 | public string ObjValue { get; set; } 17 | 18 | /// 19 | /// Constructs a new object with the given values. 20 | /// 21 | /// XML Value (see ). 22 | /// Object Value (see ). 23 | public Conversion(string xmlValue, string objValue) 24 | { 25 | XmlValue = xmlValue; 26 | ObjValue = objValue; 27 | } 28 | 29 | public override bool Equals(object obj) 30 | { 31 | if (ReferenceEquals(null, obj)) 32 | return false; 33 | if (ReferenceEquals(this, obj)) 34 | return true; 35 | if (obj.GetType() != GetType()) 36 | return false; 37 | return Equals((Conversion) obj); 38 | } 39 | 40 | protected bool Equals(Conversion other) 41 | { 42 | return string.Equals(XmlValue, other.XmlValue) && string.Equals(ObjValue, other.ObjValue); 43 | } 44 | 45 | public override int GetHashCode() 46 | { 47 | unchecked 48 | { 49 | return ((XmlValue != null ? XmlValue.GetHashCode() : 0)*397) ^ 50 | (ObjValue != null ? ObjValue.GetHashCode() : 0); 51 | } 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TVDBSharp", "TVDBSharp\TVDBSharp.csproj", "{0CC493D7-0A9F-4199-9615-0A977945D716}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Examples.csproj", "{4918B205-E641-444F-8B2C-3D80D918A806}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{F32B4596-46CB-4B07-B4B6-93B361C954A1}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {0CC493D7-0A9F-4199-9615-0A977945D716}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {0CC493D7-0A9F-4199-9615-0A977945D716}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {0CC493D7-0A9F-4199-9615-0A977945D716}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {0CC493D7-0A9F-4199-9615-0A977945D716}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {4918B205-E641-444F-8B2C-3D80D918A806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {4918B205-E641-444F-8B2C-3D80D918A806}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {4918B205-E641-444F-8B2C-3D80D918A806}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {4918B205-E641-444F-8B2C-3D80D918A806}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {F32B4596-46CB-4B07-B4B6-93B361C954A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {F32B4596-46CB-4B07-B4B6-93B361C954A1}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {F32B4596-46CB-4B07-B4B6-93B361C954A1}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {F32B4596-46CB-4B07-B4B6-93B361C954A1}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /TVDBSharp/Examples/DisplayEpisodeDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using TVDBSharp.Models; 3 | 4 | namespace Examples 5 | { 6 | public class DisplayEpisodeDetails 7 | { 8 | /// 9 | /// This example demonstrates the retrieval and display of an episode. 10 | /// 11 | public static void Print(Episode episode) 12 | { 13 | Console.WriteLine("{0}:\t{1}", "IMDB ID", episode.ImdbId); 14 | Console.WriteLine("{0}:\t{1}", "ID", episode.Id); 15 | Console.WriteLine("{0}:\t{1}", "Language", episode.Language); 16 | Console.WriteLine("{0}:\t{1}", "Last update", episode.LastUpdated); 17 | Console.WriteLine("{0}:\t{1}", "Title", episode.Title); 18 | Console.WriteLine("{0}:\t{1}", "Rating", episode.Rating); 19 | Console.WriteLine("{0}:\t{1}", "# Votes", episode.RatingCount); 20 | Console.WriteLine("{0}:\t{1}", "Description", episode.Description); 21 | Console.WriteLine("{0}:\t{1}", "Director", episode.Director); 22 | Console.WriteLine("{0}:\t{1}", "EpisodeNumber", episode.EpisodeNumber); 23 | Console.WriteLine("{0}:\t{1}", "SeasonNumber", episode.SeasonNumber); 24 | Console.WriteLine("{0}:\t{1}", "Filename", episode.EpisodeImage); 25 | Console.WriteLine("{0}:\t{1}", "Series ID", episode.SeriesId); 26 | Console.WriteLine("{0}:\t{1}", "Season ID", episode.SeasonId); 27 | Console.WriteLine("{0}:\t{1}", "Thumbnail Height", episode.ThumbHeight); 28 | Console.WriteLine("{0}:\t{1}", "Thumbnail Width", episode.ThumbHeight); 29 | 30 | Console.Write("Gueststars:\t"); 31 | foreach (var element in episode.GuestStars) 32 | { 33 | Console.Write(element); 34 | } 35 | 36 | Console.Write("Writers:\t"); 37 | foreach (var element in episode.Writers) 38 | { 39 | Console.Write(element); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /TVDBSharp/Examples/DisplayShowDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using TVDBSharp.Models; 3 | 4 | namespace Examples 5 | { 6 | public class DisplayShowDetails 7 | { 8 | /// 9 | /// This example demonstrates the retrieval and display of a show. 10 | /// 11 | public static void Print(Show show) 12 | { 13 | Console.WriteLine("{0}:\t{1}", "IMDB ID", show.ImdbId); 14 | Console.WriteLine("{0}:\t{1}", "ID", show.Id); 15 | Console.WriteLine("{0}:\t{1}", "Language", show.Language); 16 | Console.WriteLine("{0}:\t{1}", "Last update", show.LastUpdated); 17 | Console.WriteLine("{0}:\t{1}", "Name", show.Name); 18 | Console.WriteLine("{0}:\t{1}", "Network", show.Network); 19 | Console.WriteLine("{0}:\t{1}", "Poster", show.Poster); 20 | Console.WriteLine("{0}:\t{1}", "Rating", show.Rating); 21 | Console.WriteLine("{0}:\t{1}", "# Votes", show.RatingCount); 22 | Console.WriteLine("{0}:\t{1}", "Runtime", show.Runtime); 23 | Console.WriteLine("{0}:\t{1}", "Status", show.Status); 24 | Console.WriteLine("{0}:\t{1}", "Zap2it ID", show.Zap2ItID); 25 | Console.WriteLine("{0}:\t{1}", "Airday", show.AirDay); 26 | Console.WriteLine("{0}:\t{1}", "AirTime", show.AirTime); 27 | Console.WriteLine("{0}:\t{1}", "Banner", show.Banner); 28 | Console.WriteLine("{0}:\t{1}", "ContentRating", show.ContentRating); 29 | Console.WriteLine("{0}:\t{1}", "Description", show.Description); 30 | Console.WriteLine("{0}:\t{1}", "Fanart", show.Fanart); 31 | Console.WriteLine("{0}:\t{1}", "First aired", show.FirstAired); 32 | 33 | Console.Write("Actors:\t"); 34 | foreach (var element in show.Actors) 35 | { 36 | Console.Write("{0} | ", element); 37 | } 38 | 39 | Console.Write("Genres:\t"); 40 | foreach (var element in show.Genres) 41 | { 42 | Console.Write("{0} | ", element); 43 | } 44 | 45 | Console.Write("Episodes:"); 46 | foreach (var element in show.Episodes) 47 | { 48 | Console.WriteLine(element.Title); 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TVDBSharp 2 | ========= 3 | 4 | Now also available as a NuGet package at https://www.nuget.org/packages/TVDBSharp/ 5 | 6 | **A C# wrapper for the TVDB API.** 7 | 8 | This API provides an easy-to-use interface to the TVDB API by translating the XML responses into objects. 9 | You won't need any knowledge about the API itself to use this library. 10 | 11 | To get started there are a few steps you have to undertake. 12 | 13 | **1) Get an API key.** 14 | This is as easy as filling out a form on TheTVDB's webpage. 15 | Read the rules and enter your information, you can find your API key under 'Account'. 16 | 17 | > http://thetvdb.com/?tab=apiregister 18 | 19 | **2) Optionally: familiarize yourself with the API itself.** 20 | You don't have to do this, but some people might want to read up on the, although slightly outdated, API. 21 | 22 | > http://www.thetvdb.com/wiki/index.php?title=Programmers_API 23 | 24 | **3) Import the library.** 25 | This can be done by either forking this repository and compiling it yourself 26 | or by downloading the latest version from the link below. 27 | 28 | > https://mega.co.nz/#!ldV2mByK!ThyK-hbqHXWGnLcKbjtrcxQv46rF_V6tghtE9ZWELEU 29 | 30 | 31 | Add it as a reference to your project and you're all set. 32 | 33 | **4) Use it!** 34 | You can now use TVDBSharp in your own project. 35 | Look trough the examples project if you aren't entirely sure how to get started. 36 | 37 | A simple example: 38 | 39 | var tvdb = new TVDB("mykey"); // Create a new TVDB object with your API key. 40 | var results = tvdb.Search("Battlestar Galactica", 3); // Search for a show and take the top-3. 41 | 42 | foreach(var show in results){ 43 | Console.WriteLine("{0}:\t{1}", show.Name, show.ID); // Print every show's name and ID. 44 | } 45 | 46 | Output: 47 | > Battlestar Galactica: 71173 48 | > Battlestar Galactica: Blood & Chrome: 204781 49 | > Battlestar Galactica \<2003\> : 73545 50 | 51 | **Notes** 52 | If you encounter any issues or have a suggestion: don't hesitate to open a ticket. 53 | Should you wish to do so, you can contact me at `jer_vannevelhotmail.com`. 54 | 55 | Other networking sites: 56 | [StackOverflow] (http://stackoverflow.com/users/1864167/jeroen-vannevel) 57 | [Careers 2.0] (http://careers.stackoverflow.com/Vannevelj) 58 | [LinkedIn](http://www.linkedin.com/profile/view?id=289197145&trk=nav_responsive_tab_profile) 59 | -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Utilities/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Linq; 2 | using System.Xml.Schema; 3 | 4 | namespace TVDBSharp.Utilities 5 | { 6 | /// 7 | /// Extension methods used to simplify data extraction. 8 | /// 9 | public static class Extensions 10 | { 11 | /// 12 | /// Retrieves a value from an XML tree representing a show. 13 | /// 14 | /// XML tree representing a show. 15 | /// Name of the element with the data. 16 | /// Returns the value corresponding to the given element name. 17 | /// Thrown when the element doesn't exist or the XML tree is incorrect. 18 | public static string GetSeriesData(this XDocument doc, string element) 19 | { 20 | var root = doc.Element("Data"); 21 | if (root != null) 22 | { 23 | var xElement = root.Element("Series"); 24 | if (xElement != null) 25 | { 26 | var result = xElement.Element(element); 27 | if (result != null) 28 | { 29 | return result.Value; 30 | } 31 | throw new XmlSchemaException("Could not find element <" + element + ">"); 32 | } 33 | throw new XmlSchemaException("Could not find element "); 34 | } 35 | throw new XmlSchemaException("Could not find element "); 36 | } 37 | 38 | /// 39 | /// Retrieves a value from an XML tree. 40 | /// 41 | /// The given XML (sub)tree. 42 | /// Name of the element with the data. 43 | /// Returns the value corresponding to the given element name; 44 | /// Thrown when the element doesn't exist. 45 | public static string GetXmlData(this XElement xmlObject, string element) 46 | { 47 | var result = xmlObject.Element(element); 48 | 49 | return result != null ? result.Value : null; 50 | 51 | // Removed in favor of returning a null value 52 | // This will allow us to catch a non-existing tag with the null-coalescing operator 53 | // Never trust the XML provider. 54 | 55 | //throw new XmlSchemaException("Element <" + element + "> could not be found."); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /TVDBSharp/Examples/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Configuration; 3 | using System.Linq; 4 | using TVDBSharp; 5 | using TVDBSharp.Models.Enums; 6 | 7 | namespace Examples 8 | { 9 | internal class Program 10 | { 11 | public static void Main(string[] args) 12 | { 13 | // Your own API key 14 | var tvdb = new TVDB(ConfigurationManager.AppSettings["apikey"]); 15 | 16 | // Retrieve and display Game of Thrones 17 | //GetSpecificShow(tvdb); 18 | 19 | // Retrieve and display Game of Thrones s04e01 20 | //GetSpecificEpisode(tvdb); 21 | 22 | // Retrieve and display episode titles for Game of Thrones season 2 23 | //GetEpisodeTitlesForSeason(tvdb); 24 | 25 | // Search for Battlestar Galactica on tvdb 26 | //SearchShow(tvdb); 27 | 28 | // Get updates of the last 24 hours 29 | GetUpdates(tvdb); 30 | 31 | Console.ReadKey(); 32 | } 33 | 34 | private static void GetSpecificShow(TVDB tvdb) 35 | { 36 | Console.WriteLine("Game of Thrones"); 37 | var got = tvdb.GetShow(121361); 38 | DisplayShowDetails.Print(got); 39 | Console.WriteLine("-----------"); 40 | } 41 | 42 | private static void GetSpecificEpisode(TVDB tvdb) 43 | { 44 | Console.WriteLine("Game of Thrones s04e01"); 45 | var episode = tvdb.GetEpisode(4721938); 46 | DisplayEpisodeDetails.Print(episode); 47 | Console.WriteLine("-----------"); 48 | } 49 | 50 | private static void GetEpisodeTitlesForSeason(TVDB tvdb) 51 | { 52 | Console.WriteLine("Episodes of Game of Thrones season 2"); 53 | var show = tvdb.GetShow(121361); 54 | var season2Episodes = show.Episodes.Where(ep => ep.SeasonNumber == 2).ToList(); 55 | DisplayEpisodeTitles.Print(season2Episodes); 56 | Console.WriteLine("-----------"); 57 | } 58 | 59 | private static void SearchShow(TVDB tvdb) 60 | { 61 | Console.WriteLine("Search for Battlestar Galactica on tvdb"); 62 | var searchResults = tvdb.Search("Battlestar Galactica"); 63 | DisplaySearchResult.Print(searchResults); 64 | Console.WriteLine("-----------"); 65 | } 66 | 67 | private static void GetUpdates(TVDB tvdb) 68 | { 69 | var updates = tvdb.GetUpdates(Interval.Day); 70 | Console.WriteLine("Updates during the last 24 hours on thetvdb, since {0}", updates.Timestamp); 71 | DisplayUpdates.Print(updates); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Utilities/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using TVDBSharp.Models.Enums; 4 | 5 | namespace TVDBSharp.Utilities 6 | { 7 | /// 8 | /// Provides static utility methods. 9 | /// 10 | public static class Utils 11 | { 12 | /// 13 | /// Parses a string of format yyyy-MM-dd to a object. 14 | /// 15 | /// String to be parsed. 16 | /// Returns a representation. 17 | public static DateTime ParseDate(string value) 18 | { 19 | DateTime date; 20 | DateTime.TryParseExact(value, "yyyy-MM-dd", CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal, out date); 21 | return date; 22 | } 23 | 24 | /// 25 | /// Parses a string of format hh:mm tt to a object. 26 | /// 27 | /// String to be parsed. 28 | /// Returns a representation. 29 | public static TimeSpan ParseTime(string value) 30 | { 31 | DateTime date; 32 | 33 | if (!DateTime.TryParse(value, out date)) 34 | { 35 | return new TimeSpan(); 36 | } 37 | return date.TimeOfDay; 38 | } 39 | 40 | /// 41 | /// Translates the incoming string to a enum, if applicable. 42 | /// 43 | /// The rating in string format. 44 | /// Returns the appropriate value. 45 | /// Throws an exception if no conversion could be applied. 46 | public static ContentRating GetContentRating(string rating) 47 | { 48 | switch (rating) 49 | { 50 | case "TV-14": 51 | return ContentRating.TV14; 52 | 53 | case "TV-PG": 54 | return ContentRating.TVPG; 55 | 56 | case "TV-Y": 57 | return ContentRating.TVY; 58 | 59 | case "TV-Y7": 60 | return ContentRating.TVY7; 61 | 62 | case "TV-G": 63 | return ContentRating.TVG; 64 | 65 | case "TV-MA": 66 | return ContentRating.TVMA; 67 | 68 | default: 69 | return ContentRating.Unknown; 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/TVDB.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using TVDBSharp.Models; 3 | using TVDBSharp.Models.DAO; 4 | using TVDBSharp.Models.Enums; 5 | 6 | namespace TVDBSharp 7 | { 8 | /// 9 | /// The main class which will handle all user interaction. 10 | /// 11 | public class TVDB 12 | { 13 | private readonly IDataProvider _dataProvider; 14 | 15 | /// 16 | /// Creates a new instance with the provided API key and dataProvider. 17 | /// 18 | /// The API key provided by TVDB. 19 | /// Specify your own instance. 20 | public TVDB(string apiKey, IDataProvider dataProvider) 21 | { 22 | _dataProvider = dataProvider; 23 | _dataProvider.ApiKey = apiKey; 24 | } 25 | 26 | /// 27 | /// Creates a new instance with the provided API key and standard . 28 | /// 29 | /// The API key provided by TVDB. 30 | public TVDB(string apiKey) 31 | { 32 | _dataProvider = new DataProvider {ApiKey = apiKey}; 33 | } 34 | 35 | /// 36 | /// Search for a show in the database. 37 | /// 38 | /// Query that identifies the show. 39 | /// Maximal amount of results in the returning set. Default is 5. 40 | /// Returns a list of shows. 41 | public List Search(string query, int results = 5) 42 | { 43 | return new Builder(_dataProvider).Search(query, results); 44 | } 45 | 46 | /// 47 | /// Get a specific show based on its ID. 48 | /// 49 | /// ID of the show. 50 | /// Returns the corresponding show. 51 | public Show GetShow(int showId) 52 | { 53 | return new Builder(_dataProvider).BuildShow(showId); 54 | } 55 | 56 | /// 57 | /// Get a specific episode based on its ID. 58 | /// 59 | /// ID of the episode 60 | /// ISO 639-1 language code for the episode 61 | /// The corresponding episode 62 | public Episode GetEpisode(int episodeId, string lang = "en") 63 | { 64 | return new Builder(_dataProvider).BuildEpisode(episodeId, lang); 65 | } 66 | 67 | public Updates GetUpdates(Interval interval) 68 | { 69 | return new Builder(_dataProvider).BuildUpdates(interval); 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /TVDBSharp/Tests/TestDataProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Xml.Linq; 5 | using System.Xml.Serialization; 6 | using Tests.Models; 7 | using TVDBSharp.Models.DAO; 8 | using TVDBSharp.Models.Enums; 9 | 10 | namespace Tests 11 | { 12 | /// 13 | /// Dataprovider used for testing. This class generates XML trees to be used for parsing tests. 14 | /// 15 | public class TestDataProvider : IDataProvider 16 | { 17 | private readonly TestData _data; 18 | 19 | public string ApiKey { get; set; } 20 | 21 | /// 22 | /// Initializes a new instance with the provided testing data. 23 | /// 24 | /// Mocking data of type . 25 | public TestDataProvider(TestData data) 26 | { 27 | _data = data; 28 | } 29 | 30 | public XDocument GetShow(int showID) 31 | { 32 | var showData = _data.GetShowData(); 33 | var episodeData = _data.GetEpisodeData(); 34 | var show = new Data {TestShow = new TestShow()}; 35 | 36 | // Dynamically create the show object 37 | foreach (var key in showData.Keys) 38 | { 39 | var prop = show.TestShow.GetType().GetProperty(key.XmlValue); 40 | prop.SetValue(show.TestShow, showData[key].XmlValue, null); 41 | } 42 | 43 | // Add episodes to the show object 44 | show.TestShow.Episodes = new List(); 45 | foreach (var ep in episodeData) 46 | { 47 | var newEpisode = new TestEpisode(); 48 | 49 | foreach (var key in ep.Keys) 50 | { 51 | var prop = newEpisode.GetType().GetProperty(key.XmlValue); 52 | prop.SetValue(newEpisode, ep[key].XmlValue, null); 53 | } 54 | 55 | show.TestShow.Episodes.Add(newEpisode); 56 | } 57 | 58 | // Pull the created object trough an XML serializer 59 | var serializer = new XmlSerializer(show.GetType()); 60 | string xml; 61 | 62 | using (var writer = new StringWriter()) 63 | { 64 | serializer.Serialize(writer, show); 65 | xml = writer.ToString(); 66 | } 67 | 68 | return XDocument.Parse(xml); 69 | } 70 | 71 | public XDocument GetEpisode(int episodeId, string lang) 72 | { 73 | throw new NotImplementedException(); 74 | } 75 | 76 | public XDocument GetUpdates(Interval interval) 77 | { 78 | throw new NotImplementedException(); 79 | } 80 | 81 | public XDocument Search(string query) 82 | { 83 | throw new NotImplementedException(); 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # App.Config with API key 2 | TVDBSharp/Examples/App.config 3 | 4 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 5 | [Bb]in/ 6 | [Oo]bj/ 7 | 8 | # log folder 9 | Logs 10 | 11 | # mstest test results 12 | TestResults 13 | 14 | ## Ignore Visual Studio temporary files, build results, and 15 | ## files generated by popular Visual Studio add-ons. 16 | 17 | # User-specific files 18 | *.suo 19 | *.user 20 | *.sln.docstates 21 | # Build results 22 | 23 | [Dd]ebug/ 24 | [Rr]elease/ 25 | x64/ 26 | build/ 27 | [Bb]in/ 28 | [Oo]bj/ 29 | 30 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 31 | !packages/*/build/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | *_i.c 38 | *_p.c 39 | *.ilk 40 | *.meta 41 | *.obj 42 | *.pch 43 | *.pdb 44 | *.pgc 45 | *.pgd 46 | *.rsp 47 | *.sbr 48 | *.tlb 49 | *.tli 50 | *.tlh 51 | *.tmp 52 | *.tmp_proj 53 | *.log 54 | *.vspscc 55 | *.vssscc 56 | .builds 57 | *.pidb 58 | *.log 59 | *.scc 60 | 61 | # Visual C++ cache files 62 | ipch/ 63 | *.aps 64 | *.ncb 65 | *.opensdf 66 | *.sdf 67 | *.cachefile 68 | 69 | # Visual Studio profiler 70 | *.psess 71 | *.vsp 72 | *.vspx 73 | 74 | # Guidance Automation Toolkit 75 | *.gpState 76 | 77 | # ReSharper is a .NET coding add-in 78 | _ReSharper*/ 79 | *.[Rr]e[Ss]harper 80 | 81 | # TeamCity is a build add-in 82 | _TeamCity* 83 | 84 | # DotCover is a Code Coverage Tool 85 | *.dotCover 86 | 87 | # NCrunch 88 | *.ncrunch* 89 | .*crunch*.local.xml 90 | 91 | # Installshield output folder 92 | [Ee]xpress/ 93 | 94 | # DocProject is a documentation generator add-in 95 | DocProject/buildhelp/ 96 | DocProject/Help/*.HxT 97 | DocProject/Help/*.HxC 98 | DocProject/Help/*.hhc 99 | DocProject/Help/*.hhk 100 | DocProject/Help/*.hhp 101 | DocProject/Help/Html2 102 | DocProject/Help/html 103 | 104 | # Click-Once directory 105 | publish/ 106 | 107 | # Publish Web Output 108 | *.Publish.xml 109 | *.pubxml 110 | 111 | # NuGet Packages Directory 112 | packages/* 113 | 114 | # Windows Azure Build Output 115 | csx 116 | *.build.csdef 117 | 118 | # Windows Store app package directory 119 | AppPackages/ 120 | 121 | # Others 122 | sql/ 123 | *.Cache 124 | ClientBin/ 125 | [Ss]tyle[Cc]op.* 126 | ~$* 127 | *~ 128 | *.dbmdl 129 | *.[Pp]ublish.xml 130 | *.pfx 131 | *.publishsettings 132 | 133 | # RIA/Silverlight projects 134 | Generated_Code/ 135 | 136 | # Backup & report files from converting an old project file to a newer 137 | # Visual Studio version. Backup files are not needed, because we have git ;-) 138 | _UpgradeReport_Files/ 139 | Backup*/ 140 | UpgradeLog*.XML 141 | UpgradeLog*.htm 142 | 143 | # SQL Server files 144 | App_Data/*.mdf 145 | App_Data/*.ldf 146 | 147 | # ========================= 148 | # Windows detritus 149 | # ========================= 150 | 151 | # Windows image file caches 152 | Thumbs.db 153 | ehthumbs.db 154 | 155 | # Folder config file 156 | Desktop.ini 157 | 158 | # Recycle Bin used on file shares 159 | $RECYCLE.BIN/ 160 | 161 | # Mac crap 162 | .DS_Store 163 | -------------------------------------------------------------------------------- /TVDBSharp/Examples/Examples.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4918B205-E641-444F-8B2C-3D80D918A806} 8 | {4918B205-E641-444F-8B2C-3D80D918A806} 9 | Exe 10 | Properties 11 | Examples 12 | Examples 13 | v4.5 14 | 512 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | {0cc493d7-0a9f-4199-9615-0a977945d716} 57 | TVDBSharp 58 | 59 | 60 | 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/TVDBSharp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {0CC493D7-0A9F-4199-9615-0A977945D716} 8 | {0CC493D7-0A9F-4199-9615-0A977945D716} 9 | Library 10 | Properties 11 | TVDBSharp 12 | TVDBSharp 13 | v4.5 14 | 512 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 74 | -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/Episode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace TVDBSharp.Models 5 | { 6 | /// 7 | /// Entity describing an episode of a show. 8 | /// 9 | public class Episode 10 | { 11 | /// 12 | /// Unique identifier for an episode. 13 | /// 14 | public int Id { get; set; } 15 | 16 | /// 17 | /// Director of the episode. 18 | /// 19 | public string Director { get; set; } 20 | 21 | /// 22 | /// This episode's title. 23 | /// 24 | public string Title { get; set; } 25 | 26 | /// 27 | /// This episode's number in the appropriate season. 28 | /// 29 | public int EpisodeNumber { get; set; } 30 | 31 | /// 32 | /// This episode's season. 33 | /// 34 | public int SeasonNumber { get; set; } 35 | 36 | /// 37 | /// The date of the first time this episode has aired. 38 | /// 39 | public DateTime? FirstAired { get; set; } 40 | 41 | /// 42 | /// A list of guest stars. 43 | /// 44 | public List GuestStars { get; set; } 45 | 46 | /// 47 | /// Unique identifier on IMDb. 48 | /// 49 | public string ImdbId { get; set; } 50 | 51 | /// 52 | /// Main language spoken in the episode. 53 | /// 54 | public string Language { get; set; } 55 | 56 | /// 57 | /// A short description of the episode. 58 | /// 59 | public string Description { get; set; } 60 | 61 | /// 62 | /// Average rating as shown on IMDb. 63 | /// 64 | public double? Rating { get; set; } 65 | 66 | /// 67 | /// Amount of votes cast. 68 | /// 69 | public int RatingCount { get; set; } 70 | 71 | /// 72 | /// Writers(s) of the episode. 73 | /// 74 | public List Writers { get; set; } 75 | 76 | /// 77 | /// Let me know if you find out what this is. 78 | /// 79 | public Uri EpisodeImage { get; set; } 80 | 81 | /// 82 | /// Timestamp of the last update to this episode. 83 | /// 84 | public long? LastUpdated { get; set; } 85 | 86 | /// 87 | /// Unique identifier of the season. 88 | /// 89 | public int SeasonId { get; set; } 90 | 91 | /// 92 | /// Unique identifier of the show. 93 | /// 94 | public int SeriesId { get; set; } 95 | 96 | /// 97 | /// Height dimension of the thumbnail in pixels. 98 | /// 99 | public int? ThumbHeight { get; set; } 100 | 101 | /// 102 | /// Width dimension of the thumbnail in pixels; 103 | /// 104 | public int? ThumbWidth { get; set; } 105 | 106 | /// 107 | /// Let me know if you find out what this is. 108 | /// 109 | public string TmsExport { get; set; } 110 | } 111 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/Show.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using TVDBSharp.Models.Enums; 4 | 5 | namespace TVDBSharp.Models 6 | { 7 | /// 8 | /// Entity describing a show. 9 | /// 10 | public class Show 11 | { 12 | /// 13 | /// Unique identifier used by IMDb. 14 | /// 15 | public string ImdbId { get; set; } 16 | 17 | /// 18 | /// Unique identifier used by TVDB and TVDBSharp. 19 | /// 20 | public int Id { get; set; } 21 | 22 | /// 23 | /// List of all actors in the show. 24 | /// 25 | public List Actors { get; set; } 26 | 27 | /// 28 | /// Day of the week when the show airs. 29 | /// 30 | public Frequency? AirDay { get; set; } 31 | 32 | /// 33 | /// Time of the day when the show airs. 34 | /// 35 | public TimeSpan? AirTime { get; set; } 36 | 37 | /// 38 | /// Rating of the content provided by an official organ. 39 | /// 40 | public ContentRating ContentRating { get; set; } 41 | 42 | /// 43 | /// The date the show aired for the first time. 44 | /// 45 | public DateTime? FirstAired { get; set; } 46 | 47 | /// 48 | /// A list of genres the show is associated with. 49 | /// 50 | public List Genres { get; set; } 51 | 52 | /// 53 | /// Main language of the show. 54 | /// 55 | public string Language { get; set; } 56 | 57 | /// 58 | /// Network that broadcasts the show. 59 | /// 60 | public string Network { get; set; } 61 | 62 | /// 63 | /// A short overview of the show. 64 | /// 65 | public string Description { get; set; } 66 | 67 | /// 68 | /// Average rating as shown on IMDb. 69 | /// 70 | public double? Rating { get; set; } 71 | 72 | /// 73 | /// Amount of votes cast. 74 | /// 75 | public int RatingCount { get; set; } 76 | 77 | /// 78 | /// Let me know if you find out what this is. 79 | /// 80 | public int? Runtime { get; set; } 81 | 82 | /// 83 | /// Name of the show. 84 | /// 85 | public string Name { get; set; } 86 | 87 | /// 88 | /// Current status of the show. 89 | /// 90 | public Status Status { get; set; } 91 | 92 | /// 93 | /// Link to the banner image. 94 | /// 95 | public Uri Banner { get; set; } 96 | 97 | /// 98 | /// Link to a fanart image. 99 | /// 100 | public Uri Fanart { get; set; } 101 | 102 | /// 103 | /// Timestamp of the latest update. 104 | /// 105 | public long? LastUpdated { get; set; } 106 | 107 | /// 108 | /// Let me know if you find out what this is. 109 | /// 110 | public Uri Poster { get; set; } 111 | 112 | /// 113 | /// No clue 114 | /// 115 | public string Zap2ItID { get; set; } 116 | 117 | /// 118 | /// A list of all episodes associated with this show. 119 | /// 120 | public List Episodes { get; set; } 121 | } 122 | } -------------------------------------------------------------------------------- /TVDBSharp/Tests/MainTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using Tests.Models; 5 | using TVDBSharp.Models; 6 | using TVDBSharp.Models.DAO; 7 | 8 | namespace Tests 9 | { 10 | /// 11 | /// A collection of the most important tests which test the complete workflow excluding connecting to the web service. 12 | /// 13 | [TestClass] 14 | public class MainTests 15 | { 16 | private TestData _data; 17 | private IDataProvider _dataProvider; 18 | 19 | /// 20 | /// Initializes the test with mock data. See for more information. 21 | /// 22 | [TestInitialize] 23 | public void Initialize() 24 | { 25 | _data = new TestData(); 26 | _dataProvider = new TestDataProvider(_data); 27 | } 28 | 29 | /// 30 | /// Test the retrieval of a show. A object is created 31 | /// to accurately represent the XML tree of a show. 32 | /// Afterwards the is called 33 | /// to parse this into a object. 34 | /// This process includes creating objects. 35 | /// Finally every property is being tested to have the expected outcome a 36 | /// as detailed in . 37 | /// 38 | [TestMethod] 39 | public void GetShow() 40 | { 41 | // Pull XML tree trough the show builder 42 | var builder = new Builder(_dataProvider); 43 | 44 | var showId = int.Parse(_data.GetShowData().Keys.First(x => x.XmlValue == "id").XmlValue); 45 | var result = builder.BuildShow(showId); 46 | 47 | var showData = _data.GetShowData(); 48 | var episodeData = _data.GetEpisodeData(); 49 | 50 | // Assert equality between value conversions for show data 51 | foreach (var key in showData.Keys) 52 | { 53 | var prop = result.GetType().GetProperty(key.ObjValue); 54 | Assert.IsTrue(prop.GetValue(result).ToString() == showData[key].ObjValue, 55 | "!Show object! Property: " + prop.Name + " ;Actual object value: " + prop.GetValue(result) + 56 | " ;Expected value: " + showData[key].ObjValue); 57 | } 58 | 59 | // Assert equality between value conversion for episode data 60 | for (var i = 0; i < result.Episodes.Count; i++) 61 | { 62 | var currentEpisode = result.Episodes[i]; 63 | var dic = episodeData[i]; 64 | 65 | foreach (var key in dic.Keys) 66 | { 67 | var prop = currentEpisode.GetType().GetProperty(key.ObjValue); 68 | 69 | // Checks whether or not we're dealing with a list 70 | // ToString() method on lists will not show the values and are therefore not suited for comparison 71 | // That's why we manually check the entries 72 | if (new List {"Actors", "Genres", "GuestStars", "Writers"}.Contains(key.ObjValue)) 73 | { 74 | foreach (var entry in dic[key].XmlValue.Split('|')) 75 | { 76 | Assert.IsTrue(((List) prop.GetValue(currentEpisode)).Contains(entry), 77 | "!List object! Property: " + prop.Name + " ;Actual object value: " + 78 | string.Join(", ", (List) prop.GetValue(currentEpisode)) + ";Expected value: " + 79 | dic[key].XmlValue); 80 | } 81 | } 82 | 83 | var value = prop.GetValue(currentEpisode).ToString(); 84 | var expected = dic[key].ObjValue; 85 | Assert.IsTrue(value == expected, 86 | "!Episode object! Property: " + prop.Name + " ;Actual object value: " + 87 | prop.GetValue(currentEpisode) + " ;Expected value: " + dic[key].ObjValue); 88 | } 89 | } 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /TVDBSharp/Tests/Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F32B4596-46CB-4B07-B4B6-93B361C954A1} 8 | Library 9 | Properties 10 | Tests 11 | Tests 12 | v4.5 13 | 512 14 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 10.0 16 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 17 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 18 | False 19 | UnitTest 20 | 21 | 22 | 23 | 24 | AnyCPU 25 | true 26 | full 27 | false 28 | bin\Debug\ 29 | DEBUG;TRACE 30 | prompt 31 | 4 32 | 33 | 34 | AnyCPU 35 | pdbonly 36 | true 37 | bin\Release\ 38 | TRACE 39 | prompt 40 | 4 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {0cc493d7-0a9f-4199-9615-0a977945d716} 85 | TVDBSharp 86 | 87 | 88 | 89 | 90 | 91 | 92 | False 93 | 94 | 95 | False 96 | 97 | 98 | False 99 | 100 | 101 | False 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | {15c16b28-db0b-4233-9c0b-9e955f7fa07c} 110 | TVDBSharp 111 | 112 | 113 | 114 | 121 | -------------------------------------------------------------------------------- /TVDBSharp/Tests/TestData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Threading; 5 | using Tests.Models; 6 | using TVDBSharp.Models.Enums; 7 | 8 | namespace Tests 9 | { 10 | /// 11 | /// Provides mocking data to construct the XML tree and validate the parsed objects. 12 | /// 13 | public class TestData 14 | { 15 | private readonly Dictionary _showData = new Dictionary(); 16 | 17 | private readonly List> _episodeData = 18 | new List>(); 19 | 20 | // Using en-US culture to prevent errors when comparing doubles (comma vs dot). 21 | static TestData() 22 | { 23 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 24 | } 25 | 26 | /// 27 | /// Used to create an XML tree where the XML element names are represented 28 | /// by the key-XML value and the XML values are represented by the value-XML value. 29 | /// After using the TVDB builders: check if the resulting object's properties 30 | /// (key-Object value) has the same values as the value-Object value. 31 | /// Key-Object value and value-Object value refer to 32 | /// respectively the dictionary's key and the corresponding value. 33 | /// 34 | public TestData() 35 | { 36 | AddShowData(); 37 | AddEpisodeData(); 38 | } 39 | 40 | private void AddShowData() 41 | { 42 | #region ShowData 43 | 44 | _showData.Add(new Conversion("id", "ID"), new Conversion("76290", "76290")); 45 | _showData.Add(new Conversion("IMDB_ID", "ImdbID"), new Conversion("tt0285331", "tt0285331")); 46 | _showData.Add(new Conversion("Language", "Language"), new Conversion("en", "en")); 47 | _showData.Add(new Conversion("Actors", "Actors"), 48 | new Conversion("|Kiefer Sutherland|Carlos Bernard|Mary Lynn Rajskub|", 49 | new List(new[] {"Kiefer Sutherland", "Carlos Bernard", "Mary Lynn Rajskub"}).ToString())); 50 | _showData.Add(new Conversion("Airs_DayOfWeek", "AirDay"), new Conversion("Monday", "Monday")); 51 | _showData.Add(new Conversion("Airs_Time", "AirTime"), 52 | new Conversion("9:00 PM", new TimeSpan(21, 0, 0).ToString())); 53 | _showData.Add(new Conversion("ContentRating", "ContentRating"), 54 | new Conversion("TV-14", ContentRating.TV14.ToString())); 55 | _showData.Add(new Conversion("FirstAired", "FirstAired"), 56 | new Conversion("2001-11-06", new DateTime(2001, 11, 06).ToString())); 57 | _showData.Add(new Conversion("Genre", "Genres"), 58 | new Conversion("|Action|Adventure|Drama|", 59 | new List(new[] {"Action", "Adventure", "Drama"}).ToString())); 60 | _showData.Add(new Conversion("Network", "Network"), new Conversion("FOX", "FOX")); 61 | _showData.Add(new Conversion("Overview", "Description"), 62 | new Conversion("24 is a TV thriller presented in real time.", 63 | "24 is a TV thriller presented in real time.")); 64 | _showData.Add(new Conversion("Rating", "Rating"), new Conversion("8.9", "8.9")); 65 | _showData.Add(new Conversion("RatingCount", "RatingCount"), new Conversion("371", "371")); 66 | _showData.Add(new Conversion("Runtime", "Runtime"), new Conversion("60", "60")); 67 | _showData.Add(new Conversion("SeriesName", "Name"), new Conversion("24", "24")); 68 | _showData.Add(new Conversion("Status", "Status"), new Conversion("Ended", Status.Ended.ToString())); 69 | _showData.Add(new Conversion("banner", "Banner"), 70 | new Conversion("graphical/76290-g14.jpg", "graphical/76290-g14.jpg")); 71 | _showData.Add(new Conversion("fanart", "Fanart"), 72 | new Conversion("fanart/original/76290-23.jpg", "fanart/original/76290-23.jpg")); 73 | _showData.Add(new Conversion("lastupdated", "LastUpdated"), new Conversion("1378608881", "1378608881")); 74 | _showData.Add(new Conversion("poster", "Poster"), 75 | new Conversion("posters/76290-4.jpg", "posters/76290-4.jpg")); 76 | _showData.Add(new Conversion("zap2it_id", "Zap2ItID"), new Conversion("SH00446604", "SH00446604")); 77 | 78 | #endregion ShowData 79 | } 80 | 81 | private void AddEpisodeData() 82 | { 83 | #region FirstEpisode 84 | 85 | var newEpisode = new Dictionary(); 86 | newEpisode.Add(new Conversion("id", "ID"), new Conversion("189258", "189258")); 87 | newEpisode.Add(new Conversion("Director", "Director"), new Conversion("Winrich Kolbe", "Winrich Kolbe")); 88 | newEpisode.Add(new Conversion("EpisodeName", "Title"), 89 | new Conversion("3:00 A.M.-4:00 A.M.", "3:00 A.M.-4:00 A.M.")); 90 | newEpisode.Add(new Conversion("EpisodeNumber", "EpisodeNumber"), new Conversion("4", "4")); 91 | newEpisode.Add(new Conversion("FirstAired", "FirstAired"), 92 | new Conversion("2001-11-27", new DateTime(2001, 11, 27).ToString())); 93 | newEpisode.Add(new Conversion("GuestStars", "GuestStars"), 94 | new Conversion("|Johnny Vasquez| Mike Siegal| Kathy Byron|", 95 | new List(new[] {"Johnny Vasquez", "Mike Siegal", "Kathy Byron"}).ToString())); 96 | newEpisode.Add(new Conversion("IMDB_ID", "ImdbID"), new Conversion("tt1091252", "tt1091252")); 97 | newEpisode.Add(new Conversion("Language", "Language"), new Conversion("en", "en")); 98 | newEpisode.Add(new Conversion("Overview", "Description"), 99 | new Conversion("With Tony in custody, Jack leads his interrogation", 100 | "With Tony in custody, Jack leads his interrogation")); 101 | newEpisode.Add(new Conversion("Rating", "Rating"), new Conversion("7.6", "7.6")); 102 | newEpisode.Add(new Conversion("RatingCount", "RatingCount"), new Conversion("57", "57")); 103 | newEpisode.Add(new Conversion("SeasonNumber", "SeasonNumber"), new Conversion("7", "7")); 104 | newEpisode.Add(new Conversion("Writer", "Writers"), 105 | new Conversion("Manny Coto | Brannon Braga", 106 | new List(new[] {"Manny Coto", "Brannon Braga"}).ToString())); 107 | newEpisode.Add(new Conversion("filename", "FileName"), 108 | new Conversion("episodes/76290/409267.jpg", "episodes/76290/409267.jpg")); 109 | newEpisode.Add(new Conversion("lastupdated", "LastUpdated"), new Conversion("1360269400", "1360269400")); 110 | newEpisode.Add(new Conversion("seasonid", "SeasonID"), new Conversion("35831", "35831")); 111 | newEpisode.Add(new Conversion("seriesid", "SeriesID"), new Conversion("76290", "76290")); 112 | newEpisode.Add(new Conversion("thumb_height", "ThumbHeight"), new Conversion("225", "225")); 113 | newEpisode.Add(new Conversion("thumb_width", "ThumbWidth"), new Conversion("400", "400")); 114 | newEpisode.Add(new Conversion("tms_export", "TmsExport"), new Conversion("1374789754", "1374789754")); 115 | _episodeData.Add(newEpisode); 116 | 117 | #endregion FirstEpisode 118 | 119 | #region SecondEpisode 120 | 121 | newEpisode = new Dictionary(); 122 | newEpisode.Add(new Conversion("id", "ID"), new Conversion("1482791", "1482791")); 123 | newEpisode.Add(new Conversion("Director", "Director"), 124 | new Conversion("Nelson McCormick", "Nelson McCormick")); 125 | newEpisode.Add(new Conversion("EpisodeName", "Title"), 126 | new Conversion("Day 8: 3:00 A.M. - 4:00 A.M.", "Day 8: 3:00 A.M. - 4:00 A.M.")); 127 | newEpisode.Add(new Conversion("EpisodeNumber", "EpisodeNumber"), new Conversion("12", "12")); 128 | newEpisode.Add(new Conversion("FirstAired", "FirstAired"), 129 | new Conversion("2010-03-14", new DateTime(2010, 03, 14).ToString())); 130 | newEpisode.Add(new Conversion("GuestStars", "GuestStars"), 131 | new Conversion("|Kiefer Sutherland|Annie Wersching|Mary Lynn Rajskub|", 132 | new List(new[] {"Kiefer Sutherland", "Annie Wersching", "Mary Lynn Rajskub"}).ToString())); 133 | newEpisode.Add(new Conversion("IMDB_ID", "ImdbID"), new Conversion("tt1463812", "tt1463812")); 134 | newEpisode.Add(new Conversion("Language", "Language"), new Conversion("en", "en")); 135 | newEpisode.Add(new Conversion("Overview", "Description"), 136 | new Conversion( 137 | "While Jack and Cole team up in the field to shield New York from the calamitous threat", 138 | "While Jack and Cole team up in the field to shield New York from the calamitous threat")); 139 | newEpisode.Add(new Conversion("Rating", "Rating"), new Conversion("8.0", "8")); 140 | newEpisode.Add(new Conversion("RatingCount", "RatingCount"), new Conversion("106", "106")); 141 | newEpisode.Add(new Conversion("SeasonNumber", "SeasonNumber"), new Conversion("8", "8")); 142 | newEpisode.Add(new Conversion("Writer", "Writers"), 143 | new Conversion("Chip Johannessen|Patrick Harbinson", 144 | new List(new[] {"Chip Johannessen", "Patrick Harbinson"}).ToString())); 145 | newEpisode.Add(new Conversion("filename", "FileName"), 146 | new Conversion("episodes/76290/1482791.jpg", "episodes/76290/1482791.jpg")); 147 | newEpisode.Add(new Conversion("lastupdated", "LastUpdated"), new Conversion("1360269825", "1360269825")); 148 | newEpisode.Add(new Conversion("seasonid", "SeasonID"), new Conversion("83471", "83471")); 149 | newEpisode.Add(new Conversion("seriesid", "SeriesID"), new Conversion("76290", "76290")); 150 | newEpisode.Add(new Conversion("thumb_height", "ThumbHeight"), new Conversion("225", "225")); 151 | newEpisode.Add(new Conversion("thumb_width", "ThumbWidth"), new Conversion("400", "400")); 152 | newEpisode.Add(new Conversion("tms_export", "TmsExport"), new Conversion("1374789754", "1374789754")); 153 | _episodeData.Add(newEpisode); 154 | 155 | #endregion SecondEpisode 156 | } 157 | 158 | /// 159 | /// Returns the dictionary with show data. 160 | /// 161 | /// Show data. 162 | public Dictionary GetShowData() 163 | { 164 | return _showData; 165 | } 166 | 167 | /// 168 | /// Returns the dictionary with episode data. 169 | /// 170 | /// Episode data. 171 | public List> GetEpisodeData() 172 | { 173 | return _episodeData; 174 | } 175 | } 176 | } -------------------------------------------------------------------------------- /TVDBSharp/TVDBSharp/Models/Builder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Xml.Linq; 5 | using TVDBSharp.Models.DAO; 6 | using TVDBSharp.Models.Enums; 7 | using TVDBSharp.Utilities; 8 | 9 | namespace TVDBSharp.Models 10 | { 11 | /// 12 | /// Provides builder classes for complex entities. 13 | /// 14 | public class Builder 15 | { 16 | private const string UriPrefix = "http://thetvdb.com/banners/"; 17 | private readonly IDataProvider _dataProvider; 18 | 19 | /// 20 | /// Initializes a new Builder object with the given . 21 | /// 22 | /// The DataProvider used to retrieve XML responses. 23 | public Builder(IDataProvider dataProvider) 24 | { 25 | _dataProvider = dataProvider; 26 | } 27 | 28 | /// 29 | /// Builds a show object from the given show ID. 30 | /// 31 | /// ID of the show to serialize into a object. 32 | /// Returns the Show object. 33 | public Show BuildShow(int showID) 34 | { 35 | var builder = new ShowBuilder(_dataProvider.GetShow(showID)); 36 | return builder.GetResult(); 37 | } 38 | 39 | public Episode BuildEpisode(int episodeId, string lang) 40 | { 41 | var builder = new EpisodeBuilder(_dataProvider.GetEpisode(episodeId, lang).Descendants("Episode").First()); 42 | return builder.GetResult(); 43 | } 44 | 45 | public Updates BuildUpdates(Interval interval) 46 | { 47 | var builder = new UpdatesBuilder(_dataProvider.GetUpdates(interval)); 48 | return builder.GetResult(); 49 | } 50 | 51 | /// 52 | /// Returns a list of objects that match the given query. 53 | /// 54 | /// Query the search is performed with. 55 | /// Maximal amount of shows the resultset should return. 56 | /// Returns a list of show objects. 57 | public List Search(string query, int results) 58 | { 59 | var shows = new List(results); 60 | var doc = _dataProvider.Search(query); 61 | 62 | foreach (var element in doc.Descendants("Series").Take(results)) 63 | { 64 | var id = int.Parse(element.GetXmlData("seriesid")); 65 | var response = _dataProvider.GetShow(id); 66 | shows.Add(new ShowBuilder(response).GetResult()); 67 | } 68 | 69 | return shows; 70 | } 71 | 72 | private static Uri GetBannerUri(string uriSuffix) 73 | { 74 | return new Uri(UriPrefix + uriSuffix, UriKind.Absolute); 75 | } 76 | 77 | private class ShowBuilder 78 | { 79 | private readonly Show _show; 80 | 81 | public ShowBuilder(XDocument doc) 82 | { 83 | _show = new Show(); 84 | _show.Id = int.Parse(doc.GetSeriesData("id")); 85 | _show.ImdbId = doc.GetSeriesData("IMDB_ID"); 86 | _show.Name = doc.GetSeriesData("SeriesName"); 87 | _show.Language = doc.GetSeriesData("Language"); 88 | _show.Network = doc.GetSeriesData("Network"); 89 | _show.Description = doc.GetSeriesData("Overview"); 90 | _show.Rating = string.IsNullOrWhiteSpace(doc.GetSeriesData("Rating")) 91 | ? (double?) null 92 | : Convert.ToDouble(doc.GetSeriesData("Rating"), 93 | System.Globalization.CultureInfo.InvariantCulture); 94 | _show.RatingCount = string.IsNullOrWhiteSpace(doc.GetSeriesData("RatingCount")) 95 | ? 0 96 | : Convert.ToInt32(doc.GetSeriesData("RatingCount")); 97 | _show.Runtime = string.IsNullOrWhiteSpace(doc.GetSeriesData("Runtime")) 98 | ? (int?) null 99 | : Convert.ToInt32(doc.GetSeriesData("Runtime")); 100 | _show.Banner = GetBannerUri(doc.GetSeriesData("banner")); 101 | _show.Fanart = GetBannerUri(doc.GetSeriesData("fanart")); 102 | _show.LastUpdated = string.IsNullOrWhiteSpace(doc.GetSeriesData("lastupdated")) 103 | ? (long?) null 104 | : Convert.ToInt64(doc.GetSeriesData("lastupdated")); 105 | _show.Poster = GetBannerUri(doc.GetSeriesData("poster")); 106 | _show.Zap2ItID = doc.GetSeriesData("zap2it_id"); 107 | _show.FirstAired = string.IsNullOrWhiteSpace(doc.GetSeriesData("FirstAired")) 108 | ? (DateTime?) null 109 | : Utils.ParseDate(doc.GetSeriesData("FirstAired")); 110 | _show.AirTime = string.IsNullOrWhiteSpace(doc.GetSeriesData("Airs_Time")) 111 | ? (TimeSpan?) null 112 | : Utils.ParseTime(doc.GetSeriesData("Airs_Time")); 113 | _show.AirDay = string.IsNullOrWhiteSpace(doc.GetSeriesData("Airs_DayOfWeek")) 114 | ? (Frequency?) null 115 | : (Frequency) Enum.Parse(typeof (Frequency), doc.GetSeriesData("Airs_DayOfWeek")); 116 | _show.Status = string.IsNullOrWhiteSpace(doc.GetSeriesData("Status")) 117 | ? Status.Unknown 118 | : (Status) Enum.Parse(typeof (Status), doc.GetSeriesData("Status")); 119 | _show.ContentRating = Utils.GetContentRating(doc.GetSeriesData("ContentRating")); 120 | _show.Genres = 121 | new List(doc.GetSeriesData("Genre") 122 | .Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)); 123 | _show.Actors = 124 | new List(doc.GetSeriesData("Actors") 125 | .Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)); 126 | _show.Episodes = new EpisodesBuilder(doc).BuildEpisodes(); 127 | } 128 | 129 | public Show GetResult() 130 | { 131 | return _show; 132 | } 133 | } 134 | 135 | public class EpisodeBuilder 136 | { 137 | private readonly Episode _episode; 138 | 139 | public EpisodeBuilder(XElement episodeNode) 140 | { 141 | _episode = new Episode 142 | { 143 | Id = int.Parse(episodeNode.GetXmlData("id")), 144 | Title = episodeNode.GetXmlData("EpisodeName"), 145 | Description = episodeNode.GetXmlData("Overview"), 146 | EpisodeNumber = int.Parse(episodeNode.GetXmlData("EpisodeNumber")), 147 | Director = episodeNode.GetXmlData("Director"), 148 | EpisodeImage = GetBannerUri(episodeNode.GetXmlData("filename")), 149 | FirstAired = 150 | string.IsNullOrWhiteSpace(episodeNode.GetXmlData("FirstAired")) 151 | ? (DateTime?) null 152 | : Utils.ParseDate(episodeNode.GetXmlData("FirstAired")), 153 | GuestStars = 154 | new List(episodeNode.GetXmlData("GuestStars") 155 | .Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)), 156 | ImdbId = episodeNode.GetXmlData("IMDB_ID"), 157 | Language = episodeNode.GetXmlData("Language"), 158 | LastUpdated = 159 | string.IsNullOrWhiteSpace(episodeNode.GetXmlData("lastupdated")) 160 | ? 0L 161 | : Convert.ToInt64(episodeNode.GetXmlData("lastupdated")), 162 | Rating = 163 | string.IsNullOrWhiteSpace(episodeNode.GetXmlData("Rating")) 164 | ? (double?) null 165 | : Convert.ToDouble(episodeNode.GetXmlData("Rating"), 166 | System.Globalization.CultureInfo.InvariantCulture), 167 | RatingCount = 168 | string.IsNullOrWhiteSpace(episodeNode.GetXmlData("RatingCount")) 169 | ? 0 170 | : Convert.ToInt32(episodeNode.GetXmlData("RatingCount")), 171 | SeasonId = int.Parse(episodeNode.GetXmlData("seasonid")), 172 | SeasonNumber = int.Parse(episodeNode.GetXmlData("SeasonNumber")), 173 | SeriesId = int.Parse(episodeNode.GetXmlData("seriesid")), 174 | ThumbHeight = 175 | string.IsNullOrWhiteSpace(episodeNode.GetXmlData("thumb_height")) 176 | ? (int?) null 177 | : Convert.ToInt32(episodeNode.GetXmlData("thumb_height")), 178 | ThumbWidth = 179 | string.IsNullOrWhiteSpace(episodeNode.GetXmlData("thumb_width")) 180 | ? (int?) null 181 | : Convert.ToInt32(episodeNode.GetXmlData("thumb_width")), 182 | TmsExport = episodeNode.GetXmlData("tms_export"), 183 | Writers = 184 | new List(episodeNode.GetXmlData("Writer") 185 | .Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)) 186 | }; 187 | } 188 | 189 | public Episode GetResult() 190 | { 191 | return _episode; 192 | } 193 | } 194 | 195 | private class EpisodesBuilder 196 | { 197 | private readonly XDocument _doc; 198 | 199 | public EpisodesBuilder(XDocument doc) 200 | { 201 | _doc = doc; 202 | } 203 | 204 | public List BuildEpisodes() 205 | { 206 | var result = new List(); 207 | 208 | foreach (var episodeNode in _doc.Descendants("Episode")) 209 | { 210 | var episode = new EpisodeBuilder(episodeNode).GetResult(); 211 | result.Add(episode); 212 | } 213 | 214 | return result; 215 | } 216 | } 217 | 218 | public class UpdatesBuilder 219 | { 220 | private readonly Updates _updates; 221 | 222 | public UpdatesBuilder(XDocument doc) 223 | { 224 | if (doc.Root != null) 225 | { 226 | _updates = new Updates 227 | { 228 | Time = int.Parse(doc.Root.Attribute("time").Value), 229 | UpdatedSeries = doc.Root.Elements("Series") 230 | .Select(elt => new UpdatedSerie 231 | { 232 | Id = int.Parse(elt.Element("id").Value), 233 | Time = int.Parse(elt.Element("time").Value) 234 | }) 235 | .ToList(), 236 | UpdatedEpisodes = doc.Root.Elements("Episode") 237 | .Select(elt => new UpdatedEpisode 238 | { 239 | Id = int.Parse(elt.Element("id").Value), 240 | SerieId = int.Parse(elt.Element("Series").Value), 241 | Time = int.Parse(elt.Element("time").Value) 242 | }) 243 | .ToList(), 244 | UpdatedBanners = doc.Root.Elements("Banner") 245 | .Select(elt => new UpdatedBanner 246 | { 247 | SerieId = int.Parse(elt.Element("Series").Value), 248 | Format = elt.Element("format").Value, 249 | Language = 250 | elt.Elements("language").Select(n => n.Value).FirstOrDefault() ?? string.Empty, 251 | Path = elt.Element("path").Value, 252 | Type = elt.Element("type").Value, 253 | SeasonNumber = elt.Elements("SeasonNumber").Any() 254 | ? int.Parse(elt.Element("SeasonNumber").Value) 255 | : (int?) null, 256 | Time = int.Parse(elt.Element("time").Value) 257 | }) 258 | .ToList() 259 | }; 260 | } 261 | } 262 | 263 | public Updates GetResult() 264 | { 265 | return _updates; 266 | } 267 | } 268 | } 269 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | A C# wrapper for the TVDB API. 294 | Copyright (C) 2013 Jeroen Vannevel 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------