updates
This commit is contained in:
@@ -84,13 +84,14 @@ export const EpisodeShow = (props) => (
|
||||
<TextField source="title" />
|
||||
<NumberField source="season" />
|
||||
<NumberField source="episode" />
|
||||
<NumberField source="duration" />
|
||||
<TextField source="slug" />
|
||||
<TextField source="episode_type" />
|
||||
<TextField source="buzzsprout_id" />
|
||||
<UrlField source="buzzsprout_url" />
|
||||
<UrlField source="youtube_url" />
|
||||
<UrlField source="audio_url" />
|
||||
<NumberField source="duration" label="Duration (seconds)" />
|
||||
<NumberField source="audio_size" label="Size (bytes)" />
|
||||
<FileField source="transcript_filename" title="transcript_filename" />
|
||||
<DateField source="pub_date" showTime={true} />
|
||||
<RichTextField source="content" />
|
||||
@@ -100,26 +101,44 @@ export const EpisodeShow = (props) => (
|
||||
);
|
||||
|
||||
export const EpisodeEdit = () => {
|
||||
const { data: transcriptFiles } = useGetList(
|
||||
'transcript_files'
|
||||
);
|
||||
if (transcriptFiles) {
|
||||
return (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<TextInput source="number" />
|
||||
<TextInput source="title" />
|
||||
<TextInput source="title" fullWidth />
|
||||
<NumberInput source="season" />
|
||||
<NumberInput source="episode" />
|
||||
<TextInput source="slug" />
|
||||
<TextInput source="episode_type" />
|
||||
<TextInput source="slug" fullWidth />
|
||||
<RadioButtonGroupInput
|
||||
source="episode_type"
|
||||
choices={[
|
||||
{ id: 'full', name: 'full' },
|
||||
{ id: 'bonus', name: 'bonus' }
|
||||
]}
|
||||
/>
|
||||
<TextInput source="buzzsprout_id" />
|
||||
<TextInput source="buzzsprout_url" />
|
||||
<TextInput source="youtube_url" />
|
||||
<TextInput source="audio_url" />
|
||||
<TextInput source="transcript_filename" />
|
||||
<TextInput source="buzzsprout_url" fullWidth />
|
||||
<TextInput source="youtube_url" fullWidth />
|
||||
<TextInput source="audio_url" fullWidth />
|
||||
<NumberInput source="duration" label="Duration (seconds)" />
|
||||
<NumberInput source="audio_size" label="Size (bytes)" />
|
||||
<SelectInput
|
||||
source="transcript_filename"
|
||||
choices={transcriptFiles.map(x => { return { id: x.filename, name: x.filename } })}
|
||||
/>
|
||||
<DateTimeInput source="pub_date" />
|
||||
<RichTextInput source="content" />
|
||||
<TextInput source="summary" />
|
||||
<TextInput source="summary" fullWidth />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
function listElement(arr, proc) {
|
||||
@@ -171,6 +190,8 @@ export const EpisodeCreate = () => {
|
||||
<TextInput source="buzzsprout_url" fullWidth />
|
||||
<TextInput source="youtube_url" fullWidth />
|
||||
<TextInput source="audio_url" fullWidth />
|
||||
<NumberInput source="audio_size" label="Size (bytes)" />
|
||||
<NumberInput source="duration" label="Duration (seconds)" />
|
||||
<SelectInput
|
||||
source="transcript_filename"
|
||||
choices={transcriptFiles.map(x => { return { id: x.filename, name: x.filename } })}
|
||||
|
||||
@@ -73,6 +73,11 @@ foreign key (user_id) references users (id)
|
||||
key: 8,
|
||||
name: 'add audio url column',
|
||||
sql: [`alter table episodes add column audio_url text;`]
|
||||
},
|
||||
{
|
||||
key: 9,
|
||||
name: 'add audio size column',
|
||||
sql: [`alter table episodes add column audio_size integer;`]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -117,9 +122,9 @@ const createMigrationTable = `create table migrations (
|
||||
run boolean not null
|
||||
)`;
|
||||
|
||||
let db = new sqlite3.Database('/db/db.sqlite3', sqlite3.OPEN_READWRITE, async (err) => {
|
||||
let db = new sqlite3.Database(`${process.env.DB_PATH}db.sqlite3`, sqlite3.OPEN_READWRITE, async (err) => {
|
||||
if (err && err.code == "SQLITE_CANTOPEN") {
|
||||
db = new sqlite3.Database('./db.sqlite3', async (err) => {
|
||||
db = new sqlite3.Database(`${process.env.DB_PATH}db.sqlite3`, async (err) => {
|
||||
if (err) {
|
||||
console.log("Getting error " + err);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import db from '@/db';
|
||||
|
||||
const COLS = {};
|
||||
const COLS_PREFIXED = {};
|
||||
const COLS_LIST = ['id', 'number', 'content', 'summary', 'slug', 'season', 'episode', 'duration', 'filename', 'title', 'episode_type', 'buzzsprout_id', 'buzzsprout_url', 'pub_date', 'youtube_url', 'transcript_filename', 'audio_url'];
|
||||
const COLS_LIST = ['id', 'number', 'content', 'summary', 'slug', 'season', 'episode', 'duration', 'filename', 'title', 'episode_type', 'buzzsprout_id', 'buzzsprout_url', 'pub_date', 'youtube_url', 'transcript_filename', 'audio_url', 'audio_size'];
|
||||
COLS_LIST.forEach((k) => COLS[k] = k)
|
||||
COLS_LIST.forEach((k) => COLS_PREFIXED[k] = `$${k}`)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const COLUMN_MAP = {
|
||||
'episode': 'episode'
|
||||
};
|
||||
|
||||
const COLS_LIST = ['number', 'content', 'summary', 'slug', 'season', 'episode', 'duration', 'filename', 'title', 'episode_type', 'buzzsprout_id', 'buzzsprout_url', 'pub_date', 'youtube_url', 'transcript_filename', 'audio_url'];
|
||||
const COLS_LIST = ['number', 'content', 'summary', 'slug', 'season', 'episode', 'duration', 'filename', 'title', 'episode_type', 'buzzsprout_id', 'buzzsprout_url', 'pub_date', 'youtube_url', 'transcript_filename', 'audio_url', 'audio_size'];
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const sessionId = req.cookies?.session;
|
||||
|
||||
@@ -50,7 +50,7 @@ async function syncEpisodes() {
|
||||
|
||||
export default async function handler(req, res) {
|
||||
if (req.method === 'GET') {
|
||||
await syncEpisodes();
|
||||
// await syncEpisodes();
|
||||
const { uuid: uuidRaw } = req.query;
|
||||
const uuid = uuidRaw.split('.rss')[0];
|
||||
const subExists = await db.get('select id from subscriptions where uuid=?', uuid);
|
||||
|
||||
Reference in New Issue
Block a user