Skip to content
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

add External subtitles #4175

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/python/Screens/InfoBar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from Tools.Profile import profile
from enigma import eServiceReference
import os
from glob import glob
from os.path import splitext

# workaround for required config entry dependencies.
import Screens.MovieSelection
Expand Down Expand Up @@ -202,6 +203,17 @@ def __init__(self, session, service, slist=None, lastservice=None, infobar=None)
self.servicelist = slist
self.infobar = infobar
self.lastservice = lastservice or session.nav.getCurrentlyPlayingServiceOrGroup()

path = service and service.getPath() and splitext(service.getPath())[0] or ""
subs = []
if path:
for sub in ("srt", "ass", "ssa"):
subs = glob("%s*.%s" % (path, sub))
if subs:
break
if subs:
service.setSubUri(subs[0]) # Support currently only one external sub

session.nav.playService(service)
self.cur_service = service
self.returning = False
Expand Down
2 changes: 2 additions & 0 deletions lib/service/iservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ class eServiceReference
#ifndef SWIG
int data[8];
std::string path;
std::string suburi;
#endif
std::string getPath() const { return path; }
void setPath( const std::string &n ) { path=n; }
void setSubUri( const std::string &n ) { suburi=n; }

unsigned int getUnsignedData(unsigned int num) const
{
Expand Down