problem with %cen-Tag in webAOM

misc client related stuff

Moderators: AniDB, AniDB API

Locked
Seoman
Posts: 13
Joined: Sat Oct 06, 2007 8:43 pm

problem with %cen-Tag in webAOM

Post by Seoman »

Hi.
I want to rename my animes with the following script:
IF I(eng) DO SET '%eng' #make sure there is an English title set
ELSE DO SET '%ann' #otherwise use the romaji
IF T(Movie) DO ADD ' - %epn' #If it is a movie use the epname (only!), generally would be 'Complete Movie', or 'Part X of Y'
ELSE IF T(!Movie);E(^Volume \d$) DO ADD ' - %enr' #just to avoid things like "animename - 1 - Volume 1 ..."
ELSE DO ADD ' - %enr - %epn' #in "normal case" use the epnumber and epname (if it is not a movie and epname does not include "Volume")
IF G(!unknown) DO ADD ' [%grp]' #use group short name if group exists
ELSE DO ADD ' [no group]' #otherwise mark so
IF D(japanese);D(english) DO ADD '(DUAL JAP+ENG)' #add (DUAL JAP+ENG) if the file is JAP+ENG audio
ELSE IF D(japanese);D(german) DO ADD '(DUAL JAP+GER)' #add (DUAL JAP+GER) if the file is JAP+GER audio
ELSE IF D(japanese);S(none) DO ADD '(RAW)' #Add (RAW) if the file is not subbed and with original japanese audio
ELSE IF D(english);D(!japanese) DO ADD '(ENG DUB)' #if file has english audio only mark it so
ELSE IF D(german);D(!japanese) DO ADD '(GER DUB)' #if file has german audio only mark it so
ELSE IF D(instrumental) DO ADD '(INST)' #mark as instrumental if necessary
ELSE DO ADD '(DUB %dub)' #if it is something else, list whatever the language is...
IF S(!english);S(!none) DO ADD '(SUB %sub)' #If it is subbed in another language than english, list the language (i.e. SUB GER)
IF I(cen) DO ADD '(%cen)' #add (cen) or (unc) - but how to avoid ()?
Everything works fine except for the very last line: for every file that has neither a 'censored' nor an 'uncensored' there are empty brackets added.

I'm not familiar with Java (I created the script above basically by copying from posts in this forum :wink:).
Is there a possibility to check wether the cen-Tag contains explicitly "cen" or "unc", so the Tag is only added in those two cases?


PS: Does anyone know how to limit the categories added with the %gen-Tag? 10 or more categories per file is maybe a bit overdone ...
epoximator
AniDB Staff
Posts: 379
Joined: Sun Nov 07, 2004 11:05 am

Post by epoximator »

i'll fix the I()
i dunno about gen.. don't see why you want it in a file name. and it's a bit difficult to limit, since the api does just return them unordered and without weights
Seoman
Posts: 13
Joined: Sat Oct 06, 2007 8:43 pm

Post by Seoman »

i'll fix the I()
So it's a bug and not my fault? *yippie!* :wink:

For the gen-Tag: I was just fooling around with this one, thought in some cases it would be nice to add one or two categories automatically. But if there is no way to do this it's no loss either. Although 'gen' seems to be pretty useless then, doesn't it?

thx anyway
epoximator
AniDB Staff
Posts: 379
Joined: Sun Nov 07, 2004 11:05 am

Post by epoximator »

the tags are used other places, like the file info window, for example. i also meant to add some export stuff at some point which would use the tags too. (don't think that'll ever happen though)
Seoman
Posts: 13
Joined: Sat Oct 06, 2007 8:43 pm

Post by Seoman »

