15 Commits

Author SHA1 Message Date
Godzil
1dea620295 1.1.19 2017-05-12 00:14:24 +01:00
Manoël Trapier
2019c104b6 Add comment on issue report 2017-05-10 16:29:58 +01:00
Manoël Trapier
9f1ead1368 Update README.md 2017-05-09 20:15:51 +01:00
Manoël Trapier
41f67798d6 Merge pull request #22 from ssttevee/master
Custom filenames
2017-05-09 19:55:45 +01:00
ssttevee
2c2ed2c136 added more custom filename variables 2017-03-29 14:10:06 -07:00
ssttevee
4dc90aeb00 added custom filenames 2017-03-29 13:59:51 -07:00
Godzil
361c6cf54c Abandon node v4 as some packages does not want to install. 2017-03-16 19:25:06 +01:00
Godzil
b691b953d4 remove a useless target and update travis 2017-03-16 18:34:54 +01:00
Godzil
3d067979e9 update node version for travis 2017-03-16 17:47:58 +01:00
Godzil
58247f53e4 Add Travis 2017-03-16 17:44:35 +01:00
Manoël Trapier
6189e31e6b Update README.md 2017-03-16 12:08:59 +00:00
Manoël Trapier
3df650a0a6 Markdown I hate you 2017-02-27 16:14:55 +00:00
Manoël Trapier
c785c0f7c3 Add comment about login 2017-02-27 16:14:16 +00:00
Godzil
a01f3cd09c 1.1.18: Fix issue #19 2017-02-16 23:05:16 +00:00
Godzil
ed4f398062 Fix #19, better to check if a file exist before trying to copy it 😂 2017-02-16 23:03:43 +00:00
8 changed files with 94 additions and 5 deletions

11
.travis.yml Normal file
View File

@@ -0,0 +1,11 @@
language: node_js
sudo: false
node_js:
- 5
- 6
before_install:
- npm install --dev
script:
- npm run types
- npm run compile
- npm test

View File

