Skip to content

Commit

Permalink
v1.1.0 (#277)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
amilajack authored Aug 25, 2018
1 parent a2b8c84 commit 69ad45d
Show file tree
Hide file tree
Showing 35 changed files with 831 additions and 1,897 deletions.
25 changes: 3 additions & 22 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,14 @@
},
"rules": {
"class-methods-use-this": "off",
"fp/no-arguments": "off",
"fp/no-class": "off",
"fp/no-delete": "off",
"fp/no-events": "off",
"fp/no-get-set": "off",
"fp/no-let": "off",
"fp/no-loops": "off",
"fp/no-mutating-assign": "off",
"fp/no-mutating-methods": "off",
"fp/no-mutation": "off",
"fp/no-nil": "off",
"fp/no-proxy": "off",
"fp/no-rest-parameters": "off",
"fp/no-this": "off",
"fp/no-throw": "off",
"fp/no-unused-expression": "off",
"fp/no-valueof-field": "off",
"import/no-extraneous-dependencies": "off",
"no-var": "off",
"no-let": "off",
"no-plusplus": "off",
"no-use-before-define": "off",
"no-console": "off",
"promise/avoid-new": "off",
"react/sort-comp": "off",
"react/destructuring-assignment": "off",
"react/jsx-filename-extension": "off"
"react/jsx-filename-extension": "off",
"import/no-extraneous-dependencies": "off",
"no-nested-ternary": "off"
},
"settings": {
"import/extensions": [".jsx", ".js"],
Expand Down
1 change: 0 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ app
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
esproposal.export_star_as=enable
experimental.strict_type_args=true

module.name_mapper.extension='css' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
module.name_mapper.extension='styl' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ before_script:
- greenkeeper-lockfile-update

script:
- yarn lint
# - yarn test
- yarn package-ci
- yarn build-e2e
- yarn test-e2e --quarantine-mode
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ cd popcorn-time-desktop
# 💡 For casting support, you will need to satisfy mdns's requirements:
# For windows install bonjour: https://support.apple.com/downloads/bonjour_for_windows
# For linux, make sure you have these dependencies installed with apt-get:
# https://github.com/amilajack/popcorn-time-desktop/blob/v1.0.0/.travis.yml#L23-L35
# https://github.com/amilajack/popcorn-time-desktop/blob/v1.1.0/.travis.yml#L24-L35

# Install dependencies
# Have a cup of coffee ☕️ this might take a while
Expand Down
2 changes: 2 additions & 0 deletions app/api/Subtitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default class SubtitleServer {

server: express;

port: ?number;

async startServer(): Promise<void> {
// Find a port at runtime. Default to 4000 if it is available
this.port =
Expand Down
68 changes: 34 additions & 34 deletions app/api/Torrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,35 @@ type metadataType = {
activeMode: string
};

/**
* Get the subtitle file buffer given an array of files
*/
export function selectSubtitleFile(
files: Array<{ name: string }> = [],
activeMode: string,
metadata: { season: number, episode: number }
): { name: string } | boolean {
return (
files.find(file => {
const formatIsSupported = file.name.includes('.srt');

switch (activeMode) {
// Check if the current file is the exact episode we're looking for
case 'season_complete': {
const { season, episode } = metadata;
return (
formatIsSupported && isExactEpisode(file.name, season, episode)
);
}

// Check if the current file is greater than the previous file
default:
return formatIsSupported;
}
}) || false
);
}

export default class Torrent {
inProgress: boolean = false;

Expand Down Expand Up @@ -60,8 +89,8 @@ export default class Torrent {

this.engine.add(magnetURI, { path: cacheLocation }, torrent => {
const server = torrent.createServer();
server.listen(port);
this.server = server;
this.server = server.listen(port);
// this.server = server;

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

destroy() {
if (this.inProgress) {
console.log('Destroyed Torrent...');

if (this.server && typeof this.server.close === 'function') {
if (this.server && this.server.close) {
console.log('Closing the torrent server...');
this.server.close();
this.server = {};
}

this.clearIntervals();

console.log('Destroying the torrent engine...');
this.engine.destroy();
this.engine = undefined;

Expand Down Expand Up @@ -190,32 +219,3 @@ export function formatSpeeds(
ratio
};
}

/**
* Get the subtitle file buffer given an array of files
*/
export function selectSubtitleFile(
files: Array<{ name: string }> = [],
activeMode: string,
metadata: { season: number, episode: number }
): { name: string } | boolean {
return (
files.find(file => {
const formatIsSupported = file.name.includes('.srt');

switch (activeMode) {
// Check if the current file is the exact episode we're looking for
case 'season_complete': {
const { season, episode } = metadata;
return (
formatIsSupported && isExactEpisode(file.name, season, episode)
);
}

// Check if the current file is greater than the previous file
default:
return formatIsSupported;
}
}) || false
);
}
26 changes: 11 additions & 15 deletions app/api/metadata/MetadataAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import OpenSubtitles from 'opensubtitles-api';
import { merge, resolveCache, setCache } from '../torrents/BaseTorrentProvider';
import TheMovieDbMetadataProvider from './TheMovieDbMetadataProvider';
// import TraktMetadataProvider from './TraktMetadataProvider';
import type { runtimeType } from './MetadataProviderInterface';

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

function MetadataAdapter() {
return [
// new TraktMetadataProvider(),
new TheMovieDbMetadataProvider()
];
return [new TheMovieDbMetadataProvider()];
}

async function interceptAndHandleRequest(
Expand Down Expand Up @@ -156,6 +152,16 @@ function getShows(...args: Array<string>) {
return interceptAndHandleRequest('getShows', args);
}

function formatSubtitle(subtitle) {
return {
kind: 'captions',
label: subtitle.langName,
srclang: subtitle.lang,
src: `${subtitlesEndpoint}/${encodeURIComponent(subtitle.url)}`,
default: subtitle.lang === 'en'
};
}

/**
* Get the subtitles for a movie or show
*
Expand Down Expand Up @@ -259,16 +265,6 @@ export function parseRuntimeMinutesToObject(
};
}

function formatSubtitle(subtitle) {
return {
kind: 'captions',
label: subtitle.langName,
srclang: subtitle.lang,
src: `${subtitlesEndpoint}/${encodeURIComponent(subtitle.url)}`,
default: subtitle.lang === 'en'
};
}

export default {
getMovie,
getMovies,
Expand Down
Loading

0 comments on commit 69ad45d

Please sign in to comment.