Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
887b3ed094 | ||
|
|
49e3290f28 | ||
|
|
5d32d91d7d | ||
|
|
2f1858cde7 | ||
|
|
a98ed223c6 | ||
|
|
575569bd91 |
@@ -80,9 +80,9 @@ Download *Fairy Tail* to the current work directory:
|
||||
|
||||
crunchyroll http://www.crunchyroll.com/fairy-tail
|
||||
|
||||
Download *Fairy Tail* to `C:\Manga`:
|
||||
Download *Fairy Tail* to `C:\Anime`:
|
||||
|
||||
crunchyroll --output C:\Manga http://www.crunchyroll.com/fairy-tail
|
||||
crunchyroll --output C:\Anime http://www.crunchyroll.com/fairy-tail
|
||||
|
||||
#### Switches
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"type": "git",
|
||||
"url": "git://github.com/Deathspike/crunchyroll.js.git"
|
||||
},
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"bin": {
|
||||
"crunchyroll": "./bin/crunchyroll"
|
||||
},
|
||||
|
||||
@@ -51,7 +51,8 @@ function download(config: typings.IConfig, page: typings.IEpisodePage, player: t
|
||||
downloadVideo(config, page, player, filePath, err => {
|
||||
if (err) return done(err);
|
||||
if (config.merge) return complete('Finished ' + fileName, now, done);
|
||||
video.merge(config, player.video.file, filePath, err => {
|
||||
var isSubtited = Boolean(player.subtitle);
|
||||
video.merge(config, isSubtited, player.video.file, filePath, err => {
|
||||
if (err) return done(err);
|
||||
complete('Finished ' + fileName, now, done);
|
||||
});
|
||||
@@ -63,8 +64,9 @@ function download(config: typings.IConfig, page: typings.IEpisodePage, player: t
|
||||
/**
|
||||
* Saves the subtitles to disk.
|
||||
*/
|
||||
function downloadSubtitle(config: typings.IConfig, player: typings.IEpisodePlayer, filePath: string, done: (err: Error) => void) {
|
||||
function downloadSubtitle(config: typings.IConfig, player: typings.IEpisodePlayer, filePath: string, done: (err?: Error) => void) {
|
||||
var enc = player.subtitle;
|
||||
if (!enc) return done();
|
||||
subtitle.decode(enc.id, enc.iv, enc.data, (err, data) => {
|
||||
if (err) return done(err);
|
||||
var formats = subtitle.formats;
|
||||
@@ -121,7 +123,7 @@ function scrapePage(config: typings.IConfig, address: string, done: (err: Error,
|
||||
if (err) return done(err);
|
||||
var $ = cheerio.load(result);
|
||||
var swf = /^([^?]+)/.exec($('link[rel=video_src]').attr('href'));
|
||||
var regexp = /Watch\s+(.+?)(?:\s+Season\s+([0-9]+))?\s+Episode\s+([0-9]+)/;
|
||||
var regexp = /-\s+(?:Watch\s+)?(.+?)(?:\s+Season\s+([0-9]+))?(?:\s+-)?\s+Episode\s+([0-9]+)/;
|
||||
var data = regexp.exec($('title').text());
|
||||
if (!swf || !data) return done(new Error('Invalid page.'));
|
||||
done(null, {
|
||||
@@ -151,12 +153,13 @@ function scrapePlayer(config: typings.IConfig, address: string, id: number, done
|
||||
}, (err: Error, player: typings.IEpisodePlayerConfig) => {
|
||||
if (err) return done(err);
|
||||
try {
|
||||
var isSubtitled = Boolean(player['default:preload'].subtitle);
|
||||
done(null, {
|
||||
subtitle: {
|
||||
subtitle: isSubtitled ? {
|
||||
id: parseInt(player['default:preload'].subtitle.$.id, 10),
|
||||
iv: player['default:preload'].subtitle.iv,
|
||||
data: player['default:preload'].subtitle.data
|
||||
},
|
||||
} : null,
|
||||
video: {
|
||||
file: player['default:preload'].stream_info.file,
|
||||
host: player['default:preload'].stream_info.host
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface IEpisodePage {
|
||||
}
|
||||
|
||||
export interface IEpisodePlayer {
|
||||
subtitle: {
|
||||
subtitle?: {
|
||||
id: number;
|
||||
iv: string;
|
||||
data: string;
|
||||
|
||||
@@ -10,13 +10,13 @@ import typings = require('../typings');
|
||||
/**
|
||||
* Merges the subtitle and video files into a Matroska Multimedia Container.
|
||||
*/
|
||||
function main(config: typings.IConfig, rtmpInputPath: string, filePath: string, done: (err: Error) => void) {
|
||||
function main(config: typings.IConfig, isSubtitled: boolean, rtmpInputPath: string, filePath: string, done: (err: Error) => void) {
|
||||
var subtitlePath = filePath + '.' + (subtitle.formats[config.format] ? config.format : 'ass');
|
||||
var videoPath = filePath + path.extname(rtmpInputPath);
|
||||
childProcess.exec(command() + ' ' +
|
||||
'-o "' + filePath + '.mkv" ' +
|
||||
'"' + videoPath + '" ' +
|
||||
'"' + subtitlePath + '"', {
|
||||
(isSubtitled ? '"' + subtitlePath + '"' : ''), {
|
||||
maxBuffer: Infinity
|
||||
}, err => {
|
||||
if (err) return done(err);
|
||||
@@ -32,7 +32,7 @@ function main(config: typings.IConfig, rtmpInputPath: string, filePath: string,
|
||||
*/
|
||||
function command(): string {
|
||||
if (os.platform() !== 'win32') return 'mkvmerge';
|
||||
return path.join(__dirname, '../../bin/mkvmerge.exe');
|
||||
return '"' + path.join(__dirname, '../../bin/mkvmerge.exe') + '"';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,5 +22,5 @@ function main(rtmpUrl: string, rtmpInputPath: string, swfUrl: string, filePath:
|
||||
*/
|
||||
function command(): string {
|
||||
if (os.platform() !== 'win32') return 'rtmpdump';
|
||||
return path.join(__dirname, '../../bin/rtmpdump.exe');
|
||||
return '"' + path.join(__dirname, '../../bin/rtmpdump.exe') + '"';
|
||||
}
|
||||
Reference in New Issue
Block a user