diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..576f2d3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,22 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + +- OS: [e.g. Ubuntu] +- Scene: [Package or Dev] +- Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/README.md b/README.md index dde6f18..21b84af 100644 --- a/README.md +++ b/README.md @@ -13,17 +13,13 @@ ### 绅士版食用指南 -建议使用 dev 模式,因为 build 包我们测试,可能会有问题 +下载对应平台的安装包,安装,打开。 -#### dependencies +#### 建议 - - node 环境 +第一次使用请先拉出来一个测试用的文件夹,熟悉各个操作的效果后,再大批量操作。数据无价,谨慎操作 -#### 食用 - -下载 release 中对应平台的安装包 - -#### 开发 +### 开发贡献 ```bash git clone https://github.com/videomanagertools/scraper.git diff --git a/app/components/MediaInfo/index.tsx b/app/components/MediaInfo/index.tsx index 08d0350..47a18c5 100644 --- a/app/components/MediaInfo/index.tsx +++ b/app/components/MediaInfo/index.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Row, Col, Tag, Select } from 'antd'; import cn from 'classnames'; +import { get } from 'lodash'; import styles from './index.less'; const { Option } = Select; @@ -17,16 +18,17 @@ export default ({ onSelect = () => {}, tags = [] }: Props) => { - const defaultTags = - (currentMediaInfo.tag && currentMediaInfo.tag.map(tag => tag._text)) || []; + const selectedTags = get(currentMediaInfo, 'tag', []).map(tag => tag._text); return (
-
{currentMediaInfo.title._text}
+
+ {get(currentMediaInfo, 'title._text')} +
@@ -34,22 +36,21 @@ export default ({
ID:
- {currentMediaInfo.uniqueid._text} + {get(currentMediaInfo, 'uniqueid._text')}
发行日期:
- {currentMediaInfo.premiered._text} + {get(currentMediaInfo, 'premiered._text')}
类型:
- {currentMediaInfo.genre && - currentMediaInfo.genre.map(g => ( - {g._text} - ))} + {get(currentMediaInfo, 'genre', []).map(g => ( + {g._text} + ))}
@@ -61,30 +62,27 @@ export default ({ style={{ width: '100%' }} placeholder="选择标签" onChange={onSelect} - defaultValue={defaultTags} + defaultValue={selectedTags} + value={selectedTags} > {tags.map(t => ( ))} ) : ( - currentMediaInfo.tag && - currentMediaInfo.tag.map(g => ( - {g._text} - )) + selectedTags.map(g => {g._text}) )}
演员:
- {currentMediaInfo.actor && - currentMediaInfo.actor.map(a => ( -
- -
{a.name._text}
-
- ))} + {get(currentMediaInfo, 'actor', []).map(a => ( +
+ +
{a.name._text}
+
+ ))}
diff --git a/app/containers/Home/MainContent/index.tsx b/app/containers/Home/MainContent/index.tsx index 6b395e5..a2d4702 100644 --- a/app/containers/Home/MainContent/index.tsx +++ b/app/containers/Home/MainContent/index.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import path from 'path'; import { connect } from 'react-redux'; import MediaInfo from '@components/MediaInfo'; @@ -17,18 +17,19 @@ const mapStateToProps = ({ file }) => { }; const tags = config.get('tags', []) as string[]; const MainContent = ({ selectedKey, flatTree }) => { - let mediaInfo = null; + const [mediaInfo, setMediaInfo] = useState(null); let nfoPath = ''; - if (selectedKey) { - const node = flatTree[selectedKey]; - nfoPath = path.join(node.wpath, `${node.title}.nfo`); - try { - mediaInfo = readMediaInfoFromNFOSync(nfoPath); - } catch (error) { - console.info('no nfo file'); + useEffect(() => { + if (selectedKey) { + const node = flatTree[selectedKey]; + nfoPath = path.join(node.wpath, `${node.title}.nfo`); + try { + setMediaInfo(readMediaInfoFromNFOSync(nfoPath)); + } catch (error) { + console.info('no nfo file'); + } } - console.log(mediaInfo); - } + }, [selectedKey]); return mediaInfo ? ( { const info = Object.assign({}, mediaInfo, { tag: iTags.map(tag => ({ _text: tag })) }); + setMediaInfo({ ...mediaInfo, tag: iTags.map(tag => ({ _text: tag })) }); writeMediaInfoToNFOSync(nfoPath, info); }} selectable diff --git a/package.json b/package.json index 72cb672..41d2038 100644 --- a/package.json +++ b/package.json @@ -274,6 +274,7 @@ "electron-updater": "^4.0.6", "fs-extra": "^8.0.1", "json2xml": "^0.1.3", + "lodash-es": "^4.17.15", "puppeteer-core": "^1.20.0", "ramda": "^0.26.1", "react": "^16.7.0", diff --git a/yarn.lock b/yarn.lock index ae2317b..0841aa5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8727,7 +8727,7 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lodash-es@^4.2.1: +lodash-es@^4.17.15, lodash-es@^4.2.1: version "4.17.15" resolved "https://registry.npm.taobao.org/lodash-es/download/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78" integrity sha1-Ib2Wg5NUQS8j16EDQOXqxu5FXXg=