ShokoAnime / ShokoDesktop

Repository for Shoko Desktop
http://shokoanime.com/shokodesktop/
103 stars 24 forks source link

Manual Link of Specials Updates Main Series Episode #593

Closed Vesnyx closed 5 years ago

Vesnyx commented 5 years ago

VERSION INFORMATION

Server Version: 3.9.3

Desktop Version: 3.9.3

If you've compiled your own version, please use the last commit you compiled.

Log

Here's what an example request shows up as:

[2018-12-25 00:52:10:576] Info|UIElement.RaiseEventImpl => EventRoute.InvokeHandlersImpl => UnrecognisedVideos.btnConfirm_Click [Unrecognizedfiles] Selected one video for linking = True
[2018-12-25 00:52:10:576] Info|UIElement.RaiseEventImpl => EventRoute.InvokeHandlersImpl => UnrecognisedVideos.btnConfirm_Click [Unrecognizedfiles] Multplie videos selected for linking = False
[2018-12-25 00:52:10:592] Info|UIElement.RaiseEventImpl => EventRoute.InvokeHandlersImpl => UnrecognisedVideos.btnConfirm_Click [Unrecognizedfiles] Multiple type selected index = 1
[2018-12-25 00:52:10:592] Info|UIElement.RaiseEventImpl => EventRoute.InvokeHandlersImpl => UnrecognisedVideos.btnConfirm_Click [Unrecognizedfiles] Linking single episode for anime: Re:Creators | episodeNumbnerName 3 - Ending 1 | videolocal: 517 | animeEpisodeID: 1088
[2018-12-25 00:52:10:628] Info|UIElement.RaiseEventImpl => EventRoute.InvokeHandlersImpl => UnrecognisedVideos.btnConfirm_Click [Unrecognizedfiles] episode linked successfully

DESCRIPTION

When using the manual link function to link specials/openings/trailers, Shoko appears to be sending an update to AniDB with the episode number. For example, marking a file as C1, will have it displayed as C1 in Shoko's database, but on AniDB, it instead says Episode 1.

STEPS TO REPRODUCE

  1. Get an unrecognized file.
  2. Choose a series to link.
  3. Set the episode as a special in that series.
  4. ???
  5. Check episode linked on AniDB.
da3dsoul commented 5 years ago

I'm going to rename this. If I don't understand properly, then do tell me.

You link a file manually. It works as expected in Shoko. It adds the file (marks as watched, etc) in your AniDB MyList, but as the wrong episode.

I'll give you a heads-up. Manual Links have issues with...lots of things, but it's usually an issue with info not existing or API being incomplete.

For example, the MyList API is incomplete and generally garbage. The way we used to do it was against their terms and only worked by chance

Vesnyx commented 5 years ago

You link a file manually. It works as expected in Shoko. It adds the file (marks as watched, etc) in your AniDB MyList, but as the wrong episode.

Yes that is exactly correct. S1 maps to 1.

Took a look at both the Shoko calls and the UDP definitions on the aniDB wiki.

https://github.com/ShokoAnime/ShokoServer/blob/master/Shoko.Server/AniDB_API/Commands/AniDBCommand_AddFile.cs#L130

Here, Shoko is assigning the episode number as an int, which I assume prevents the extra info about it being a special from being noticed.

The API itself has this as its definition, exactly the same as Shoko implements it: https://wiki.anidb.net/w/UDP_API_Definition#MYLISTADD:_Add_file_to_MyList

I can't really seem to see a workaround for this case. It's rather odd. My guess would be that you could possibly assign a number greater than the listed number of episodes and possibly get a hit that way. In essence, if a series had 24 episode, but 3 specials. You could hit Special 1 by sending 25.

da3dsoul commented 5 years ago

Good plan. Only way to tell is to test it.

Vesnyx commented 5 years ago

So I tested it, because I remember Shoko being successfully being able to send these types of requests before.

MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}

For the {int4 episode number}, you can input the full ID. For example, if you wanted to add Special 1 (S1) would be how you do so.

MYLISTADD aid=5&generic=1&epno=S1

This works for Trailers (TX-TXX) (MYLISTADD aid=5&generic=1&epno=T20) or openings and endings (CX-CXX)(MYLISTADD aid=5&generic=1&epno=C1). So, I believe that instead of sending the episode number as an int we could send it as a string and achieve the proper results.

As an alternative to these approaches, perhaps using the manual link with the generic file id might be better.

For this show's OP2 you could use the FID as 1951420 via MYLISTADD fid={int4 fid}

However, I do not know if we can pull that information.

da3dsoul commented 5 years ago

We cannot unfortunately. Good to know that that works, though.

Vesnyx commented 5 years ago

Ok, I've submitted a pull request that should theoretically fix the issue.

I haven't compiled a version to test since I'm currently away from my build PC.