Closed papaj-na-wrotkach closed 1 year ago
H is a test for episode type. You could use it like so:
IF H(O) DO ADD 'O%enr'
IF H(S) DO ADD 'S%enr'
....
https://github.com/ShokoAnime/ShokoServer/blob/3c92e6a8663be31c0b4ab3c8d34968a4d783b1c0/Shoko.Server/Renamer/LegacyRenamer.cs#L57 for a full list
Closing this so I don't forget. You can continue replying to it if you need more help.
Thank you! That's exactly what I needed. Btw is there a documentation for the rename scripts apart from the mentioned file?
Kind of. This isn't complete, as we've added things like H() to it, but this is what it was based on. https://wiki.anidb.net/WebAOM#Scripting
Thank you again. And also why special
and credit
types have the prefix added by default?
I tried
IF H(E) DO ADD 'E%enr'
IF H(S) DO ADD 'S%enr'
IF H(T) DO ADD 'T%enr'
IF H(C) DO ADD 'C%enr'
IF H(P) DO ADD 'P%enr'
IF H(O) DO ADD 'O%enr'
but it renamed SP01.mkv
to SS01.mkv
and OP01.mkv
to CC01.mkv
When i tried:
IF H(E) DO ADD 'E%enr'
IF H(S) DO ADD '%enr'
IF H(T) DO ADD 'T%enr'
IF H(C) DO ADD '%enr'
IF H(P) DO ADD 'P%enr'
IF H(O) DO ADD 'O%enr'
it worked as expected:
Facepalm... It already adds the type for anything but a normal episode. That was my bad for not checking. Personally, I would add the episode name to Credits, as those will just be things like Opening, Ending 1, etc
We also have other renamers you can use if you don't like the WebAOM script environment.
Basically %enr
for specials and credits returns not only a number but a number with prefix. I think it's because the API returns prefixed string. I don't know about UDP API, but for http API it's like this (the epno
tag):
...
<episode id="136268" update="2012-01-10">
<epno type="4">T4</epno>
<length>3</length>
<airdate>2012-01-09</airdate>
<title xml:lang="en">PV 4</title>
</episode>
<episode id="136357" update="2012-03-26">
<epno type="3">C2</epno>
<length>2</length>
<airdate>2012-01-13</airdate>
<rating votes="6">6.99</rating>
<title xml:lang="en">Ending 2</title>
</episode>
<episode id="136358" update="2012-03-26">
<epno type="3">C1</epno>
<length>2</length>
<airdate>2012-01-13</airdate>
<rating votes="3">3.94</rating>
<title xml:lang="en">Opening</title>
</episode>
...
Now the question is if the %enr
should be pre-parsed by Shoko or should the parsing be a done in renamer script like this:
IF H(E) DO ADD 'episode'
IF H(S) DO ADD 'special'
IF H(T) DO ADD 'trailer'
IF H(C) DO ADD 'credit'
IF H(P) DO ADD 'parody'
IF H(O) DO ADD 'other'
DO ADD '_%enr'
IF H(S) DO REPLACE '_S' '_'
IF H(T) DO REPLACE '_T' '_'
IF H(C) DO REPLACE '_C' '_'
IF H(P) DO REPLACE '_P' '_'
IF H(O) DO REPLACE '_O' '_'
(posted before reading the two messages above, sorry) edit: simplified replacing
Facepalm... It already adds the type for anything but a normal episode. That was my bad for not checking. Personally, I would add the episode name to Credits, as those will just be things like Opening, Ending 1, etc
The episode name is good solution as it also solves my problem with separating openings and endings from credits type episodes. The question is if they are always things as simple as Opening 1
or Ending 2b
...
We also have other renamers you can use if you don't like the WebAOM script environment.
Do you mean the GroupAwareSortingRenamer or something entirely different?
The episode name will only be that simple for Credits.
No, he means things like https://github.com/Mik1ll/LuaRenamer
Wrong button
The episode name will only be that simple for Credits.
Not always. Today I found this one which is not... Well, I guess I'll use the other renamer because it should have more options and it should allow me to parse openings/endings filenames.
You could also add functionality to detect credit episode type by its relations:
It could be done by taking first relation or by counting how many opening and how many ending relations it has (and choosing opening
if there are more opening relations or ending
- if there are more ending relations).
It won't work for every credit episode though - e.g. that episode I mentioned before has no relations. In such cases the type could be null
or credit
so user can detect it and e.g. try to parse title, just use title or use the credit
as 3rd type of credit episodes (however strange it sounds).
We can't get the song relations from the API. When I said credits, that's what the C stands for in episode types, it is generally reserved for creditless versions of the OP/ED. That appears to be an exception. Usually that would have it's own special, not a Credits episode
What I meant by "The episode name will only be that simple for Credits." was that other types almost guaranteed will have more complicated names.
I understand how credit
episodes work, this one certainly is an exception from other credit
type episodes - it's only fanservice + some music (maybe that's why someone added it as a opening/ending). I agree that "The episode name will only be that simple for Credits." but my point is that they could be anything.
2.3. Eptitle of C eps: The default naming convention for eptitle of C eps is: Opening 1, Opening 2, Ending 1, Ending 2, etc. If there is only 1 opening and/or 1 ending, drop the numeral from the name. If there are foreign language OP/ED, pre-pend the name with the language. For example: "German Opening 1".
I didn't know that the API doesn't provide info about episode-song relation though.
Thank you for your support. Have a great day!
Yep np. I prefer to over-explain if there seems to be a miscommunication somewhere. Our community is very international with English as a second or third language being common
Hello, I wanted to use file renaming scripts to cleanup my collection and I'm missing this one feature. On anidb every episode has it's type:
It would be nice to have information about the type of episode in filename. In my case I would like to name my episodes like the episodes are displayed on anidb:
i.e.:
Is there possibly already a way to achieve this?