From 52d304bf385e1a3290bd0b6eb4091c7d770f25c4 Mon Sep 17 00:00:00 2001 From: Ben Hills Date: Mon, 20 Feb 2023 16:54:24 +0000 Subject: [PATCH] Add support for RSS content tag. Remove unused imports. --- CHANGELOG.md | 4 ++++ lib/src/exceptions/search_exceptions.dart | 12 ++++++------ lib/src/model/episode.dart | 4 ++++ lib/src/model/genre.dart | 19 +++++++------------ lib/src/model/item.dart | 1 - lib/src/model/podcast.dart | 3 +-- lib/src/search/itunes_search.dart | 4 ---- lib/src/search/podcast_index_search.dart | 4 ---- lib/src/search/search.dart | 5 ----- pubspec.yaml | 2 +- 10 files changed, 23 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0adca09..d86b1c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.2 + +- Add support for RSS content tag. + ## 0.5.1 - Breaking change: Search provider is now passed when instantiating a Search object, rather than passing one at search time. diff --git a/lib/src/exceptions/search_exceptions.dart b/lib/src/exceptions/search_exceptions.dart index d0277cc..78a5602 100644 --- a/lib/src/exceptions/search_exceptions.dart +++ b/lib/src/exceptions/search_exceptions.dart @@ -4,21 +4,21 @@ /// Thrown if the connection times out, or we timeout /// waiting to receive the data. class PodcastTimeoutException implements Exception { - final String _message; + final String message; - PodcastTimeoutException(this._message); + PodcastTimeoutException(this.message); } /// Thrown if the search is cancelled. class PodcastCancelledException implements Exception { - final String _message; + final String message; - PodcastCancelledException(this._message); + PodcastCancelledException(this.message); } /// Thrown if we get an invalid response error. class PodcastFailedException implements Exception { - final String _message; + final String message; - PodcastFailedException(this._message); + PodcastFailedException(this.message); } diff --git a/lib/src/model/episode.dart b/lib/src/model/episode.dart index ddd538a..e0f8464 100644 --- a/lib/src/model/episode.dart +++ b/lib/src/model/episode.dart @@ -36,6 +36,9 @@ class Episode { /// Episode number int? episode; + /// Content + String? content; + /// Length of the episode as a [Duration]. final Duration? duration; @@ -54,6 +57,7 @@ class Episode { this.imageUrl, this.season, this.episode, + this.content, this.chapters, }); } diff --git a/lib/src/model/genre.dart b/lib/src/model/genre.dart index 19641c2..d1a98a5 100644 --- a/lib/src/model/genre.dart +++ b/lib/src/model/genre.dart @@ -4,23 +4,18 @@ /// A class that represents the genre(s) the podcast is related to. class Genre { /// Genre ID. - final int _id; + final int id; /// Genre name. - final String _name; + final String name; - Genre(this._id, this._name); - - const Genre._(int id, String name) - : _id = id, - _name = name; + const Genre( + this.id, + this.name, + ); @override String toString() { - return '$_id: $_name'; + return '$id: $name'; } - - int get id => _id; - - String get name => _name; } diff --git a/lib/src/model/item.dart b/lib/src/model/item.dart index ce07669..6bc7313 100644 --- a/lib/src/model/item.dart +++ b/lib/src/model/item.dart @@ -2,7 +2,6 @@ // MIT license that can be found in the LICENSE file. import 'package:podcast_search/podcast_search.dart'; -import 'package:podcast_search/src/model/genre.dart'; /// A class that represents an individual Podcast within the search results. Not all /// properties may contain values for all search providers. diff --git a/lib/src/model/podcast.dart b/lib/src/model/podcast.dart index f9c0721..670cbd5 100644 --- a/lib/src/model/podcast.dart +++ b/lib/src/model/podcast.dart @@ -9,8 +9,6 @@ import 'package:dio/dio.dart'; import 'package:podcast_search/podcast_search.dart'; import 'package:podcast_search/src/model/chapter.dart'; import 'package:podcast_search/src/model/chapter_headers.dart'; -import 'package:podcast_search/src/model/chapters.dart'; -import 'package:podcast_search/src/model/episode.dart'; import 'package:podcast_search/src/model/funding.dart'; import 'package:podcast_search/src/model/locked.dart'; import 'package:podcast_search/src/search/base_search.dart'; @@ -299,6 +297,7 @@ class Podcast { imageUrl: item.itunes?.image?.href, season: item.itunes?.season, episode: item.itunes?.episode, + content: item.content?.value, chapters: chapters, )); }); diff --git a/lib/src/search/itunes_search.dart b/lib/src/search/itunes_search.dart index 004c120..84f4a3b 100644 --- a/lib/src/search/itunes_search.dart +++ b/lib/src/search/itunes_search.dart @@ -5,10 +5,6 @@ import 'dart:convert'; import 'package:dio/dio.dart'; import 'package:podcast_search/podcast_search.dart'; -import 'package:podcast_search/src/model/attribute.dart'; -import 'package:podcast_search/src/model/country.dart'; -import 'package:podcast_search/src/model/language.dart'; -import 'package:podcast_search/src/model/search_result.dart'; import 'package:podcast_search/src/search/base_search.dart'; /// This class handles the searching. Taking the base URL we build any parameters diff --git a/lib/src/search/podcast_index_search.dart b/lib/src/search/podcast_index_search.dart index d7bc2cb..15daa42 100644 --- a/lib/src/search/podcast_index_search.dart +++ b/lib/src/search/podcast_index_search.dart @@ -7,10 +7,6 @@ import 'package:convert/convert.dart'; import 'package:crypto/crypto.dart'; import 'package:dio/dio.dart'; import 'package:podcast_search/podcast_search.dart'; -import 'package:podcast_search/src/model/attribute.dart'; -import 'package:podcast_search/src/model/country.dart'; -import 'package:podcast_search/src/model/language.dart'; -import 'package:podcast_search/src/model/search_result.dart'; import 'package:podcast_search/src/search/base_search.dart'; /// This class handles the searching. Taking the base URL we build any parameters diff --git a/lib/src/search/search.dart b/lib/src/search/search.dart index 2e1f874..812926d 100644 --- a/lib/src/search/search.dart +++ b/lib/src/search/search.dart @@ -2,13 +2,8 @@ // MIT license that can be found in the LICENSE file. import 'package:podcast_search/podcast_search.dart'; -import 'package:podcast_search/src/model/attribute.dart'; -import 'package:podcast_search/src/model/country.dart'; -import 'package:podcast_search/src/model/language.dart'; -import 'package:podcast_search/src/model/search_result.dart'; import 'package:podcast_search/src/search/itunes_search.dart'; import 'package:podcast_search/src/search/podcast_index_search.dart'; -import 'package:podcast_search/src/search/providers/providers.dart'; /// This class handles the searching. Taking the base URL we build any parameters /// that have been added before making a call to iTunes. The results are unpacked diff --git a/pubspec.yaml b/pubspec.yaml index 0d6b830..2ca49fe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: podcast_search description: A library for searching for podcasts, parsing podcast RSS feeds and obtaining episodes details. Supports searching via iTunes and PodcastIndex (preview). -version: 0.5.1 +version: 0.5.2 homepage: https://github.com/amugofjava/podcast_search environment: