Comments (14)
Might take some time here, and not easy ;-)
from srt2utf-8.bundle.
Hi, it's kinda possible with this code:
- you can get a list of subtitle files and languages which are associated with given part directly from plex sqlite db
- problem is that you will get a list of results only on second agent run on the same part (because the results are written to the db after all agents finish running)
- maybe you could dispatch this select on another thread with some timeout...
- feel free to use it if you find it useful
plugins_dir = os.path.dirname(os.path.dirname(os.getcwd()))
media_dir = os.path.join(os.path.dirname(plugins_dir), 'Media', 'localhost')
db_file = os.path.join(plugins_dir, 'Databases', 'com.plexapp.plugins.library.db')
conn = sqlite3.connect(db_file)
c = conn.cursor()
for row in c.execute("""
SELECT url, language
from media_streams, media_parts
where media_parts.file =?
and media_parts.id = media_streams.media_part_id
and media_streams.codec in ('srt', 'sub')""", [part.file]):
subtitle_file = os.path.join(media_dir, row[0].replace('media://', ''))
subtitle_lang = row[1] # values are country codes 'eng', 'cze' ...
Log.Debug(subtitle_file)
Log.Debug(subtitle_lang)
c.close()
from srt2utf-8.bundle.
Sadly....Your code is perfect, but direct access to the SQL database is not avail on all platforms, since most NAS devices can't do an include of sqlite, sue to a missing file.
And I have to provide this to all platforms ;-)
But when said....code is all most there, since I made it for another project
https://github.com/dagalufh/WebTools.bundle
already, so now "only" need to hook it in.
from srt2utf-8.bundle.
Oh yeah, you are right about sqlite, well the other solution to it is to dig that info through WEB API:
I guess this should work:
- create Timer through Thread.CreateTimer()
inside that timer function:
- localhost:32400/library/sections -> find out which section contains part's filename
- localhost:32400/library/sections/[:id]/all -> find media which has file same as part.file and use 'key' attribute which has metadata id
- localhost:32400/library/metadata/[:id]/tree -> and you have list of subtitles inside streams sections
from srt2utf-8.bundle.
Not possible either ;-)
This is an agent, running when a media is added, and due to that, it's not yet possible to access the web api for it ;-)
from srt2utf-8.bundle.
That's why i have mentioned Thread.CreateTimer(), the code would be executed in a seperate thread later, so it would work
from srt2utf-8.bundle.
Not needed...I get it handed down to me by the primary agent ;-)
You can follow my progress in the tommy-work branch, and are more than welcome to fork and add a pull request
from srt2utf-8.bundle.
And please take a peak here:
https://forums.plex.tv/index.php/topic/94864-rel-str2utf-8/?p=766258
from srt2utf-8.bundle.
Hi, I have done it, it works for Movies/Tv Shows and every subtitles agent, this agent should be the last in chain, but it is not mandatory:
https://github.com/pristas-peter/SRT2UTF-8.bundle/blob/master/Contents/Code/__init__.py
from srt2utf-8.bundle.
But....Did you see my req. for beta testers?
I also did it, but without spawning a thread, which IMHO would be better.
from srt2utf-8.bundle.
Yes, but it is only compatible with movies and opensubtitles, this is universal solution
from srt2utf-8.bundle.
True, but to be frank, I don't wanna use the http api due to speed, nor the threading metode, and I also want to be able to enable/disable the look for individual agents, as I've done so far in the beta.
If people test this, then it's easy to add support for others as well, like Podnapsi.
And regarding TV-Shows, then the code is already there, just remarked, since I wanted beta testers to test slowly.
from srt2utf-8.bundle.
Ok bro, whatever you want, it's your project... For me it works and I just wanted to share with the community...
from srt2utf-8.bundle.
Fixed in V0.0.2.0
from srt2utf-8.bundle.
Related Issues (20)
- not working on CentOS7 HOT 4
- KeyError: 'xx' HOT 9
- Forced Subtitle is not Supported HOT 6
- Agent doesn't work on TV Shows HOT 4
- Str2Utf-8 Plugin does not appear on the TV Shows agent HOT 6
- V0.0.2.4 broken
- could it used on music agencies In the future? HOT 3
- Support for Plex Movie
- Log settings during startup
- Serbian subtitle means they can be mostly Latin and some in Cyrillic HOT 9
- Plug-in is generating new subtitle file by randomly, it is skipping most of it. HOT 9
- SRT2UTF-8.bundle not working with tv shows HOT 3
- I don't see this plugin in Plex agents HOT 12
- How are user-uploaded subtitles handled? HOT 1
- Not working with Early access HOT 3
- Wiki - "plug-in directory" link is broken HOT 3
- permission problem HOT 2
- TV shows (Series) HOT 1
- Plex don't see the plugin. HOT 1
- add plugin to plex on synology nas HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from srt2utf-8.bundle.