Skip to content

Commit 69ad45d

Browse files
authored
v1.1.0 (#277)
* chore(misc): migrate all code style to eslint config, fix all eslint errors * chore(item): migrate more components to reactstrap * chore(item): migrate more components to reactstrap * chore(package): remove unnecessary dependencies * feat(main.dev.js): save and restore window state * fix(item): fix broken item page playback toggle active bug * chore(pct): bump pct from 1.0.0 -> 1.1.0 * feat(item): add recently watched feature
1 parent a2b8c84 commit 69ad45d

35 files changed

+831
-1897
lines changed

.eslintrc

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,14 @@
77
},
88
"rules": {
99
"class-methods-use-this": "off",
10-
"fp/no-arguments": "off",
11-
"fp/no-class": "off",
12-
"fp/no-delete": "off",
13-
"fp/no-events": "off",
14-
"fp/no-get-set": "off",
15-
"fp/no-let": "off",
16-
"fp/no-loops": "off",
17-
"fp/no-mutating-assign": "off",
18-
"fp/no-mutating-methods": "off",
19-
"fp/no-mutation": "off",
20-
"fp/no-nil": "off",
21-
"fp/no-proxy": "off",
22-
"fp/no-rest-parameters": "off",
23-
"fp/no-this": "off",
24-
"fp/no-throw": "off",
25-
"fp/no-unused-expression": "off",
26-
"fp/no-valueof-field": "off",
27-
"import/no-extraneous-dependencies": "off",
28-
"no-var": "off",
2910
"no-let": "off",
3011
"no-plusplus": "off",
31-
"no-use-before-define": "off",
3212
"no-console": "off",
3313
"promise/avoid-new": "off",
3414
"react/sort-comp": "off",
35-
"react/destructuring-assignment": "off",
36-
"react/jsx-filename-extension": "off"
15+
"react/jsx-filename-extension": "off",
16+
"import/no-extraneous-dependencies": "off",
17+
"no-nested-ternary": "off"
3718
},
3819
"settings": {
3920
"import/extensions": [".jsx", ".js"],

.flowconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ app
1414
esproposal.class_static_fields=enable
1515
esproposal.class_instance_fields=enable
1616
esproposal.export_star_as=enable
17-
experimental.strict_type_args=true
1817

1918
module.name_mapper.extension='css' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
2019
module.name_mapper.extension='styl' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ before_script:
7474
- greenkeeper-lockfile-update
7575

7676
script:
77+
- yarn lint
78+
# - yarn test
7779
- yarn package-ci
7880
- yarn build-e2e
7981
- yarn test-e2e --quarantine-mode

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ cd popcorn-time-desktop
6363
# 💡 For casting support, you will need to satisfy mdns's requirements:
6464
# For windows install bonjour: https://support.apple.com/downloads/bonjour_for_windows
6565
# For linux, make sure you have these dependencies installed with apt-get:
66-
# https://github.com/amilajack/popcorn-time-desktop/blob/v1.0.0/.travis.yml#L23-L35
66+
# https://github.com/amilajack/popcorn-time-desktop/blob/v1.1.0/.travis.yml#L24-L35
6767

6868
# Install dependencies
6969
# Have a cup of coffee ☕️ this might take a while

app/api/Subtitle.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export default class SubtitleServer {
2020

2121
server: express;
2222

23+
port: ?number;
24+
2325
async startServer(): Promise<void> {
2426
// Find a port at runtime. Default to 4000 if it is available
2527
this.port =

app/api/Torrent.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@ type metadataType = {
1414
activeMode: string
1515
};
1616

17+
/**
18+
* Get the subtitle file buffer given an array of files
19+
*/
20+
export function selectSubtitleFile(
21+
files: Array<{ name: string }> = [],
22+
activeMode: string,
23+
metadata: { season: number, episode: number }
24+
): { name: string } | boolean {
25+
return (
26+
files.find(file => {
27+
const formatIsSupported = file.name.includes('.srt');
28+
29+
switch (activeMode) {
30+
// Check if the current file is the exact episode we're looking for
31+
case 'season_complete': {
32+
const { season, episode } = metadata;
33+
return (
34+
formatIsSupported && isExactEpisode(file.name, season, episode)
35+
);
36+
}
37+
38+
// Check if the current file is greater than the previous file
39+
default:
40+
return formatIsSupported;
41+
}
42+
}) || false
43+
);
44+
}
45+
1746
export default class Torrent {
1847
inProgress: boolean = false;
1948

@@ -60,8 +89,8 @@ export default class Torrent {
6089

6190
this.engine.add(magnetURI, { path: cacheLocation }, torrent => {
6291
const server = torrent.createServer();
63-
server.listen(port);
64-
this.server = server;
92+
this.server = server.listen(port);
93+
// this.server = server;
6594

6695
const { file, torrentIndex } = torrent.files.reduce(
6796
(previous, current, index) => {
@@ -146,15 +175,15 @@ export default class Torrent {
146175

147176
destroy() {
148177
if (this.inProgress) {
149-
console.log('Destroyed Torrent...');
150-
151-
if (this.server && typeof this.server.close === 'function') {
178+
if (this.server && this.server.close) {
179+
console.log('Closing the torrent server...');
152180
this.server.close();
153181
this.server = {};
154182
}
155183

156184
this.clearIntervals();
157185

186+
console.log('Destroying the torrent engine...');
158187
this.engine.destroy();
159188
this.engine = undefined;
160189

@@ -190,32 +219,3 @@ export function formatSpeeds(
190219
ratio
191220
};
192221
}
193-
194-
/**
195-
* Get the subtitle file buffer given an array of files
196-
*/
197-
export function selectSubtitleFile(
198-
files: Array<{ name: string }> = [],
199-
activeMode: string,
200-
metadata: { season: number, episode: number }
201-
): { name: string } | boolean {
202-
return (
203-
files.find(file => {
204-
const formatIsSupported = file.name.includes('.srt');
205-
206-
switch (activeMode) {
207-
// Check if the current file is the exact episode we're looking for
208-
case 'season_complete': {
209-
const { season, episode } = metadata;
210-
return (
211-
formatIsSupported && isExactEpisode(file.name, season, episode)
212-
);
213-
}
214-
215-
// Check if the current file is greater than the previous file
216-
default:
217-
return formatIsSupported;
218-
}
219-
}) || false
220-
);
221-
}

app/api/metadata/MetadataAdapter.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import OpenSubtitles from 'opensubtitles-api';
66
import { merge, resolveCache, setCache } from '../torrents/BaseTorrentProvider';
77
import TheMovieDbMetadataProvider from './TheMovieDbMetadataProvider';
8-
// import TraktMetadataProvider from './TraktMetadataProvider';
98
import type { runtimeType } from './MetadataProviderInterface';
109

1110
type subtitlesType = {
@@ -27,10 +26,7 @@ const openSubtitles = new OpenSubtitles({
2726
});
2827

2928
function MetadataAdapter() {
30-
return [
31-
// new TraktMetadataProvider(),
32-
new TheMovieDbMetadataProvider()
33-
];
29+
return [new TheMovieDbMetadataProvider()];
3430
}
3531

3632
async function interceptAndHandleRequest(
@@ -156,6 +152,16 @@ function getShows(...args: Array<string>) {
156152
return interceptAndHandleRequest('getShows', args);
157153
}
158154

155+
function formatSubtitle(subtitle) {
156+
return {
157+
kind: 'captions',
158+
label: subtitle.langName,
159+
srclang: subtitle.lang,
160+
src: `${subtitlesEndpoint}/${encodeURIComponent(subtitle.url)}`,
161+
default: subtitle.lang === 'en'
162+
};
163+
}
164+
159165
/**
160166
* Get the subtitles for a movie or show
161167
*
@@ -259,16 +265,6 @@ export function parseRuntimeMinutesToObject(
259265
};
260266
}
261267

262-
function formatSubtitle(subtitle) {
263-
return {
264-
kind: 'captions',
265-
label: subtitle.langName,
266-
srclang: subtitle.lang,
267-
src: `${subtitlesEndpoint}/${encodeURIComponent(subtitle.url)}`,
268-
default: subtitle.lang === 'en'
269-
};
270-
}
271-
272268
export default {
273269
getMovie,
274270
getMovies,

0 commit comments

Comments
 (0)