From b5cd3f5c7962136946b2ad464b354ca3909f0fc4 Mon Sep 17 00:00:00 2001
From: Rohithk <67067796+Rohithk2003@users.noreply.github.com>
Date: Tue, 26 Sep 2023 17:42:05 +0530
Subject: [PATCH] improved movie page
---
Common/TorrentList.js | 337 +++++++++++++++++++-------------------
components/Collection.js | 8 +-
components/FilmHeading.js | 13 +-
components/Layout.js | 2 +-
pages/api/movie/[id].js | 4 -
pages/f.js | 8 +
pages/movie/[id].js | 4 +-
pages/play/movies.js | 127 ++++++++++++--
utils/index.js | 54 +++---
9 files changed, 331 insertions(+), 226 deletions(-)
create mode 100644 pages/f.js
diff --git a/Common/TorrentList.js b/Common/TorrentList.js
index 0c07874..1f964a5 100644
--- a/Common/TorrentList.js
+++ b/Common/TorrentList.js
@@ -1,184 +1,187 @@
import moment from 'moment'
-import { useRouter } from 'next/router'
+import {useRouter} from 'next/router'
import React from 'react'
import Modal from 'react-modal'
-import { formatBytes } from './CardExpanded'
+import {formatBytes} from './CardExpanded'
-import DataTable, { createTheme } from 'react-data-table-component'
-import { useTheme } from 'next-themes'
+import DataTable, {createTheme} from 'react-data-table-component'
+import {useTheme} from 'next-themes'
-const TorrentList = ({ setisTorrent, torrent_list, runtime }) => {
- const { theme, settheme } = useTheme()
- const router = useRouter()
+const TorrentList = ({setisTorrent, torrent_list, runtime}) => {
+ const theme = useTheme()
+ const router = useRouter()
- const customStyles = {
- content: {
- top: '50%',
- left: '50%',
- right: 'auto',
- bottom: 'auto',
- marginRight: '-50%',
- transform: 'translate(-50%, -50%)',
- background: '#171e30',
- maxHeight: '700px',
- maxWidth: '1500px',
- border: '0px',
- width: '100%',
- borderColor: '#454851',
- },
- }
+ const customStyles = {
+ content: {
+ top: '50%',
+ left: '50%',
+ right: 'auto',
+ bottom: 'auto',
+ marginRight: '-50%',
+ transform: 'translate(-50%, -50%)',
+ background: '#171e30',
+ maxHeight: '700px',
+ maxWidth: '1500px',
+ border: '0px',
+ width: '100%',
+ borderColor: '#454851',
+ },
+ }
- const qualityRegex = /(4K|720p|1080p|2160p|720P|360P|360p|1080P)/i
+ const qualityRegex = /(4K|720p|1080p|2160p|720P|360P|360p|1080P)/i
- const columns = [
- {
- name: 'Name',
- selector: row => row.name,
- sortable: true,
- },
- {
- name: 'Action',
+ const columns = [
+ {
+ name: 'Name',
+ selector: row => row.name,
+ sortable: true,
+ },
+ {
+ name: 'Action',
- cell: (row, index) => {
- let slug = row?.name
- .toLowerCase()
- .trim()
- .replace(/[^\w\s-]/g, '')
- .replace(/[\s_-]+/g, '-')
- .replace(/^-+|-+$/g, '')
+ cell: (row, index) => {
+ let slug = row?.name
+ .toLowerCase()
+ .trim()
+ .replace(/[^\w\s-]/g, '')
+ .replace(/[\s_-]+/g, '-')
+ .replace(/^-+|-+$/g, '')
- return (
- router.push(`/post-detail/${row?.eid}/${slug}/`)}>
- Download
-
- )
- },
- width: '8%',
- style: {
- color: '#296ac8',
- cursor: 'pointer',
- },
- },
- {
- name: 'Category',
- selector: row => row.category_str,
- width: '8%',
- sortable: true,
- },
- {
- name: 'Res',
- selector: row =>
- row.name.match(qualityRegex) ? row.name.match(qualityRegex)[0] : '',
- width: '6%',
- sortable: true,
- sortFunction: (a, b) => {
- function compareQuality(a, b) {
- if (a && b) {
- const regex = /(\d+)p/
- const qualityA = parseInt(
- a.name.match(qualityRegex)
- ? a.name.match(qualityRegex)[0]?.match(regex)
- : ''
- )
- const qualityB = parseInt(
- b.name.match(qualityRegex)
- ? b.name.match(qualityRegex)[0]?.match(regex)
- : ''
- )
- return qualityA - qualityB
- }
- }
+ return (
+ router.push(`/post-detail/${row?.eid}/${slug}/`)}>
+ Download
+
+ )
+ },
+ width: '8%',
+ style: {
+ color: '#296ac8',
+ cursor: 'pointer',
+ },
+ },
+ {
+ name: 'Category',
+ selector: row => row.category_str,
+ width: '8%',
+ sortable: true,
+ },
+ {
+ name: 'Res',
+ selector: row =>
+ row.name.match(qualityRegex) ? row.name.match(qualityRegex)[0] : '',
+ width: '6%',
+ sortable: true,
+ sortFunction: (a, b) => {
+ function compareQuality(a, b) {
+ if (a && b) {
+ const regex = /(\d+)p/
+ const qualityA = parseInt(
+ a.name.match(qualityRegex)
+ ? a.name.match(qualityRegex)[0]?.match(regex)
+ : ''
+ )
+ const qualityB = parseInt(
+ b.name.match(qualityRegex)
+ ? b.name.match(qualityRegex)[0]?.match(regex)
+ : ''
+ )
+ return qualityA - qualityB
+ }
+ }
- return compareQuality(a, b)
- },
- },
- {
- name: 'Date',
- selector: row => moment(row?.last_checked).format('DD-MM-YYYY'),
- width: '9%',
- sortable: true,
- },
- {
- name: 'Runtime',
- selector: row => moment.utc(runtime * 1000).format('HH:mm:ss'),
- width: '9%',
- sortable: true,
- },
- {
- name: 'Size',
- selector: row => formatBytes(row?.size),
- sortable: true,
- width: '7%',
- sortFunction: (a, b) => {
- return a.size - b.size
- },
- },
- {
- name: 'S',
- selector: row => row?.seeders,
- sortable: true,
- width: '5%',
- style: {
- color: '#00FF00',
- },
- },
- {
- name: 'L',
- selector: row => row.leechers,
- sortable: true,
- width: '5%',
- style: {
- color: '#dd0c0e',
- },
- },
- ]
- createTheme('dark', {
- background: {
- default: 'transparent',
- },
- })
+ return compareQuality(a, b)
+ },
+ },
+ {
+ name: 'Date',
+ selector: row => moment(row?.last_checked).format('DD-MM-YYYY'),
+ width: '9%',
+ sortable: true,
+ },
+ {
+ name: 'Runtime',
+ selector: row => moment.utc(runtime * 1000).format('HH:mm:ss'),
+ width: '9%',
+ sortable: true,
+ },
+ {
+ name: 'Size',
+ selector: row => formatBytes(row?.size),
+ sortable: true,
+ width: '7%',
+ sortFunction: (a, b) => {
+ return a.size - b.size
+ },
+ },
+ {
+ name: 'S | L',
+ cell: (row, index) => {
+ let l = row?.leechers
+ let s = row?.seeders
+ return (
+
+ {l} | {s}
+
+ )
+ },
+ sortable: true,
+ sortFunction: (a, b) => {
+ return a?.leechers - b?.leechers
+ },
+ width: '8%',
+ style: {
+ color: '#00FF00',
+ },
+ },
- const customCss = {
- headCells: {
- style: {
- fontSize: '14px',
- fontWeight: '700',
- color: theme === 'dark' ? '#C2D8D3' : '#000000',
- },
- },
- }
+ ]
+ createTheme('dark', {
+ background: {
+ default: 'transparent',
+ },
+ })
- console.log('torrent_list', torrent_list)
+ const customCss = {
+ headCells: {
+ style: {
+ fontSize: '14px',
+ fontWeight: '700',
+ color: theme === 'dark' ? '#C2D8D3' : '#000000',
+ },
+ },
+ }
- createTheme('dark', {
- background: {
- default: 'transparent',
- },
- })
+ console.log('torrent_list', torrent_list)
- return (
- <>
- Sorry Torrent Not Available Try after some days !!!
- Sorry Torrent Not Available Try after some days !!!
+