Jump to content

Process links before playback with plugins


olympus1
 Share

Recommended Posts

olympus1

Hi, I am a very happy Emby user, thank you for everything Emby developers.

I am a former Kodi user and my switch to Emby has been awesome.

How I setup up my Emby server. I have local content and cloud content in strm files (they are like this: http://127.0.0.1:8080/movie.mkv , they point to my rclone http server of my google drive).

Everything works perfectly, and the usage of strm files solve all problems with 24h bans someone could have when he mounts a rclone gdrive mount and use it as a media source in Emby.

I am not trying to solve an issue I have, everything works perfectly in my setup.

But I have been thinking on something and I would like to ask if it's something that could be added in future in Emby.

Kodi can use add-ons and resolve a link in a strm file and with python to get the direct actual video stream and send that to Kodi's player.

Is it possible something like that be added in Emby, it would be useful for many people.

For example have a look at this thread,

If something like that could be added someone could write a simple script to resolve a strm with the following link

https://polonia.tvp.pl/sess/TVPlayer2/embed.php?ID=34414171,

to

https://rsdt-krk201-5.tvp.pl/token/video/live/34414171/20211205/1268250694/e762729e-0bda-4755-956d-af655a3c6935/master.m3u8

and send the actual video stream to Emby's player.

I would personally try to write a script to resolve a google drive link to the actual video stream and send it to Emby's player without having to setup a http server with rclone that runs 24/7. The same way the Google drive Kodi addon does.

Also what is Emby cloud sync? As far as I understand this is for making backup that can direct play in your cloud storage.

Can this plugin somehow be extended to be used in strm links? Add a link in my strm file that points to a file in the Google drive I have setup up with this plugin?

That would very interesting:)

Any reply is more than welcome.

Thank you again Emby devs for everything.

Edited by olympus1
Link to comment
Share on other sites

olympus1
15 minutes ago, Luke said:

Hi, how do you resolve a link?

Thank you Luke for your reply.

Kodi uses Python for that.

In the example of https://polonia.tvp.pl/sess/TVPlayer2/embed.php?ID=34414171

you read the html of the page, the m3u8 link (with the correct token on it) is there and you can get it with a regex.

It uses a special protocol for example plugin:// to know what to do with the link. If the plugin protocol is there it knows what to do.

Emby could use Javascript, it is powerful enough for this, aren't Emby plugins, for example ScripterX, writen in javascript? 

Edited by olympus1
Link to comment
Share on other sites

I don't know that this is something we'd put in the emby core as it could violate terms of service of many websites.

But you could do this on your own. Create a web server to process a url and issue a redirect to the correct location. So for example in your strm file:

http://localhost:8888?url=https://polonia.tvp.pl/sess/TVPlayer2/embed.php?ID=34414171

which could then issue a redirect to

https://rsdt-krk201-5.tvp.pl/token/video/live/34414171/20211205/1268250694/e762729e-0bda-4755-956d-af655a3c6935/master.m3u8

 

Link to comment
Share on other sites

olympus1
18 minutes ago, Luke said:

I don't know that this is something we'd put in the emby core as it could violate terms of service of many websites.

But you could do this on your own. Create a web server to process a url and issue a redirect to the correct location. So for example in your strm file:

http://localhost:8888?url=https://polonia.tvp.pl/sess/TVPlayer2/embed.php?ID=34414171

which could then issue a redirect to

https://rsdt-krk201-5.tvp.pl/token/video/live/34414171/20211205/1268250694/e762729e-0bda-4755-956d-af655a3c6935/master.m3u8

 

Yes, this shouldn't be on the core. This is a job for 3rd party plugins.

I am already doing that, I have an http server at 127.0.0.1:8080 created with rclone's amazing serve command for my google drive links.

The difference is that servers have to run 24/7, the way Kodi supports this, the links are resolved only when needed and no servers are required.

It's on demand resolving.

Can an Emby plugin run before playback starts, do it's thing to get a link with javascript and change the url Emby player will play?

This is more than enough for someone, for a 3rd party, to create a plugin like the google drive kodi addon, or an m3u8 extractor plugin.

 

Edited by olympus1
Link to comment
Share on other sites

olympus1

Another idea for cloud in general.

rclone has an amazing command the cat command.

https://rclone.org/commands/rclone_cat/

It concatenates any file from cloud and can send the actual stream to stdout.

It also has the serve command

https://rclone.org/commands/rclone_serve_http/

Another idea for on demand resolving, integrate rclone and call rclone cat before playback and get the video from stdout and when playback finishes close rclone.

These commands are very different than the mount command most people use, you don't mount anything or have to install anything else like winfsp in windows to make it to work,

I don't see any issue on that, Infuse has something like that as a Pro feature, and can "survive" in Apple's stores:)

https://firecore.com/infuse

It does a kind of resolving for that..

Browse and play videos stored on a Mac, PC, NAS, media servers like Plex, Emby, Jellyfin, or cloud service like Dropbox, Google Drive, OneDrive, Box, MEGA, and others. Plus, videos from multiple sources can all be displayed neatly together in one central library.

Edited by olympus1
Link to comment
Share on other sites

Quote

Can an Emby plugin run before playback starts, do it's thing to get a link with javascript and change the url Emby player will play?

You could do it now using what i said for the strm file, but build a plugin in emby server to receive the http request and then issue a redirect.

A more direct technique to skip the http request is also possible, where you can hook into something and override the path, but would require development from us first.

  • Like 1
Link to comment
Share on other sites

olympus1
2 hours ago, Luke said:

You could do it now using what i said for the strm file, but build a plugin in emby server to receive the http request and then issue a redirect.

A more direct technique to skip the http request is also possible, where you can hook into something and override the path, but would require development from us first.

Thank you for your reply, please consider the development of the more direct technique since Emby has support for strm files.

It could open a new era of Emby plugins for cloud integration without having to mount anything to our systems (the same way Kodi can integrate cloud streams).

Also new plugins for adding internet streams to Emby's Live TV could start to be developed.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...