@@ -1,5 +1,7 @@
# Crunchy: a fork of Deathspike/CrunchyRoll.js
[![Issue Stats](http://issuestats.com/github/Godzil/Crunchy/badge/issue)](http://issuestats.com/github/Godzil/Crunchy) [![Travis CI](https://travis-ci.org/Godzil/Crunchy.svg?branch=master)](https://travis-ci.org/Godzil/Crunchy)
*Crunchy* is capable of downloading *anime* episodes from the popular *CrunchyRoll* streaming service. An episode is stored in the original video format (often H.264 in a MP4 container) and the configured subtitle format (ASS or SRT).The two output files are then merged into a single MKV file.
## Motivation
@@ -19,7 +21,7 @@ It is recommended to enable authentication (`-p` and `-u`) so your account permi
## Prerequisites
* NodeJS >= 0.12.x (http://nodejs.org/)
* NodeJS >= 5.x (http://nodejs.org/)
* NPM >= 2.5.x (https://www.npmjs.org/)
## Installation
@@ -93,6 +95,8 @@ Download *Fairy Tail* to `C:\Anime`:
* `-p or --pass <s>` sets the password.
* `-u or --user <s>` sets the e-mail address or username.
_Please remember that login has to be done for each call of Crunchy, as none of the credentials are stored_
##### Disables
* `-c or --cache` disables the cache.
@@ -110,6 +114,36 @@ Download *Fairy Tail* to `C:\Anime`:
* `-s or --series <s>` sets the series override.
* `-t or --tag <s>` sets The subgroup. (Default: CrunchyRoll)
## When things goes wrong
First, make sure you have the latest version of Crunchy installed, if you run an older version, the issue you face may have been solved.
Second thing to check, you have to give your credentials (-u and -p parameters) each time you run Crunchy. It does not actually store the token it receive when login and need to relog each time it is called. This may change in the future.
Third, is it a recently released episode? If yes, sometimes CR have issues were the requested format is not available, and Crunchy is not able to get it. When in doubt, try to watch CR website, if it does not work there, Crunchy will not either. This is valid in all cases even on non recently released.
Fourth, sometimes, CR website does weird things, and there are some transient errors, wait a couple of minutes (or hours) and try again. It often solved the issue on my side (yes I know that's not really a way of fixing, but if the error is on CR side, Crunchy can't do anything)
If really nothing works or you find a problem with Crunchy, then you can go and fill an Issue, first read the already open and closed one to make sure you are not reporting an existing problem. If your problem has been already reported, what you can do is to either:
- Add a comment saying you also have the same issue
- Add a Thumbs Up reaction to the original entry in the issue, they will are used as a metric to know how many people are annoyed by that issue
If you find one which correspond and is close, don't hesitate to add a comment, the issue may have not be fully solved.
If there is no comparable opened or close issue, you can create a new one.
### What to put in a bug report
It is really important for me to know:
- on which Operating System you are running Crunchy,
- which anime you want to fetch if it is related to a specific one,
- The command line you use to run Crunchy
- What message Crunchy is giving you if any
**Please be careful to remove your real account login and password if they appear!**
Also don't hesitate to add labels you feel apropriate on your report.
_Note: You can also use a bug report for a feature requests._
## Developers
More information will be added at a later point. For now the recommendations are:
@@ -117,3 +151,8 @@ More information will be added at a later point. For now the recommendations are
* Atom with `atom-typescript` and `linter-tslint` (and dependencies).
Since this project uses TypeScript, compile with `node ts` or `npm install`.
#### A note about pull requests:
If you want to help working on this project, Pull request are welcome, but please explain the goal of your changes, and do a pull request per change: you want to add support for _X_, _Y_ and _Z_, make a pull request for X, one for Y and one for Z. I'm not saying a pull request per commit that would be idiotic.
The idea is if your pull request changes lots of thing at the same time, if just a single part can't be accepted, if will delay the acceptation of the whole pull request where some of the feature could be integrated quicker is they were requested alone.
Also if for example the change _Y_ depends on _X_, you can wait for _X_ to be accepted before requesting for _Y_, if they are independant you can send a pull request for each at the same time.

View File

@@ -12,7 +12,7 @@
"type": "git",
"url": "git://github.com/Godzil/crunchyroll.js.git"
},
"version": "1.1.17",
"version": "1.1.19",
"bin": {
"crunchy": "./bin/crunchy"
},
@@ -37,7 +37,6 @@
"compile": "tsc",
"test": "tslint -c ./tslint.json --project ./tsconfig.json ./src/**/*.ts",
"types": "typings install",
"reinstall": "tsd reinstall; npm run types",
"start": "node ./bin/crunchy"
},
"bugs": {

View File

@@ -149,6 +149,7 @@ function parse(args: string[]): IConfigLine
.option('-f, --format <s>', 'The subtitle format. (Default: ass)')
.option('-o, --output <s>', 'The output path.')
.option('-s, --series <s>', 'The series override.')
.option('-n, --filename <s>', 'The name override.')
.option('-t, --tag <s>', 'The subgroup. (Default: CrunchyRoll)')
.parse(args);
}

View File

@@ -196,7 +196,20 @@ function name(config: IConfig, page: IEpisodePage, series: string, extra: string
const volume = (volumeNum < 10 ? '0' : '') + page.volume;
const tag = config.tag || 'CrunchyRoll';
return series + ' - s' + volume + 'e' + episode + ' - [' + tag + ']' + extra;
if (!config.filename) {
return page.series + ' - s' + volume + 'e' + episode + ' - [' + tag + ']' + extra;
}
return config.filename
.replace(/{EPISODE_ID}/g, page.id.toString())
.replace(/{EPISODE_NUMBER}/g, episode)
.replace(/{SEASON_NUMBER}/g, volume)
.replace(/{VOLUME_NUMBER}/g, volume)
.replace(/{SEASON_TITLE}/g, page.season)
.replace(/{VOLUME_TITLE}/g, page.season)
.replace(/{SERIES_TITLE}/g, series)
.replace(/{EPISODE_TITLE}/g, page.title)
.replace(/{TAG}/g, tag) + extra;
}
/**
@@ -238,6 +251,7 @@ function scrapePage(config: IConfig, address: string, done: (err: Error, page?:
const regexp = /\s*([^\n\r\t\f]+)\n?\s*[^0-9]*([0-9][\-0-9.]*)?,?\n?\s\s*[^0-9]*((PV )?[S0-9][P0-9.]*[a-fA-F]?)/;
const look = $('#showmedia_about_media').text();
const seasonTitle = $('span[itemprop="title"]').text();
let episodeTitle = $('#showmedia_about_name').text().replace(/[“”]/g, '');
const data = regexp.exec(look);
if (!swf || !data)
@@ -248,6 +262,8 @@ function scrapePage(config: IConfig, address: string, done: (err: Error, page?:
episode: '0',
id: epId,
series: seasonTitle,
season: seasonTitle,
title: episodeTitle,
swf: swf[1],
volume: '0',
});
@@ -258,6 +274,8 @@ function scrapePage(config: IConfig, address: string, done: (err: Error, page?:
episode: data[3],
id: epId,
series: data[1],
season: seasonTitle,
title: episodeTitle,
swf: swf[1],
volume: data[2] || '1',
});

View File

@@ -12,5 +12,6 @@ interface IConfig {
format?: string;
output?: string;
series?: string;
filename?: string;
tag?: string;
}

View File

@@ -3,5 +3,7 @@ interface IEpisodePage {
episode: string;
series: string;
volume: string;
season: string;
title: string;
swf: string;
}

View File

@@ -9,6 +9,21 @@ import url = require('url');
import log = require('./log');
const persistent = '.crpersistent';
/**
* Check if a file exist..
*/
function fileExist(path: string)
{
try
{
fs.statSync(path);
return true;
} catch (e)
{
return false;
}
}
/**
* Streams the series to disk.
*/
@@ -17,7 +32,10 @@ export default function(config: IConfig, address: string, done: (err: Error) =>
const persistentPath = path.join(config.output || process.cwd(), persistent);
/* Make a backup of the persistent file in case of */
fse.copySync(persistentPath, persistentPath + '.backup');
if (fileExist(persistentPath))
{
fse.copySync(persistentPath, persistentPath + '.backup');
}
fs.readFile(persistentPath, 'utf8', (err: Error, contents: string) =>
{