parent
4272ee1d6e
commit
740e831202
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "media_player_client",
|
||||
"version": "1.4.14",
|
||||
"version": "1.4.15",
|
||||
"description": "A Quasar Framework app",
|
||||
"productName": "MediaPlayerClient",
|
||||
"author": "fangxiang <fangxiang@cloudview.work>",
|
||||
|
|
16
src/App.vue
16
src/App.vue
|
@ -31,6 +31,22 @@ export default defineComponent({
|
|||
|
||||
document.title = $t.t("title");
|
||||
|
||||
if (!navigator.cookieEnabled) {
|
||||
$q.dialog({
|
||||
title: $t.t("error"),
|
||||
html: true,
|
||||
message: `
|
||||
<p>${$t.t(
|
||||
"The client depends on the Cookie function. If cookies are not enabled in the current browser, the client cannot be used!"
|
||||
)}</p>
|
||||
<p> ${$t.t("Please refresh this page after cookies are enabled")} </p>
|
||||
`,
|
||||
persistent: true,
|
||||
ok: false,
|
||||
cancel: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 导入对应的quasar 语言包
|
||||
try {
|
||||
{
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
import GlobalData from "src/common/GlobalData";
|
||||
|
||||
export default class FileSuffixHelper {
|
||||
public static kVideoDefaultSuffix = ".mp4;.avi;.ts;.webm;.flv;.mkv;.wmv;";
|
||||
public static kImageDefaultSuffix = ".jpg;.png;.bmp;";
|
||||
public static debug_mode = false;
|
||||
|
||||
public static get videoSuffix() {
|
||||
if (FileSuffixHelper.debug_mode) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
GlobalData.getInstance().applicationConfig?.video_suffix_filter ||
|
||||
FileSuffixHelper.kVideoDefaultSuffix
|
||||
);
|
||||
}
|
||||
|
||||
public static isVideoPath(path: string): boolean {
|
||||
return this.isPathToSuffix(
|
||||
path,
|
||||
this.videoSuffix || FileSuffixHelper.kVideoDefaultSuffix
|
||||
);
|
||||
}
|
||||
|
||||
public static get imageSuffix() {
|
||||
if (FileSuffixHelper.debug_mode) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
GlobalData.getInstance().applicationConfig?.image_suffix_filter ||
|
||||
FileSuffixHelper.kImageDefaultSuffix
|
||||
);
|
||||
}
|
||||
|
||||
public static isImagePath(path: string): boolean {
|
||||
return this.isPathToSuffix(
|
||||
path,
|
||||
this.imageSuffix || FileSuffixHelper.kImageDefaultSuffix
|
||||
);
|
||||
}
|
||||
|
||||
public static isPathToSuffix(path: string, suffixFilter: string): boolean {
|
||||
if (path && suffixFilter) {
|
||||
for (const suffix of suffixFilter
|
||||
.split(";")
|
||||
.filter((e) => e && e != "")) {
|
||||
if (path.endsWith(suffix)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static get allSuffix() {
|
||||
if (FileSuffixHelper.debug_mode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
(this.videoSuffix || FileSuffixHelper.kVideoDefaultSuffix) +
|
||||
(this.imageSuffix || FileSuffixHelper.kImageDefaultSuffix)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -154,14 +154,14 @@
|
|||
@dblclick="
|
||||
media_url_label.startsWith($t('file path')) &&
|
||||
item_data.window_type == 'EwindowType::Image'
|
||||
? doSelectFile('.jpg;.png')
|
||||
? doSelectImageFile()
|
||||
: item_data.window_type == 'EwindowType::Clock'
|
||||
? showClockDialog()
|
||||
: item_data.window_type == 'EwindowType::Weather'
|
||||
? showWeatherDialog()
|
||||
: item_data.window_type == 'EwindowType::Timer'
|
||||
? showTimerDialog()
|
||||
: showPlaylistDialog('.mp4;.avi;.ts;.webm;.flv;.mkv;.wmv')
|
||||
: showVideoPlayListDialog()
|
||||
"
|
||||
v-model="item_data.media_url"
|
||||
:readonly="
|
||||
|
@ -328,6 +328,7 @@ import WeatherSignalSourceDialog from "src/components/WeatherSignalSourceDialog.
|
|||
import TimerSignalSourceDialog from "src/components/TimerSignalSourceDialog.vue";
|
||||
|
||||
import FileEntity from "src/entities/FileEntity";
|
||||
import FileSuffixHelper from "src/common/FileSuffixHelper";
|
||||
|
||||
export default defineComponent({
|
||||
name: "ComponentSignalSourceDialog",
|
||||
|
@ -484,6 +485,71 @@ export default defineComponent({
|
|||
}
|
||||
};
|
||||
|
||||
const doSelectFile = async (filter: string) => {
|
||||
if (!media_url_label.value.startsWith($t.t("file path"))) {
|
||||
return;
|
||||
}
|
||||
const obj = await file_manage_dialog.value.showDialogAsync(
|
||||
"select",
|
||||
filter
|
||||
);
|
||||
if (obj) {
|
||||
interface __I {
|
||||
path: string;
|
||||
file: FileEntity;
|
||||
}
|
||||
let { path, file }: __I = obj;
|
||||
if (path && file) {
|
||||
item_data.media_url = path + "/" + file.name;
|
||||
|
||||
if (
|
||||
!item_data.name ||
|
||||
item_data.name.trim() == "" ||
|
||||
item_data.name.trim() == $t.t("new signal source")
|
||||
) {
|
||||
nextTick(() => {
|
||||
item_data.name = file.name;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const showPlaylistDialog = async (filter: string | null) => {
|
||||
if (item_data.window_type != "EwindowType::Multimedia") {
|
||||
return;
|
||||
}
|
||||
const result = await playlist_dialog.value.showDialogAsync(
|
||||
item_data.media_url,
|
||||
filter
|
||||
);
|
||||
if (Array.isArray(result)) {
|
||||
if (result.length) {
|
||||
if (
|
||||
!item_data.name ||
|
||||
item_data.name.trim() == "" ||
|
||||
item_data.name.trim() == $t.t("new signal source")
|
||||
) {
|
||||
try {
|
||||
const temp_item = decodeURI(result[0].toString());
|
||||
let index = temp_item.lastIndexOf("\\");
|
||||
if (index == -1) {
|
||||
index = temp_item.lastIndexOf("/");
|
||||
}
|
||||
if (index + 1 == temp_item.length) {
|
||||
item_data.name = temp_item.substr(index);
|
||||
} else if (index + 1 < temp_item.length) {
|
||||
item_data.name = temp_item.substr(index + 1);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
item_data.media_url = decodeURI(JSON.stringify(result));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
show_dialog,
|
||||
type,
|
||||
|
@ -575,68 +641,20 @@ export default defineComponent({
|
|||
item_data.media_url = decodeURI(result);
|
||||
}
|
||||
},
|
||||
async showVideoPlayListDialog() {
|
||||
return showPlaylistDialog(FileSuffixHelper.videoSuffix);
|
||||
},
|
||||
async showPlaylistDialog(filter: string) {
|
||||
if (item_data.window_type != "EwindowType::Multimedia") {
|
||||
return;
|
||||
}
|
||||
const result = await playlist_dialog.value.showDialogAsync(
|
||||
item_data.media_url,
|
||||
filter
|
||||
return showPlaylistDialog(filter);
|
||||
},
|
||||
async doSelectImageFile() {
|
||||
return doSelectFile(
|
||||
GlobalData.getInstance().applicationConfig?.image_suffix_filter ||
|
||||
".jpg;.png"
|
||||
);
|
||||
if (Array.isArray(result)) {
|
||||
if (result.length) {
|
||||
if (
|
||||
!item_data.name ||
|
||||
item_data.name.trim() == "" ||
|
||||
item_data.name.trim() == $t.t("new signal source")
|
||||
) {
|
||||
try {
|
||||
const temp_item = decodeURI(result[0].toString());
|
||||
let index = temp_item.lastIndexOf("\\");
|
||||
if (index == -1) {
|
||||
index = temp_item.lastIndexOf("/");
|
||||
}
|
||||
if (index + 1 == temp_item.length) {
|
||||
item_data.name = temp_item.substr(index);
|
||||
} else if (index + 1 < temp_item.length) {
|
||||
item_data.name = temp_item.substr(index + 1);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
item_data.media_url = decodeURI(JSON.stringify(result));
|
||||
}
|
||||
}
|
||||
},
|
||||
async doSelectFile(filter: string) {
|
||||
if (!media_url_label.value.startsWith($t.t("file path"))) {
|
||||
return;
|
||||
}
|
||||
const obj = await file_manage_dialog.value.showDialogAsync(
|
||||
"select",
|
||||
filter
|
||||
);
|
||||
if (obj) {
|
||||
interface __I {
|
||||
path: string;
|
||||
file: FileEntity;
|
||||
}
|
||||
let { path, file }: __I = obj;
|
||||
if (path && file) {
|
||||
item_data.media_url = path + "/" + file.name;
|
||||
|
||||
if (
|
||||
!item_data.name ||
|
||||
item_data.name.trim() == "" ||
|
||||
item_data.name.trim() == $t.t("new signal source")
|
||||
) {
|
||||
nextTick(() => {
|
||||
item_data.name = file.name;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return doSelectFile(filter);
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
|
@ -29,4 +29,6 @@ export default class ApplicationConfigEntity {
|
|||
registered: boolean = false;
|
||||
hdmi_in_decode_type_1: string | undefined;
|
||||
device_hdmi_output_count = 1;
|
||||
video_suffix_filter: string | null = "";
|
||||
image_suffix_filter: string | null = "";
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ export default {
|
|||
title: "MediaPlayerWebApp",
|
||||
failed: "失败",
|
||||
fail: "失败",
|
||||
error: "错误",
|
||||
Confirm: "确认",
|
||||
success: "成功",
|
||||
Cancel: "取消",
|
||||
|
@ -577,4 +578,8 @@ export default {
|
|||
"正计时的时候起始时间不要超过当前时间,倒计时的时候目标时间不要小于当前时间",
|
||||
"pos x": "X坐标",
|
||||
"No.": "序号",
|
||||
"The client depends on the Cookie function. If cookies are not enabled in the current browser, the client cannot be used!":
|
||||
"客户端依赖Cookie功能。如果当前浏览器未启用Cookie,则客户端无法使用!",
|
||||
"Please refresh this page after cookies are enabled":
|
||||
"请在开启Cookie功能后刷新该页面",
|
||||
};
|
||||
|
|
|
@ -150,6 +150,7 @@ import TopToolBar from "src/pages/TopToolBar.vue";
|
|||
import FooterPortrait from "src/pages/FooterPortrait.vue";
|
||||
import EventBus, { EventNamesDefine } from "src/common/EventBus";
|
||||
import { useStore } from "src/store";
|
||||
import FileSuffixHelper from "src/common/FileSuffixHelper";
|
||||
|
||||
export default defineComponent({
|
||||
name: "MainLayout",
|
||||
|
@ -163,6 +164,10 @@ export default defineComponent({
|
|||
(window as any).setPcTheme();
|
||||
} catch {}
|
||||
|
||||
if ($store.state.advanced_debug) {
|
||||
FileSuffixHelper.debug_mode = true;
|
||||
}
|
||||
|
||||
const landspace = $store.state.landspace;
|
||||
|
||||
let show_left_tool_bar = ref(true);
|
||||
|
|
|
@ -183,6 +183,7 @@ import WindowOtherStateChangeNotifyEntity from "src/entities/WindowOtherStateCha
|
|||
import { WindowOpenNotifyEntity } from "src/entities/MultimediaWindowEntity";
|
||||
import { NotifyMessage } from "src/common/ClientConnection";
|
||||
import EventBus, { EventNamesDefine } from "src/common/EventBus";
|
||||
import FileSuffixHelper from "src/common/FileSuffixHelper";
|
||||
|
||||
class Rect {
|
||||
start_x = 0;
|
||||
|
@ -994,7 +995,7 @@ export default defineComponent({
|
|||
if (old_signal_source) {
|
||||
const obj = await file_manage_dialog.value.showDialogAsync(
|
||||
"select",
|
||||
".mp4;.avi;.ts;.webm;.flv;.mkv;.jpg;.png;"
|
||||
FileSuffixHelper.allSuffix
|
||||
);
|
||||
if (obj) {
|
||||
interface __I {
|
||||
|
@ -1101,7 +1102,7 @@ export default defineComponent({
|
|||
|
||||
const obj = await file_manage_dialog.value.showDialogAsync(
|
||||
"select",
|
||||
".mp4;.avi;.ts;.webm;.flv;.mkv;.wmv;.jpg;.png;"
|
||||
FileSuffixHelper.allSuffix
|
||||
);
|
||||
|
||||
if (obj) {
|
||||
|
|
|
@ -201,6 +201,7 @@ import vue3ResizeDrag from "../third_lib/vue3-resize-drag/components/vue3-resize
|
|||
import FileManageDialog from "src/components/FileManageDialog.vue";
|
||||
import FileEntity from "src/entities/FileEntity";
|
||||
import { SignalSourceEntity } from "src/entities/SignalSourceEntity";
|
||||
import FileSuffixHelper from "src/common/FileSuffixHelper";
|
||||
|
||||
class Rect {
|
||||
start_x = 0;
|
||||
|
@ -1102,7 +1103,7 @@ export default defineComponent({
|
|||
|
||||
const obj = await file_manage_dialog.value.showDialogAsync(
|
||||
"select",
|
||||
".mp4;.avi;.ts;.webm;.flv;.mkv;.jpg;.png;"
|
||||
FileSuffixHelper.allSuffix
|
||||
);
|
||||
if (obj) {
|
||||
interface __I {
|
||||
|
@ -1187,7 +1188,7 @@ export default defineComponent({
|
|||
if (old_signal_source) {
|
||||
const obj = await file_manage_dialog.value.showDialogAsync(
|
||||
"select",
|
||||
".mp4;.avi;.ts;.webm;.flv;.mkv;.jpg;.png;"
|
||||
FileSuffixHelper.allSuffix
|
||||
);
|
||||
if (obj) {
|
||||
interface __I {
|
||||
|
@ -1198,19 +1199,14 @@ export default defineComponent({
|
|||
if (path && file) {
|
||||
const full_path = (path + "/" + file.name).replace(/\\/g, "/");
|
||||
const entity: SignalSourceEntity = new SignalSourceEntity();
|
||||
if (
|
||||
file.name.endsWith("mp4") ||
|
||||
file.name.endsWith("avi") ||
|
||||
file.name.endsWith("ts") ||
|
||||
file.name.endsWith("webm") ||
|
||||
file.name.endsWith("flv") ||
|
||||
file.name.endsWith("mkv")
|
||||
) {
|
||||
if (FileSuffixHelper.isVideoPath(file.name)) {
|
||||
entity.window_type = "EwindowType::Multimedia";
|
||||
entity.media_url = JSON.stringify([full_path]);
|
||||
} else {
|
||||
} else if (FileSuffixHelper.isImagePath(file.name)) {
|
||||
entity.window_type = "EwindowType::Image";
|
||||
entity.media_url = full_path;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
entity.name = file.name;
|
||||
entity.local_file_flag = true;
|
||||
|
|
Loading…
Reference in New Issue