Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(file): Fixed rss feed listing #1095

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/controllers/websocket_controller.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::controllers::web_socket::chat_ws;

use crate::models::podcast_episode::PodcastEpisode;

Check warning on line 3 in src/controllers/websocket_controller.rs

View workflow job for this annotation

GitHub Actions / Rust project

unused import: `crate::models::podcast_episode::PodcastEpisode`

Check warning on line 3 in src/controllers/websocket_controller.rs

View workflow job for this annotation

GitHub Actions / Rust project

unused import: `crate::models::podcast_episode::PodcastEpisode`

Check failure on line 3 in src/controllers/websocket_controller.rs

View workflow job for this annotation

GitHub Actions / Rust lint

unused import: `crate::models::podcast_episode::PodcastEpisode`
use crate::models::podcasts::Podcast;

use crate::constants::inner_constants::ENVIRONMENT_SERVICE;
Expand All @@ -19,6 +19,7 @@
ItemBuilder,
};
use tokio::task::spawn_local;
use crate::adapters::api::models::podcast_episode_dto::PodcastEpisodeDto;

#[utoipa::path(
context_path = "/api/v1",
Expand Down Expand Up @@ -81,6 +82,10 @@
None => PodcastEpisodeService::find_all_downloaded_podcast_episodes()?,
};

let downloaded_episodes: Vec<PodcastEpisodeDto> = downloaded_episodes.into_iter().map(|c|c
.into())
.collect();

let server_url = ENVIRONMENT_SERVICE.get_server_url();
let feed_url = add_api_key_to_url(format!("{}{}", &server_url, &"rss"), &api_key);

Expand All @@ -96,7 +101,7 @@
.summary(Some("Your local rss feed for your podcasts".to_string()))
.build();

let items = get_podcast_items_rss(downloaded_episodes.clone(), &api_key);
let items = get_podcast_items_rss(&downloaded_episodes, &api_key);

let channel_builder = ChannelBuilder::default()
.language("en".to_string())
Expand Down Expand Up @@ -172,8 +177,9 @@

let podcast = Podcast::get_podcast(*id)?;

let downloaded_episodes =
PodcastEpisodeService::find_all_downloaded_podcast_episodes_by_podcast_id(*id)?;
let downloaded_episodes: Vec<PodcastEpisodeDto> =
PodcastEpisodeService::find_all_downloaded_podcast_episodes_by_podcast_id(*id)?.into_iter
().map(|c|c.into()).collect();

let mut itunes_owner = get_itunes_owner("", "");

Expand Down Expand Up @@ -212,7 +218,7 @@
.summary(podcast.summary.clone())
.build();

let items = get_podcast_items_rss(downloaded_episodes.clone(), &api_key);
let items = get_podcast_items_rss(&downloaded_episodes, &api_key);
let channel_builder = ChannelBuilder::default()
.language(podcast.clone().language)
.categories(categories)
Expand All @@ -236,7 +242,7 @@
}

fn get_podcast_items_rss(
downloaded_episodes: Vec<PodcastEpisode>,
downloaded_episodes: &Vec<PodcastEpisodeDto>,

Check failure on line 245 in src/controllers/websocket_controller.rs

View workflow job for this annotation

GitHub Actions / Rust lint

writing `&Vec` instead of `&[_]` involves a new object where a slice will do
api_key: &Option<Query<RSSAPiKey>>,
) -> Vec<Item> {
downloaded_episodes
Expand Down
Loading