Integrated channel filter, partially restored actor bio.
This commit is contained in:
19
utils/format.js
Normal file
19
utils/format.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { format } from 'date-fns';
|
||||
|
||||
export function formatDuration(duration, forceHours) {
|
||||
const hours = Math.floor(duration / 3600);
|
||||
const minutes = Math.floor((duration % 3600) / 60);
|
||||
const seconds = Math.floor(duration % 60);
|
||||
|
||||
const [formattedHours, formattedMinutes, formattedSeconds] = [hours, minutes, seconds].map((segment) => segment.toString().padStart(2, '0'));
|
||||
|
||||
if (duration >= 3600 || forceHours) {
|
||||
return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
|
||||
}
|
||||
|
||||
return `${formattedMinutes}:${formattedSeconds}`;
|
||||
}
|
||||
|
||||
export function formatDate(date, template) {
|
||||
return format(date, template);
|
||||
}
|
||||
59
utils/media-path.js
Normal file
59
utils/media-path.js
Normal file
@@ -0,0 +1,59 @@
|
||||
const config = {
|
||||
client: {
|
||||
media: {
|
||||
assetPath: '/img',
|
||||
mediaPath: '/media',
|
||||
s3Path: 'https://cdndev.traxxx.me',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
function getBasePath(media, type, options) {
|
||||
/*
|
||||
if (store.state.ui.sfw) {
|
||||
return config.client.media.assetPath;
|
||||
}
|
||||
*/
|
||||
|
||||
if (media.isS3) {
|
||||
return config.client.media.s3Path;
|
||||
}
|
||||
|
||||
if (options?.local) {
|
||||
return config.client.media.assetPath;
|
||||
}
|
||||
|
||||
return config.client.media.mediaPath;
|
||||
}
|
||||
|
||||
function getFilename(media, type, options) {
|
||||
/*
|
||||
if (store.state.ui.sfw && type && !options?.original) {
|
||||
return media.sfw[type];
|
||||
}
|
||||
|
||||
if (store.state.ui.sfw) {
|
||||
return media.sfw.path;
|
||||
}
|
||||
*/
|
||||
|
||||
if (type && !options?.original) {
|
||||
return media[type];
|
||||
}
|
||||
|
||||
return media.path;
|
||||
}
|
||||
|
||||
export function getMediaPath(media, type, options) {
|
||||
console.log('media', media);
|
||||
if (!media) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const path = getBasePath(media, type, options);
|
||||
const filename = getFilename(media, type, options);
|
||||
|
||||
console.log(path, filename);
|
||||
|
||||
return `${path}/${filename}`;
|
||||
}
|
||||
Reference in New Issue
Block a user