How to use the plugin as a scanlation team

View previous topic View next topic Go down

How to use the plugin as a scanlation team

Post  Doonge on Thu Jul 12, 2012 11:32 am

Introduction


The plugin allows users to manage and follow scanlation teams' feeds (through HTML5's localStorage feature), and automatically accesses them (through CORS request) while browsing webtoons that your team translate.  If you want to distribute your work through users' plugin, you'll have to provide a feed that gives appropriate information (in JSON) about your work.



3 key parameters


When accessing your feed, a plugin user gives you three pieces of information :
- the identifier of the webtoon he's reading.
- the identifier of the publication (the chapter sortof) aswell.
- the duration in minutes since last visit.

What are these identifiers?
http http://comic.naver.com/webtoon/detail.nhn?titleId=186811&no=50 leads us to Cheese in the trap, Season 2 Chapter 1.  "Cheese in the trap" webtoon's identifier is 186811, and "CITT Season 2 chapter 1" publication's identifier is 50.  Note that [ this url ] works too.  Sometimes an ID is invalid, for instance [ Publication #95 of Cheese in the Trap ] does not exist, and you will just see the most recent publication/chapter when accessing it.

If an user just added your feed, or if it has been a while he didn't check your feed, he will just ask for the status of your projects.  Both given identifiers will be set to 0.  And if it's the first time, duration will also be set to 0 (minimum given duration is always 1 otherwise, even if the user is spamming).

Technically, supposing that your feed's url is feedURL, the plugin will access

http :// {feedURL} / {publisher hostname} / {webtoon's id} / {publication's id} . json ? {duration}
For instance http://feedURL/comic.naver.com/186811/50.json?60 for Cheese in the Trap Season 2 Chapter 1 (last visit one hour ago).
Or http://feedURL/comic.naver.com/0/0.json?0 the first time the user poke your feed.

*note : in a previous version of the addon, the time parameter was a date in YYYYMMDD (GMT) format.  One year is approx. 525000 minutes.  So if higher than that, assume it's maybe a date and not a duration in minutes.*



Hosting the feed

