-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed: Properly handle stacked files for subtitles #4274
Conversation
@jmarshallnz : Please comment/review. jenkins build this please |
what would the API change be? as it is subtitle services can(if they support it) return more than one subtitle file, is that not enough? see here how we can get more than one subtitle -> https://github.com/amet/service.subtitles.opensubtitles/blob/Gotham/service.subtitles.opensubtitles/service.py#L61 we need to send stack=True to it and it should try to get all. note that I have zero stacked files and in all these years have successfully stayed away from it, so I could be a wrong person to comment :) |
} | ||
|
||
// Make sure (stack) size is the same is the size of the items handed to us (this includes non-stack items!) | ||
if (vecFiles.size() != (unsigned int) items->Size()) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@amet, I vaguely recall looking at that code before and at least back then there was some stuff missing to make it work properly (I think the zip unpacker + correctly naming/ordering the individual files was the problem). We also need the possibility to fallback to single items, meaning the user should have the option to download a stacked (multi-file) sub but also the ability to select single subs (like how it is now) as the service may not offer a correct one for one or the other. |
{ | ||
CStdString subPath = CSpecialProtocol::TranslatePath("special://subtitles"); | ||
if (!subPath.empty()) | ||
strDownloadPath = subPath; | ||
|
||
strFileName = URIUtils::GetFileName(strCurrentFile); | ||
// Handle stacks: Make sure (stack) size is the same as the size of the items handed to us | ||
if (g_application.CurrentFileItem().IsStack() && items->Size() > 1 && items->Size() == (int) vecFiles.size()) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@arnova we will be limited to whatever the service provider gives us. If you find me on IRC(or e-mail me) we can discuss whats needed and see if we have that in any of the services that offer API(opensubtitles, podnapisi) as all others are just scraping the websites and chances are that there will be nothing there. |
@jmarshallnz : Updated |
@jmarshallnz : Any (additional) ideas about this? I think we (also) need some way to flag stacked subs (= zip archive with multiple subtitles) in the subtitle dialog. |
@arnova stack=true helps, thats a good idea as it saves checking for it in script all the time |
ok from my perspective. jenkins build this please |
@t-nelson / @jmarshallnz : So this can be merged before we branch? |
@@ -325,6 +328,10 @@ void CGUIDialogSubtitles::Search(const std::string &search/*=""*/) | |||
if (setting) | |||
url.SetOption("languages", setting->ToString()); | |||
|
|||
// Check for stacking | |||
if (g_application.CurrentFileItem().IsStack()) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
fixed: Properly handle stacked files for subtitles
@@ -72,6 +73,8 @@ class CSubtitlesJob: public CJob | |||
virtual bool DoWork() | |||
{ | |||
CDirectory::GetDirectory(m_url.Get(), *m_items); | |||
// Sort items by path so they properly order for eg. stacks | |||
m_items->Sort(SortByPath, SortOrderAscending); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Is this patch going to allow multiple subtitles even if they are not stacked files? Because there are subtitle services (like itasa that i develope) that sometimes have more than one version in a single zip file and right now i can pass every subtitle but only the first one is considered and there's no way to pass also the 2nd one.. |
We make sure service sorts it if it's stacked , or let service dictate who should sort. Let service return sorted=true or some such. Also, we can pass more than one subtitle back to xbmc to handle if movie is stack if it's not stack we only use first one. |
This is a followup for #4196 & #3819. Note that #4196 multi-sub implementation is pretty flawed and this should fix that.
Note that I'm not sure our current subtitle API is flexible/capable enough to properly handle future-support for stacked/multiple subtitles. For what we have, this seems to be the best approach, but of course any suggestions/discussions are welcome. And since we're still pre-Gotham-beta, this would be the time if we want to change our API after all.