Skip to content

Commit

Permalink
Added more resilient podcast download.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTV12345 committed May 1, 2023
1 parent 3e317f5 commit c643297
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/service/podcast_episode_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,13 @@ impl PodcastEpisodeService {

}
None => {
let opt_enclosure = &item.enclosure;
if opt_enclosure.is_none() {
log::info!("Skipping episode {} without enclosure.", item.clone().title.unwrap_or("with no title".to_string()));
continue;
}
let result = DB::get_podcast_episode_by_url(
conn,
&item
.enclosure()
.expect("A podcast episode needs to have a podcast url")
.url
.to_string(),
);
conn, &opt_enclosure.clone().unwrap().url);
// We can't retrieve the duration of the podcast episode, so we set it to 0

if result.unwrap().is_none() {
Expand Down
13 changes: 11 additions & 2 deletions ui/src/components/AddPodcast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const AddPodcast = ()=>{
handleInputChanged(e)}
} /></>}
{
files.length > 0&& !opmlUploading && <div>
files.length > 0&& !opmlUploading && files.length===0 && <div>
{t('following-file-uploaded')}
<div className="ml-4" onClick={()=>{setFiles([])}}>{files[0].name}<i className="ml-5 fa-solid cursor-pointer active:scale-90 fa-x text-red-700"></i></div>
</div>
Expand All @@ -211,9 +211,18 @@ export const AddPodcast = ()=>{
</div>{ podcastsToUpload>0 && progress.length>0&&<div className="mt-2 w-full rounded-full h-2.5 bg-gray-700">

<div className="bg-blue-600 h-2.5 rounded-full" style={{width:`${(progress.length/podcastsToUpload)*100}%`}}></div>
</div>}
{
!opmlUploading && <div>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} className="w-6 h-6 text-slate-800">
<path strokeLinecap="round" strokeLinejoin="round" d="M4.5 12.75l6 6 9-13.5" />
</svg>
</div>
}
</div>
}
</>
}

<div className="flex">
<div className="flex-1"/>
<button className="bg-blue-800 p-2 disabled:bg-gray-800" disabled={files.length==0} onClick={()=>{
Expand Down

0 comments on commit c643297

Please sign in to comment.