コード例 #1
0
ファイル: TvDb.cs プロジェクト: jsmarble/tvdbdotnet
 /// <summary>
 /// Gets the url for the series zip file from TvDb.
 /// </summary>
 /// <returns>the series zip url.</returns>
 public virtual string GetSeriesZipUrl(TvDbSeriesBase seriesBase)
 {
     TvDbMirror mirror = GetMirror(TvDbMirrorType.Zip);
     string url = string.Format("{0}api/{1}/series/{2}/all/{3}.zip", mirror.Url, this.apiKey, seriesBase.Id, this.GetLanguage().Abbreviation);
     return url;
 }
コード例 #2
0
ファイル: TvDb.cs プロジェクト: jsmarble/tvdbdotnet
 /// <summary>
 /// Generates a zip file path based on the temp path and specified TvDbSeriesBase.
 /// </summary>
 /// <param name="seriesBase">The series.</param>
 /// <returns>a generated file path.</returns>
 public virtual string GetSeriesZipPath(TvDbSeriesBase seriesBase)
 {
     string file = string.Format("{0} [{1}].zip", seriesBase.Name, this.GetLanguage().Abbreviation);
     string path = Path.Combine(GetTempPath(), "TvDb", "Series", file);
     return path;
 }
コード例 #3
0
ファイル: TvDb.cs プロジェクト: jsmarble/tvdbdotnet
        /// <summary>
        /// Downloads the series zip file for the specified TvDbSeriesBase.
        /// </summary>
        /// <param name="seriesBase">The base series.</param>
        /// <param name="path">The path to which to download the zip file.</param>
        /// <returns>the path to the downloaded zip file.</returns>
        public virtual string DownloadSeriesZip(TvDbSeriesBase seriesBase, string path)
        {
            if (!File.Exists(path))
            {
                string url = GetSeriesZipUrl(seriesBase);

                Directory.CreateDirectory(Path.GetDirectoryName(path));
                using (WebClient wc = new WebClient())
                    wc.DownloadFile(url, path);
            }
            return path;
        }
コード例 #4
0
ファイル: TvDb.cs プロジェクト: jsmarble/tvdbdotnet
 /// <summary>
 /// Gets the full series information for the specified TvDbSeriesBase.
 /// </summary>
 /// <param name="seriesBase">The base series.</param>
 /// <returns>a TvDbSeries object.</returns>
 public virtual TvDbSeries GetSeries(TvDbSeriesBase seriesBase)
 {
     string file = DownloadSeriesZip(seriesBase);
     string extracted = ExtractZip(file);
     string xmlFile = Path.Combine(extracted, this.GetLanguage().Abbreviation + ".xml");
     string xml = File.ReadAllText(xmlFile);
     TvDbSeriesXmlReader reader = new TvDbSeriesXmlReader();
     TvDbSeries series = reader.Read(xml);
     return series;
 }
コード例 #5
0
ファイル: TvDb.cs プロジェクト: jsmarble/tvdbdotnet
 /// <summary>
 /// Downloads the series zip file for the specified TvDbSeriesBase.
 /// </summary>
 /// <param name="seriesBase">The base series.</param>
 /// <returns>the path to the downloaded zip file.</returns>
 public virtual string DownloadSeriesZip(TvDbSeriesBase seriesBase)
 {
     string path = GetSeriesZipPath(seriesBase);
     return this.DownloadSeriesZip(seriesBase, path);
 }