소스 검색

Merge branch 'dev' of github.com:allanpk716/ChineseSubFinder into dev

allan716 3 년 전
부모
커밋
7c1e61742c

+ 32 - 0
frontend/src/pages/library/BtnDialogLibraryRefresh.vue

@@ -0,0 +1,32 @@
+<template>
+  <q-btn label="更新缓存" color="primary" icon="cached" @click="confirm" :loading="refreshCacheLoading">
+    <template v-slot:loading>
+      <q-spinner-hourglass class="on-left" />
+      更新缓存中...
+    </template>
+  </q-btn>
+</template>
+
+<script setup>
+import {useLibrary} from 'pages/library/useLibrary';
+import {useQuasar} from 'quasar';
+
+const $q = useQuasar();
+
+const { refreshLibrary, refreshCacheLoading } = useLibrary();
+
+const confirm = () => {
+  $q.dialog({
+    title: '更新缓存',
+    message: '刷新缓存并不会自动提交下载字幕的任务,仅仅是方便手动选择一个视频去下载字幕。这个是一个长耗时任务,请在有手动的需求下操作。暂时不支持动态更新缓存,需要手动执行完整的缓存刷新操作。',
+    persistent: true,
+    ok: '确定',
+    cancel: '取消',
+  }).onOk(() => {
+    refreshLibrary();
+  }).onCancel(() => {
+    // console.log('>>>> Cancel')
+  })
+}
+
+</script>

+ 3 - 7
frontend/src/pages/library/movies/index.vue

@@ -1,12 +1,7 @@
 <template>
   <q-page class="q-pa-lg">
     <div class="row q-gutter-md">
-      <q-btn label="更新缓存" color="primary" icon="cached" @click="refreshLibrary" :loading="refreshCacheLoading">
-        <template v-slot:loading>
-          <q-spinner-hourglass class="on-left" />
-          更新缓存中...
-        </template>
-      </q-btn>
+      <btn-dialog-library-refresh/>
 
       <q-space />
 
@@ -46,6 +41,7 @@
 <script setup>
 import { useLibrary } from 'pages/library/useLibrary';
 import { computed, reactive } from 'vue';
+import BtnDialogLibraryRefresh from 'pages/library/BtnDialogLibraryRefresh';
 import ListItemMovie from './ListItemMovie';
 
 const filterForm = reactive({
@@ -53,7 +49,7 @@ const filterForm = reactive({
   search: '',
 });
 
-const { movies, refreshLibrary, refreshCacheLoading } = useLibrary();
+const { movies } = useLibrary();
 
 const filteredMovies = computed(() => {
   let res = movies.value;

+ 3 - 7
frontend/src/pages/library/tvs/index.vue

@@ -1,12 +1,7 @@
 <template>
   <q-page class="q-pa-lg">
     <div class="row q-gutter-md">
-      <q-btn label="更新缓存" color="primary" icon="cached" @click="refreshLibrary" :loading="refreshCacheLoading">
-        <template v-slot:loading>
-          <q-spinner-hourglass class="on-left" />
-          更新缓存中...
-        </template>
-      </q-btn>
+      <btn-dialog-library-refresh/>
 
       <q-space />
 
@@ -48,13 +43,14 @@
 import { useLibrary } from 'pages/library/useLibrary';
 import { computed, reactive } from 'vue';
 import ListItemTV from 'pages/library/tvs/ListItemTV';
+import BtnDialogLibraryRefresh from 'pages/library/BtnDialogLibraryRefresh';
 
 const filterForm = reactive({
   hasSubtitle: null,
   search: '',
 });
 
-const { tvs, refreshLibrary, refreshCacheLoading } = useLibrary();
+const { tvs } = useLibrary();
 
 const filteredTvs = computed(() => {
   let res = tvs.value;

+ 55 - 1
frontend/src/pages/settings/ExperimentSettings.vue

@@ -50,6 +50,20 @@
 
       <q-separator spaced inset></q-separator>
 
+      <q-item tag="label" v-ripple>
+        <q-item-section>
+          <q-item-label>共享字幕</q-item-label>
+          <q-item-label caption
+          >上传字幕能够让本程序变得更加好用,发扬共享精神,一起来共享字幕吧!</q-item-label
+          >
+        </q-item-section>
+        <q-item-section avatar top>
+          <q-toggle v-model="form.share_sub_settings.share_sub_enabled" />
+        </q-item-section>
+      </q-item>
+
+      <q-separator spaced inset></q-separator>
+
       <q-item>
         <q-item-section>
           <q-item-label>远程Chrome</q-item-label>
@@ -212,8 +226,11 @@ import {
   DESC_ENCODE_TYPE_NAME_MAP,
   DESC_ENCODE_TYPE_UTF8,
 } from 'src/constants/SettingConstants';
-import { computed } from 'vue';
+import {computed, watch} from 'vue';
 import CopyToClipboardBtn from 'components/CopyToClipboardBtn';
+import {useQuasar} from 'quasar';
+
+const $q = useQuasar();
 
 const { experimental_function: form } = toRefs(formModel);
 
@@ -236,4 +253,41 @@ const generateApiKey = () => {
   const uuid = generateUuid();
   formModel.experimental_function.api_key_settings.key = uuid;
 };
+
+watch(() => formModel.experimental_function.share_sub_settings.share_sub_enabled, (val) => {
+  if (val) {
+    $q.dialog({
+      title: '共享字幕说明',
+      style: 'width: 600px',
+      message: `<b>开启“共享字幕”功能后:</b>
+<ul>
+  <li>本程序会收集、上传 Emby 中已经观看的视频对应的字幕(如果你没有开启 Emby 那么就不会收集这个部分的字幕)
+  <li>如果你使用了本程序提供的 Http API 提交了已经观看的视频和字幕信息,本程序也会收集这个部分
+  <li>如果上述两点你都没有符合条件,那么“共享字幕”功能暂时是不会收集你本地的其他字幕的(因为没有视频对应关系,收集的意义不大)
+  <li>如果有任何疑问欢迎去看本程序的上传字幕部分的代码
+</ul>
+
+<b>字幕的去向、用途:</b>
+<ul>
+  <li>字幕上传后,评估通过的字幕会存储在共享服务器中
+  <li>后续本程序自身提供的字幕搜索会有两种形式:
+    <ul style="padding-left: 20px;">
+      <li>a. 类似 xunlei、shooter 的接口,通过计算视频文件唯一 ID (这个ID的算法在本程序内,暂时没有整理出来)去查询
+      <li>b. 支持 IMDB、TMDB ID (注意,这个ID是电影或者是连续剧的 ID,不是一集的 ID),加上 SxxExx 这样的信息去查询
+    </ul>
+   PS: 暂时不会支持关键词查询,除非后续有特殊情况出现
+  </li>
+</ul>
+`,
+      persistent: true,
+      html: true,
+      ok: '共享',
+      cancel: '不共享',
+    }).onOk(() => {
+      // 共享字幕
+    }).onCancel(() => {
+      formModel.experimental_function.share_sub_settings.share_sub_enabled = false;
+    })
+  }
+})
 </script>

+ 1 - 1
frontend/src/pages/settings/SubSourceSettings.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <q-list style="max-width: 600px" dense>
-      <q-item>
+      <q-item tag="label">
         <q-item-section>
           <q-item-label>Assrt(https://assrt.net/api/doc)</q-item-label>
           <q-item-label caption>