diff --git a/web/README.md b/web/README.md
index 7d97cac..e037846 100644
--- a/web/README.md
+++ b/web/README.md
@@ -8,7 +8,8 @@
> `http://192.168.78.4:8090` - correct
>
> `http://192.168.78.4:8090/` - wrong
-3. `yarn start`
+3. in `.env` file add TMDB api key
+4. `yarn start`
### Eslint
> Prettier will fix the code every time the code is saved
diff --git a/web/src/components/App/Sidebar.jsx b/web/src/components/App/Sidebar.jsx
index 5434289..3aaa887 100644
--- a/web/src/components/App/Sidebar.jsx
+++ b/web/src/components/App/Sidebar.jsx
@@ -1,9 +1,8 @@
-import { playlistAllHost } from 'utils/Hosts'
import Divider from '@material-ui/core/Divider'
import ListItem from '@material-ui/core/ListItem'
import ListItemIcon from '@material-ui/core/ListItemIcon'
import ListItemText from '@material-ui/core/ListItemText'
-import { CreditCard as CreditCardIcon, List as ListIcon, Language as LanguageIcon } from '@material-ui/icons'
+import { CreditCard as CreditCardIcon, Language as LanguageIcon } from '@material-ui/icons'
import List from '@material-ui/core/List'
import { useTranslation } from 'react-i18next'
import useChangeLanguage from 'utils/useChangeLanguage'
@@ -24,12 +23,6 @@ export default function Sidebar({ isDrawerOpen, setIsDonationDialogOpen }) {
-
-
-
-
-
-
@@ -37,20 +30,25 @@ export default function Sidebar({ isDrawerOpen, setIsDonationDialogOpen }) {
- (currentLang === 'en' ? changeLang('ru') : changeLang('en'))}>
-
-
-
-
-
-
-
+ (currentLang === 'en' ? changeLang('ru') : changeLang('en'))}>
+
+
+
+
+
+
+
+
+
+
+
+
setIsDonationDialogOpen(true)}>
diff --git a/web/src/components/DialogTorrentDetailsContent/Table/[kinozal.tv]id1846470.torrent b/web/src/components/DialogTorrentDetailsContent/Table/[kinozal.tv]id1846470.torrent
deleted file mode 100644
index 099c998..0000000
Binary files a/web/src/components/DialogTorrentDetailsContent/Table/[kinozal.tv]id1846470.torrent and /dev/null differ
diff --git a/web/src/components/DialogTorrentDetailsContent/index.jsx b/web/src/components/DialogTorrentDetailsContent/index.jsx
index b6f688c..3fb6401 100644
--- a/web/src/components/DialogTorrentDetailsContent/index.jsx
+++ b/web/src/components/DialogTorrentDetailsContent/index.jsx
@@ -1,5 +1,5 @@
import { NoImageIcon } from 'icons'
-import { humanizeSize } from 'utils/Utils'
+import { humanizeSize, removeRedundantCharacters } from 'utils/Utils'
import { useEffect, useState } from 'react'
import { Button, ButtonGroup } from '@material-ui/core'
import ptt from 'parse-torrent-title'
@@ -102,21 +102,27 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
const bufferSize = settings?.PreloadBuffer ? Capacity : 33554432 // Default is 32mb if PreloadBuffer is false
const getParsedTitle = () => {
- const newNameStrings = []
+ const newNameStringArr = []
const torrentParsedName = name && ptt.parse(name)
if (title !== name) {
- newNameStrings.push(title)
- } else if (torrentParsedName?.title) newNameStrings.push(torrentParsedName?.title)
+ newNameStringArr.push(removeRedundantCharacters(title))
+ } else if (torrentParsedName?.title) newNameStringArr.push(torrentParsedName?.title)
// These 2 checks are needed to get year and resolution from torrent name if title does not have this info
if (torrentParsedName?.year && !title.includes(torrentParsedName?.year))
- newNameStrings.push(torrentParsedName?.year)
+ newNameStringArr.push(torrentParsedName?.year)
if (torrentParsedName?.resolution && !title.includes(torrentParsedName?.resolution))
- newNameStrings.push(torrentParsedName?.resolution)
+ newNameStringArr.push(torrentParsedName?.resolution)
- return newNameStrings.join('. ')
+ const newNameString = newNameStringArr.join('. ')
+
+ // removeRedundantCharacters is returning ".." if it was "..."
+ const lastDotShouldBeAdded =
+ newNameString[newNameString.length - 1] === '.' && newNameString[newNameString.length - 2] === '.'
+
+ return lastDotShouldBeAdded ? `${newNameString}.` : newNameString
}
return (
diff --git a/web/src/components/TorrentCard/index.jsx b/web/src/components/TorrentCard/index.jsx
index 40cc498..1f24d73 100644
--- a/web/src/components/TorrentCard/index.jsx
+++ b/web/src/components/TorrentCard/index.jsx
@@ -6,7 +6,7 @@ import {
Close as CloseIcon,
Delete as DeleteIcon,
} from '@material-ui/icons'
-import { getPeerString, humanizeSize } from 'utils/Utils'
+import { getPeerString, humanizeSize, removeRedundantCharacters } from 'utils/Utils'
import { torrentsHost } from 'utils/Hosts'
import { NoImageIcon } from 'icons'
import DialogTorrentDetailsContent from 'components/DialogTorrentDetailsContent'
@@ -45,7 +45,7 @@ const Torrent = ({ torrent }) => {
const titleStrings = []
- let parsedTitle = parse('title')
+ let parsedTitle = removeRedundantCharacters(parse('title'))
const parsedYear = parse('year')
const parsedResolution = parse('resolution')
if (parsedTitle) titleStrings.push(parsedTitle)
diff --git a/web/src/locales/en/translation.json b/web/src/locales/en/translation.json
index b9003d3..fab7ad5 100644
--- a/web/src/locales/en/translation.json
+++ b/web/src/locales/en/translation.json
@@ -17,7 +17,7 @@
"Cache": "Cache",
"CacheSize": "Cache Size (Megabytes)",
"Cancel": "Cancel",
- "ChooseLanguage": "Russian",
+ "ChooseLanguage": "Ru",
"Clear": "Clear",
"Close": "Close",
"CloseServer?": "Do you want to turn off server?",
@@ -59,12 +59,11 @@
"Offline": "Offline",
"OK": "OK",
"OpenLink": "Open link",
- "Peers": "[Connected] Peers",
+ "Peers": "Peers",
"PeersListenPort": "Peers Listen Port",
"PEX": "PEX (Peer Exchange)",
"PiecesCount": "Pieces count",
"PiecesLength": "Pieces length",
- "PlaylistAll": "Playlist All",
"Preload": "Preload",
"PreloadBuffer": "Preload Buffer",
"ReaderReadAHead": "Reader Read Ahead (5-100%)",
diff --git a/web/src/locales/ru/translation.json b/web/src/locales/ru/translation.json
index 70b6631..ccfd7d0 100644
--- a/web/src/locales/ru/translation.json
+++ b/web/src/locales/ru/translation.json
@@ -17,7 +17,7 @@
"Cache": "Кеш",
"CacheSize": "Размер кеша (Мегабайты)",
"Cancel": "Отмена",
- "ChooseLanguage": "Английский",
+ "ChooseLanguage": "En",
"Clear": "Очистить",
"Close": "Закрыть",
"CloseServer?": "Хотите выключить сервер?",
@@ -59,12 +59,11 @@
"Offline": "Сервер не доступен",
"OK": "OK",
"OpenLink": "Открыть",
- "Peers": "[Подкл.] Пиры",
+ "Peers": "Пиры",
"PeersListenPort": "Порт для входящих подключений",
"PEX": "PEX (Peer Exchange)",
"PiecesCount": "Кол-во блоков",
"PiecesLength": "Размер блока",
- "PlaylistAll": "Плейлист всех",
"Preload": "Предзагр.",
"PreloadBuffer": "Наполнять кеш перед началом воспроизведения",
"ReaderReadAHead": "Кеш предзагрузки (5-100%, рек. 95%)",
diff --git a/web/src/utils/Hosts.js b/web/src/utils/Hosts.js
index cbc05d9..6e1cc7d 100644
--- a/web/src/utils/Hosts.js
+++ b/web/src/utils/Hosts.js
@@ -10,7 +10,6 @@ export const settingsHost = () => `${torrserverHost}/settings`
export const streamHost = () => `${torrserverHost}/stream`
export const shutdownHost = () => `${torrserverHost}/shutdown`
export const echoHost = () => `${torrserverHost}/echo`
-export const playlistAllHost = () => `${torrserverHost}/playlistall/all.m3u`
export const playlistTorrHost = () => `${torrserverHost}/stream`
export const getTorrServerHost = () => torrserverHost
diff --git a/web/src/utils/Utils.js b/web/src/utils/Utils.js
index 1e1bac5..acb5c8e 100644
--- a/web/src/utils/Utils.js
+++ b/web/src/utils/Utils.js
@@ -11,3 +11,33 @@ export function getPeerString(torrent) {
export const shortenText = (text, sympolAmount) =>
text ? text.slice(0, sympolAmount) + (text.length > sympolAmount ? '…' : '') : ''
+
+export const removeRedundantCharacters = string => {
+ let newString = string
+ const brackets = [
+ ['(', ')'],
+ ['[', ']'],
+ ['{', '}'],
+ ]
+
+ brackets.forEach(el => {
+ const leftBracketRegexFormula = `\\${el[0]}`
+ const leftBracketRegex = new RegExp(leftBracketRegexFormula, 'g')
+ const leftBracketAmount = [...newString.matchAll(leftBracketRegex)].length
+ const rightBracketRegexFormula = `\\${el[1]}`
+ const rightBracketRegex = new RegExp(rightBracketRegexFormula, 'g')
+ const rightBracketAmount = [...newString.matchAll(rightBracketRegex)].length
+
+ if (leftBracketAmount !== rightBracketAmount) {
+ const removeFormula = `(\\${el[0]})(?!.*\\1).*`
+ const removeRegex = new RegExp(removeFormula, 'g')
+ newString = newString.replace(removeRegex, '')
+ }
+ })
+
+ const hasThreeDotsAtTheEnd = !!newString.match(/\.{3}$/g)
+
+ const trimmedString = newString.replace(/[\\.| ]+$/g, '').trim()
+
+ return hasThreeDotsAtTheEnd ? `${trimmedString}..` : trimmedString
+}