-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
814 add list of gpodder synchronized podcasts (#906)
* Added gpodder list in UI for syncing podcasts across devices * Fixed clippy --------- Co-authored-by: SamTV12345 <noreply+samtv1235@github.com>
- Loading branch information
1 parent
9392229
commit a7ea8a6
Showing
11 changed files
with
146 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use diesel::sql_types::Text; | ||
use diesel::{Queryable, QueryableByName}; | ||
|
||
#[derive(Serialize, QueryableByName, Queryable)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct GPodderAvailablePodcasts { | ||
#[diesel(sql_type = Text)] | ||
pub device: String, | ||
#[diesel(sql_type = Text)] | ||
pub podcast: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import axios, {AxiosResponse} from "axios"; | ||
import {Setting} from "../models/Setting"; | ||
import {useState} from "react"; | ||
import {useTranslation} from "react-i18next"; | ||
import {Podcast} from "../store/CommonSlice"; | ||
import {handleAddPodcast} from "../utils/ErrorSnackBarResponses"; | ||
import {CustomButtonPrimary} from "../components/CustomButtonPrimary"; | ||
|
||
type GPodderIntegrationItem = { | ||
device: string, | ||
podcast: string | ||
} | ||
|
||
|
||
export const GPodderIntegration = ()=> { | ||
const [gpodderOnlyPodcasts, setGPodderOnlyPodcasts] = useState<GPodderIntegrationItem[]>([]) | ||
const {t} = useTranslation() | ||
|
||
axios.get('/podcast/available/gpodder') | ||
.then((res: AxiosResponse<GPodderIntegrationItem[]>) => { | ||
console.log("Res is",res) | ||
setGPodderOnlyPodcasts(res.data) | ||
}) | ||
|
||
const addPodcast = (feedUrl: string)=>{ | ||
setGPodderOnlyPodcasts(gpodderOnlyPodcasts.filter(p=>p.podcast!=feedUrl)) | ||
axios.post( '/podcast/feed', { | ||
rssFeedUrl: feedUrl | ||
}).then((v: AxiosResponse<Podcast>) => { | ||
handleAddPodcast(v.status, v.data.name, t) | ||
}) | ||
} | ||
|
||
|
||
return <table className="text-left text-sm text-stone-900 w-full overflow-y-auto text-[--fg-color]"> | ||
<thead> | ||
<tr className="border-b border-stone-300"> | ||
<th scope="col" className="pr-2 py-3 text-[--fg-color]"> | ||
# | ||
</th> | ||
<th scope="col" className="px-2 py-3 text-[--fg-color]"> | ||
{t('device')} | ||
</th> | ||
<th scope="col" className="px-2 py-3 text-[--fg-color]"> | ||
{t('podcasts')} | ||
</th> | ||
<th scope="col" className="px-2 py-3 text-[--fg-color]"> | ||
{t('actions')} | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody className=""> | ||
{ | ||
gpodderOnlyPodcasts?.map((int, index)=>{ | ||
return <tr key={index}> | ||
<td className="px-2 py-4 text-[--fg-color]">{index}</td> | ||
<td className="px-2 py-4 text-[--fg-color]">{int.device}</td> | ||
<td className="px-2 py-4 text-[--fg-color]">{int.podcast}</td> | ||
<td><CustomButtonPrimary onClick={()=>addPodcast(int.podcast)}>{t('add')}</CustomButtonPrimary></td> | ||
</tr> | ||
} | ||
) | ||
} | ||
</tbody> | ||
</table> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters