User:Fahrenheit: Difference between revisions

From AniDB
Jump to navigation Jump to search
mNo edit summary
 
(19 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{TOCright}}
== New Anime Page Patterns and Usage ==
== New Anime Page Patterns and Usage ==
The new anime page can use patterns to format your ed2k link praticaly any way you like, just use the 33 currently available formats to that end.
 
Implemented, official page at: [[PAGE_PREFERENCES_ED2K]].
 
== Custom filters for files ==
The new anime page supports custom filters for files. Currently there are 4 types of filters:
;Deprecated : this filter marks files as deprecated
;Unfiltered : this one checks which files don't get filtered
;Visible : checks to see which files even if marked as to be hidden should be displayed
;Hidden : hides files based on user preferences
 
The default rules for each filter follow the [[Files:Deprecated_files|Deprecated files]] rules currently implemented in AniDB except for the Hidden filter that also hides files based on user profile language preferences.


----
----
==== Patterns available ====


; %ann : Anime Title (uses default language definitions)
=== Syntax and some rules ===
; %anja : Anime Title japkanji (defaults to %ann)
 
; %anro : Anime Title romaji (default fallback language)
Filter Syntax:<br>
; %anen : Anime title english (defaults to %ann)
Except for element "0", that states how many rules there are, elements follow this format:<br>
; %epn : Episode Title (uses default language definitions)
"'''RULE NUMBER'''":{"'''RULE SUBJECT''' #1":"'''OPERATION''','''TEST'''";"'''RULE SUBJECT''' #2":"'''OPERATION''','''TEST'''"; etc};<br>
; %epja : Episode title japkanji (defaults to %epn)
<br>
; %epro : Episode title romaji (defaults to %epn)
Where '''RULE SUBJECT''' can be one of the following:
; %epen : Episode title english (default fallback language)
<br>
; %enr : Episode number
;fdate : File add date
; %pn : Part name ("EP" if anime.type != 4 || "PA" otherwise)
;eusers : Total number of users for this episode
; %pnf : Full part name ("Episode" if anime.type != 4 || "Part" otherwise)
;fusers : Total number of users for this file
; %raw : if file is raw (no subtitles outputs RAW)
;fcrc : File CRC status (valid, invalid, unknown)
; %crc : Crc sum or INVALID if crc invalid
;fqual : File quality
; %CRC : Crc sum (in caps) or INVALID if crc invalid
;fgroup : File Group Id
; %ver : Version string (only if version > 1)
;fversion : File version
; %cen : Censored string
;finmylist : File is in MyList
; %dub : Dub languages (ALL OF THEM, comma separated)
;efvisible : Total number of files
; %sub : Sub languages (ALL OF THEM, comma separated)
;falang : Any of the file audio languages is one of the preferred langs (if using obj.filterAudLang) or given lang
; %lang : dub.sub_jp+.de+ (current db format)
;fslang : Any of the file audio languages is one of the preferred langs (if using obj.filterSubLang) or given lang
; %langs : dub.sub_jp,de,en.de,en (extended format)
;ftype : File type (generic)
; %grp : Group short name
;fsource : File source (HDTV, DTV, etc)
; %grn : Group full name
;fextension : File extension (mkv, avi, mov, etc)
; %qual : Quality
;fdeprecated : Is file deprecated
; %src : Source
;fraw : Is file RAW
; %res : Resolution
;fgroupfiltered : Is group filtered
; %vid : Video codec
<br>
; %eps : Total number of episodes
'''Notes:'''
; %type : [unknown, TV, OVA, Movie, Other, web]
* When '''RULE SUBJECT''' is prefixed with "c_sf_", there will be test of comparison for all files of the episode and the results of this comparison will be stored in processing Files
; %fid : File ID
* When '''RULE SUBJECT''' is prefixed with "c_rf_", there will be test of comparison for all files stored in processing Files, and the list will be updated with the results
; %aid : Anime ID
* No '''RULE SUBJECT''' prefixed with "c_" imply that you are testing an attribute, think of it as a SQL select where
; %eid : Episode ID
<br>
; %gid : Group ID
'''OPERATION''' can be one of the following:
<br>
;> : greater than
;< : lesser than
;>= : greater or equal than
;<= : lesser or equal than
;== : Equal to
;!= : Not equal to
<br>
Where '''TEST''' is the value to test, there are special cases:
<br>
;this : will test against the same '''RULE SUBJECT''' (only used in "c" prefixed '''RULE SUBJECTS''')
<br>
'''Notes:'''
* For each '''RULE NUMBER''' the '''RULE SUBJECTS''' are tested using '''AND'''
* Will only test '''RULES''' until end or a failed test
 
----
----
==== *If* like cases ====


Currently there's a way to make something like if cases, imagine that you want to show that a file is raw you could do something like this:
==== Default Unfiltered ====
<tt>[%raw] %ann - %enr - %epn</tt>
<pre>filterObj.defaultUnfiltered = {0:2,
But that would show for files that weren't raw some thing like this: <i>"[] Full Metal Panic! - 01 - The guy I kinda Like is a Sergeant"</i>.
                              1:{"fdate":"<,172800"},
                              2:{"ftype":"==,generic"}};</pre>
 
==== Default Deprecated ====
<pre>filterObj.defaultDeprecated = {0:5,
                            1:{"eusers":">=,50","fusers":"<=,3","fcrc":"!=,valid"},
                            2:{"fcrc":"==,invalid"},
                            3:{"fqual":">,1","fqual":"<=,5"},
                            4:{"c_sf_fgroup":"==,this","c_rf_fsource":"==,this","c_rf_fversion":"==,this","c_rf_fextension":"==,this","c_rf_fcrc":"==,valid","fcrc":"!=,valid","fgroup":"!=,0"},
                            5:{"c_sf_fgroup":"==,this","c_rf_fsource":"==,this","c_rf_fversion":">,this","c_rf_fextension":"==,this","c_rf_fcrc":"==,valid","fgroup":"!=,0"}}
</pre>
 
==== Default Visible ====
<pre>filterObj.defaultVisible = {0:5,
                            1:{"fdeprecated":"==,true"},
                            2:{"finmylist":"==,true"},
                            3:{"fusers":">=,50"},
                            4:{"fdate":"<,604800"},
                            5:{"efvisible":"<,1"}};</pre>
 
==== Default Hidden ====
<pre>filterObj.defaultHidden = {0:2,
                          1:{"falang":"==,obj.filterAudLang"},
                          2:{"fslang":"==,obj.filterSubLang"}};</pre>
 
=== Example of usage ===
 
Imagine you had a ''fcen'' that would return true if a file is marked as censored, ''funcen'' that would return true if a file is marked as uncensored and a ''acen'' that would return true if the current anime has been marked as +18.
Having this if you wanted to hide all censored files for a +18 anime and only leave uncensored or not marked files you would add this to the hidden filter.
 
<pre>filterObj.hidden = {0:1,
                    1:{"acen":"==,true","fcen":"==,true"}};</pre>
 
This filter would mark as hidden all censored files for a +18 anime.
 
'''Notes:''' obviously this isn't a very practical way to input file filters, I need to write some interface for it before this can be used.


What you can use is '<' and '>' pairs, if a pattern inside of '<' and '>' returns "" the entire text inside of the '<' and '>' would simply not be shown, so if you changed your tag to be something like this:
<tt><[%raw] >%ann - %enr - %epn</tt>
For non raw files it would simply output this: <i>"Full Metal Panic! - 01 - The guy I kinda Like is a Sergeant"</i>
----
----


==== Default formats ====
== Pseudo-Files ==
 
As part of the anime3 scripts I've developed a kind super file implementation, a bit like of [[Shadow_Files|Shadow Files]], i call them Pseudo-Files.
What they are is simple, whenever there are [[Content:File_relations|File Relations]] involved i create a new file from all the data the relations give me. IE:
 
File A is a video file with the following attributes: ja audio, en subtitles.
File B is a subtitle file which adds de subtitles to File A.
 
Currently i gave users the option to expand files which have file<->file relations, so the file table for the Episode that holds File A and File B would look like this with all files expanded:
 
File A .......<br>
\- File B ....<br>
File B .......<br>
\- File A
 
With pseudo-files i create a new super-file that would have the following attributes ja audio, en and de subtitles, and it's representation is something like this, where File P is the Pseudo-File:
 
File P .......<br>
|- File A ....<br>
\- File B ....
 
Pseudo-files are also victim of file filters, so imagine some file would get hidden because it didn't have all the languages you wanted but a pseudo-file which was parent of that file had all the languages, the pseudo-file would not get hidden. In case it did fail the test it would get hidden.


Currently anidb uses something like this format:
This is the magic of pseudo-files. Another unused feature of show=anime3
<tt>%ann - %enr%ver - %epn - <[%grp]><(%crc)><(%cen)><(%lang)><(%raw)></tt>
This format for file [http://anidb.info/perl-bin/animedb.pl?show=file&fid=182271&nonav=1 182271] returns the following ed2k links:
; anidb current page : <i>Full_Metal_Panic!_-_01_-_The_guy_I_kinda_Like_is_a_Sergeant_-_[aF](c154d33d)(dub.sub_jp+.de+)</i>
; new anime page : <i>Full_Metal_Panic!_-_01_-_The_guy_I_kinda_Like_is_a_Sergeant_-_[aF](c154d33d)(dub.sub_jp+.de+)</i>


<b>note</b>: the last link gets encoded to pass in browsers, the actual output is:
== Notes ==
<tt>ed2k://|file|Full%20Metal%20Panic!%20-%2001%20-%20The%20guy%20I%20kinda%20Like%20is%20a%20Sergeant%20-%20%5BaF%5D(c154d33d)(dub.sub_jp+.de+).avi|238990934|62c078dc6c78597e7a6c81734cc0ee27|/</tt>
As you have noticed, any of the features referred here is ready to be used by normal users, it's like the ground work for future features. So if someone really wants this, bug me until I write an interface for them :P

Latest revision as of 10:17, 14 May 2009

New Anime Page Patterns and Usage

Implemented, official page at: PAGE_PREFERENCES_ED2K.

Custom filters for files

The new anime page supports custom filters for files. Currently there are 4 types of filters:

Deprecated
this filter marks files as deprecated
Unfiltered
this one checks which files don't get filtered
Visible
checks to see which files even if marked as to be hidden should be displayed
Hidden
hides files based on user preferences

The default rules for each filter follow the Deprecated files rules currently implemented in AniDB except for the Hidden filter that also hides files based on user profile language preferences.


Syntax and some rules

Filter Syntax:
Except for element "0", that states how many rules there are, elements follow this format:
"RULE NUMBER":{"RULE SUBJECT #1":"OPERATION,TEST";"RULE SUBJECT #2":"OPERATION,TEST"; etc};

Where RULE SUBJECT can be one of the following:

fdate
File add date
eusers
Total number of users for this episode
fusers
Total number of users for this file
fcrc
File CRC status (valid, invalid, unknown)
fqual
File quality
fgroup
File Group Id
fversion
File version
finmylist
File is in MyList
efvisible
Total number of files
falang
Any of the file audio languages is one of the preferred langs (if using obj.filterAudLang) or given lang
fslang
Any of the file audio languages is one of the preferred langs (if using obj.filterSubLang) or given lang
ftype
File type (generic)
fsource
File source (HDTV, DTV, etc)
fextension
File extension (mkv, avi, mov, etc)
fdeprecated
Is file deprecated
fraw
Is file RAW
fgroupfiltered
Is group filtered


Notes:

  • When RULE SUBJECT is prefixed with "c_sf_", there will be test of comparison for all files of the episode and the results of this comparison will be stored in processing Files
  • When RULE SUBJECT is prefixed with "c_rf_", there will be test of comparison for all files stored in processing Files, and the list will be updated with the results
  • No RULE SUBJECT prefixed with "c_" imply that you are testing an attribute, think of it as a SQL select where


OPERATION can be one of the following:

>
greater than
<
lesser than
>=
greater or equal than
<=
lesser or equal than
==
Equal to
!=
Not equal to


Where TEST is the value to test, there are special cases:

this
will test against the same RULE SUBJECT (only used in "c" prefixed RULE SUBJECTS)


Notes:

  • For each RULE NUMBER the RULE SUBJECTS are tested using AND
  • Will only test RULES until end or a failed test

Default Unfiltered

filterObj.defaultUnfiltered = {0:2,
                               1:{"fdate":"<,172800"},
                               2:{"ftype":"==,generic"}};

Default Deprecated

filterObj.defaultDeprecated = {0:5,
                            1:{"eusers":">=,50","fusers":"<=,3","fcrc":"!=,valid"},
                            2:{"fcrc":"==,invalid"},
                            3:{"fqual":">,1","fqual":"<=,5"},
                            4:{"c_sf_fgroup":"==,this","c_rf_fsource":"==,this","c_rf_fversion":"==,this","c_rf_fextension":"==,this","c_rf_fcrc":"==,valid","fcrc":"!=,valid","fgroup":"!=,0"},
                            5:{"c_sf_fgroup":"==,this","c_rf_fsource":"==,this","c_rf_fversion":">,this","c_rf_fextension":"==,this","c_rf_fcrc":"==,valid","fgroup":"!=,0"}}

Default Visible

filterObj.defaultVisible = {0:5,
                            1:{"fdeprecated":"==,true"},
                            2:{"finmylist":"==,true"},
                            3:{"fusers":">=,50"},
                            4:{"fdate":"<,604800"},
                            5:{"efvisible":"<,1"}};

Default Hidden

filterObj.defaultHidden = {0:2,
                           1:{"falang":"==,obj.filterAudLang"},
                           2:{"fslang":"==,obj.filterSubLang"}};

Example of usage

Imagine you had a fcen that would return true if a file is marked as censored, funcen that would return true if a file is marked as uncensored and a acen that would return true if the current anime has been marked as +18. Having this if you wanted to hide all censored files for a +18 anime and only leave uncensored or not marked files you would add this to the hidden filter.

filterObj.hidden = {0:1,
                    1:{"acen":"==,true","fcen":"==,true"}};

This filter would mark as hidden all censored files for a +18 anime.

Notes: obviously this isn't a very practical way to input file filters, I need to write some interface for it before this can be used.


Pseudo-Files

As part of the anime3 scripts I've developed a kind super file implementation, a bit like of Shadow Files, i call them Pseudo-Files. What they are is simple, whenever there are File Relations involved i create a new file from all the data the relations give me. IE:

File A is a video file with the following attributes: ja audio, en subtitles. File B is a subtitle file which adds de subtitles to File A.

Currently i gave users the option to expand files which have file<->file relations, so the file table for the Episode that holds File A and File B would look like this with all files expanded:

File A .......
\- File B ....
File B .......
\- File A

With pseudo-files i create a new super-file that would have the following attributes ja audio, en and de subtitles, and it's representation is something like this, where File P is the Pseudo-File:

File P .......
|- File A ....
\- File B ....

Pseudo-files are also victim of file filters, so imagine some file would get hidden because it didn't have all the languages you wanted but a pseudo-file which was parent of that file had all the languages, the pseudo-file would not get hidden. In case it did fail the test it would get hidden.

This is the magic of pseudo-files. Another unused feature of show=anime3

Notes

As you have noticed, any of the features referred here is ready to be used by normal users, it's like the ground work for future features. So if someone really wants this, bug me until I write an interface for them :P