OK, now I use a slightly different script, and this one works. No empty brackets are added. As far as I can tell it seems to be a problem with the comments: adding a comment with "//" works fine, adding with "#" may cause problems.
But as I said - I've no real idea of scripting.
Here is the new script (in case it's useful for someone):
IF I(eng) DO SET '%eng' //make sure there is an English title set
ELSE DO SET '%ann' //otherwise use the romaji
IF T(Movie) DO ADD ' - %epn' //If it is a movie use the epname only. generally would be 'Complete Movie' or 'Part X of Y'
ELSE IF T(!Movie);E(^Volume \d$) DO ADD ' - %enr' //just to avoid things like "animename - 1 - Volume 1 ..."
ELSE DO ADD ' - %enr - %epn' //in "normal case" use the epnumber and epname (if it is not a movie and epname does not include "Volume")
#IF G(!unknown) DO ADD ' [%grp]' //use group short name if group exists
#ELSE DO ADD ' [no group]' //otherwise mark so
IF D(japanese);D(english) DO ADD ' (DUAL JAP+ENG)' //add (DUAL JAP+ENG) if the file is JAP+ENG audio
ELSE IF D(japanese);D(german) DO ADD ' (DUAL JAP+GER)' //add (DUAL JAP+GER) if the file is JAP+GER audio
ELSE IF D(japanese);S(none) DO ADD ' (RAW)' //Add (RAW) if the file is not subbed and with original japanese audio
ELSE IF D(english);D(!japanese) DO ADD ' (ENG DUB)' //if file has only english audio mark it so
ELSE IF D(german);D(!japanese) DO ADD ' (GER DUB)' //if file has only german audio mark it so
ELSE IF D(instrumental) DO ADD ' (INST)' //mark as instrumental if necessary
ELSE IF D(!japanese);S(!english) DO ADD ' (DUB %dub)' //if it is something else, list whatever the language is...
IF S(!english);S(!none) DO ADD ' (SUB %sub)' //If it is subbed in another language than english, list the language (i.e. SUB GER)
IF I(cen) DO ADD ' (%cen)' //add (cen) or (unc) - but how to avoid ()?
Seoman
Posts: 13
Joined: Sat Oct 06, 2007 8:43 pm

Post by Seoman »

Ah - still some (minor) problems with it:

a) Multiple episode files are not renamed correctly. For example FID 72521 & 72520 (Dragon Warrior Ep. 1-7 & 8-13) are named like this: "Dragon Warrior - 02-07 - Level 1 (ENG DUB).avi" and "Dragon Warrior - 09-13 - Level 8 (ENG DUB).avi", thus skipping the first episode of each file.

b) With some files, like FID 126230 & 126231 I got this: "Doukyuusei Climax - 1 - Episode 1 (SUB chinese (unspecified)).mkv". Is this a database issue?

c) Movies with "Complete Movie" as episode name get an additional " ' " and spaces at the end, like FID 16230: "A Wind Named Amnesia - Complete Movie' .ogm". Same goes for files with "Part X of Y".

d) [edit] Found one more thing (with FID 96625): an additional space is inserted in the episode name (after "Chapter") although there is none in the filename on AniDB. "Dragon Century - 1 - God Chapter A.D. 1990 Riko.avi"
[edit] 8O 8O OK, now it's getting strange: the additional space is not displayed when I post the filename here in the forum - but it is in the editing window. So just imagine two spaces between "Chapter" and "A.D." 8O 8O


Oh - and thx for fixing the cen-Tag problem. :D
ricce
Posts: 199
Joined: Wed Apr 06, 2005 8:42 pm
Location: Sweden / Västrås
Contact:

Post by ricce »

a) I don't think WebAOM can handle files like that yet.

b) What's wrong? wrong language? then it is a database error.

c) Check the line:
ELSE IF T(!Movie);E(^Volume \d$) DO ADD ' - %enr'

Did you forget the first ' ?

d) It is actually two spaces there, but it isn't shown so in the webinterface eather. In English you often use two spaces after a period to make a larger space but it shouldn't be so hear.
epoximator
AniDB Staff
Posts: 379
Joined: Sun Nov 07, 2004 11:05 am

Post by epoximator »

a) bug in server code again
b) "chinese (unspecified)" is the language string. the others are: chinese (cantonese), chinese (mandarin), chinese (simplified), chinese (traditional), chinese (taiwanese)
d) yes, it's like that in the db. you can creq it if you want

c) yeah, bug. webaom looks for the first and last ' to find the actual data to add. then it checks for //. so you get:

Code: Select all

" - %epn' //If it is a movie use the epname only. generally would be "
then

Code: Select all

" - %epn' "
so, you can't use ' in the comment
Seoman
Posts: 13
Joined: Sat Oct 06, 2007 8:43 pm

Post by Seoman »

OK, thanks a lot. It works now. :D
Locked