If you want to distribute your work through simple, flat, JSON files neatly stored in your website (in case you are not allowed to use dynamic langage like php on your website), it works okay but the automated tracking of your new projects is less smooth (so you'll have to work around).

If you want to distribute your work through a dynamic script (php for instance), this works fine.  If you use a php file, like feed.php, the plugin would access http://feedURL/feed.php/186811/50.json?60, and you could retrieve the identifiers through $_SERVER['PATH_INFO'] and $_SERVER['QUERY_STRING'].  Never forget to verify malicious input.
You may even simplify the feed's URL and hide the .php (or whatever) extension with URL rewriting (.htaccess file).
Note that when using dynamic scripts, you must specify that you return a JSON file, and send the correct header.  In php, the line
Code:
header("content-type: application/json");
does the trick.

If you want to change the default behaviour, and have a custom URL format, you may provide a generic URL with the parameters in curly brackets ({id} for webtoon's identifier, {no} for publication's identifier, and {time} for duration).
For instance someURL/feed.php?webtoon={id}&chapter={no}&last_visit={time}
It will change the default behavior, which is feedURL/{id}/{no}.json?{time}



In all cases, you'll have to validate the CORS requests for comic.naver.com by sending an additionnal header; setting Access-Control-Allow-Origin to http://comic.naver.com
This can be done with an .htaccess file in the feed directory, containing the line
Code:
Header set Access-Control-Allow-Origin http://comic.naver.com
, or within the feed dynamic script (if you use one).  For instance, in php the line
Code:
header("Access-Control-Allow-Origin: http://comic.naver.com");
works as well.




What should the feed provide ?

A JSON file. ( http://www.json.org/ )
This is a simple text message (text file) between two curly brackets, that links parameters names and parameters values, comma-separated.  Array are "[ ]" and objects are "{ }".
content of a json file wrote:{"parameterName" : "parameterValue", "otherParameterName" : "otherParameterValue"}

Here's the list of variables names, and what they do if contained in the JSON file:

General
"teamName" : your team's name.  Give only if it changes, or when the user is performing his first visit (minute parameter will be set as 0).
"teamURL" : optionnal, your team's website.  Give only if it changes, or when the user is performing his first visit (minute parameter will be set as 0).

"add" : [{"id": , "title": , "author": , "blurb": }, {} , ...]  "Most complicated" command.  Object or Array of objects.  Add (or update) webtoons to the team's pool.  All the property must be correctly given :
- id is the webtoon's id
- title is the title of the webtoon
- author the name of the author
- blurb the little synopsis of the webtoon (you can use the token {endl} to force an endline).

"remove" : [ , , ,] ID or Array of ID.  Removes the corresponding webtoons from the team. (in case project dropped, or "falsely added").


When viewing a chapter
"chapterName": specify the current publication/chapter name,
"generalUrl": general form of the layers' URL.  The {imgNumber} token MUST be present.  This confirms the current chapter has been translated, don't give if not translated.
"urls": [ , , , ... ] array of URLs.  The size must match with the number of layers required.  This confirms the current chapter has been translated, don't give if not translated.  If most of the URLs fit with the generalURL parameter, just write 0 or the number of the image, in that case the URL will be judged wrong and the generalURL, if exists, will be used.
"split": integer value indicating you have split the layers (OSS did that with earlier chapters of CITT, because they were way too big), and give the size of the split. It is 1400 for the first chapters of CITT (all cut images are 1400px tall, except the last splits).


Last edited by Doonge on Thu Aug 21, 2014 4:48 am; edited 1 time in total

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: How to use the plugin as a scanlation team

Post  Mizura on Thu Aug 21, 2014 1:23 am

Hello, I'm trying to figure out how this works, since Naver now has official translations (most sadly not up-to-date) and asked scanlations to stop. ^^

The example links at the end don't seem to be working, so I'm not completely sure how it works (sorry, I'm a n00b at this ^^; ). Here's what I understood:

1. The scanlator needs to have a host directory, such as:
http://www.[website].com/feed/{webtoon ID number}/

2. The directory needs to have a .htaccess file with this in it:
Header set Access-Control-Allow-Origin http://comic.naver.com

3. For each chapter, we need a {chapter-number}.json file, which is a text file with .json extension and this as content (filled as necessary, of course):

{
"chapterName":
"first":
"previous":
"next":
"last":
"generalUrl":
"urls":
"split": (if there's image splitting?)
}

It can also contain the following other variables? (I didn't 100% understand this, probably because the example files aren't available)
"teamName"
"teamLogo"
"teamURL"
"add" : [{"id": , "category": , "title": , "author": , "blurb": , "thumbnail": , "smallThumbnail": }, {} , ...]

4. For each chapter, we need the files to be shown over the original (mostly-transparent .png images save for scanlated areas)
Let's say the files for chapter 50 is in http://www.[website].com/feed/{webtoon ID number}/50/
Let's say they're named file01.png, file02.png etc. In that case, I can either use:

"generalUrl": "http://www.[website].com/feed/{webtoon ID number}/50/file{imgNumber}.png"
"urls": 0
In this case, it will go through all the image files in order. Or I can do:
"generalUrl": "http://www.[website].com/feed/{webtoon ID number}/50/file{imgNumber}.png"
"urls": ["http://www.[website].com/feed/{webtoon ID number}/50/file01.png","http://www.[website].com/feed/{webtoon ID number}/50/file02.png" etc]

Anything else needed? Thanks in advance. Smile

Mizura
Newbie
Newbie

Posts : 6
Join date : 2011-09-25

View user profile

Back to top Go down

Re: How to use the plugin as a scanlation team

Post  Doonge on Thu Aug 21, 2014 4:37 am

Hello Mizura, I'm gonna edit this guide since the script has a little changed with time.

You need a host, yes.
If this host can run a script (supports php, asp, ruby...), then you don't have to make manually the json files.

If you want to make directory and json file, then

1. you need to add the hostname of the publisher in the directory
http://www.[website].com/feed/{publisher}/{webtoon ID number}/
for instance
http://www.[website].com/feed/comic.naver.com/186811/

2. yes (if the publisher is comic.naver.com)

3. you don't need to fill "first" "previous" "next" and "last", those values are deprecated (we use the website's own navigation).
But in your case (if you don't rely on a script and make your own json file manually), it's best to systematically include "teamName" and "teamURL" (teamLogo is deprecated).

4. yes


Alternatively, you can also use our own feed. If that suits you, I'll edit it to make it more friendly (it's already used by hanging nine scans, which I already promised to make the feed simpler *woops* ^^).

Doonge
Artisan
Artisan

Posts : 754
Join date : 2012-01-18

View user profile

Back to top Go down

Re: How to use the plugin as a scanlation team

Post  Mizura on Thu Aug 21, 2014 7:50 am

Wow! Thanks for the fast response! So it's more user-friendly now? I'm looking forward to the updated guide. Very Happy
So if you can use .php scripts, the script part later on can be more or less automated, is that what you're saying?

I actually did see hanging nine scans using your script. Very Happy I didn't realize that it was an updated version.

In any case, thanks for the plugin, it's a really awesome solution! Very Happy

Edit: To those who are curious by the way, Doonge has already explained to me the entire process. Thanks Doonge!

Mizura
Newbie
Newbie

Posts : 6
Join date : 2011-09-25

View user profile

Back to top Go down

Re: How to use the plugin as a scanlation team

Post  Sponsored content Today at 5:43 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum