xteve-project / xTeVe

M3U Proxy for Plex DVR and Emby Live TV
MIT License
1.72k stars 227 forks source link

Time offset #205

Open iSmack1 opened 3 years ago

iSmack1 commented 3 years ago

I have been using Xteve and have successfully added m3u and xmltv data. Everything works great but I would like to alter the time for some channels. Ie Channels like discovery.us have an east coast and west coast feed but only one set of data is provided in the guide xml. The one in my time zone is correct but the one in the other is not so I would like to change the time offset for this one. I have noticed that when Xteve sets up a dummy guide it executes Create Dummy Guide: Time offset -0500 - US: Dicovery (west) | HD. I have figured out how to connect to connect to Xteve though API is there any way to send it a cmd to set this time offset to -0800? Any help would be appreciated. Thanks!

mar-mei commented 3 years ago

No, there is no way to set a time offset. The times are taken unchanged from the source and the time and time zone from the computer are used for the Dummy. If you are missing data you can take a look at zap2it (US only) or Schedules Direct.

niallobr commented 3 years ago

I commented in #17 but it might be missed since that issue is closed so just commenting here too for greater visibility.

I just need to shift a couple of channels and tvg-shift in the M3U seems to be the recommended way of doing this in the documentation of most clients and providers. For example both Emby and my EPG source support tvg-shift but Xteve tries to handle this via the EPG xml.

Example: #EXTINF:-1 tvg-chno="1" tvg-id="Syfyplus1.uk" tvg-name="Syfy" tvg-logo="xxxx.jpg" group-title="Example" tvg-shift="-1",Syfy http://example.ts

MCTyler commented 3 years ago

As explained....It uses the time from your machine...Use the offset in your Media Player (If it has one)

iammeuru commented 3 years ago

My client doesn't support time offset... I'm using Plex. I need to offset the EPG data in the XML file upstream, and I'm trying to find the tools necessary to do that. I figured xteve would be the optimal place to do that in an automated fashion since it's passing that EPG data to Plex. If xteve doesn't do that, and there's not an intent to handle that (I presume many people are in this boat), since my IPTV provider handing me the EPG XML data doesn't have a way to set timezone (I'm trying to figure out if third part EPG providers like iptv-epg; maybe they provide a better way?) the only way I can think to overcome this is to build a custom script to go in and edit the utc codes in the XML file plex is reading from xteve based on channel offsets I could keep in another xml file... it's a hack, and a lot of work if there's already a way people are handling this... anyone have information I'm just ignorant of? or, can we get xteve to just handle this for us as part of its own development?

MCTyler commented 3 years ago

Time is set by the Machine that xTeVe is on. Any manipulation can be done that way.

iammeuru commented 3 years ago

Timezone manipulation on the machine I'm on is a non-starter for a number of reasons, again I expect this is an issue for many people. I'm running xteve and my plex server on my unraid machine, which is running other things needing correct time (could run xteve in a VM and bulk offset that way, but not going to do that); also I'm not entirely sure every channel's epg time shift would be the same. When browsing the channels from my provider I feel like one or two were an extra hour or more off relative to the mass of them, so per channel control would likely be necessary, and pushing to plex, again the time codes in epg xml it receives would be the only place to inject any shift, which basically leaves me with only a few options 1.) Write a script to modify the epg xml utc codes themselves 2.) Move away from plex to a dedicated IPTV client with per channel offset support (making xteve completely irrelevant to the solution) 3.) Obtain content through a non-iptv provider.

Option 1 is a fair bit of work for me, though not impossible, so I just haven't pursued it. Option 2 is a big fat maybe for me, but doesn't provide me the option of mixing the experience in with the rest of my media consumption handled through plex, and would require me to buy new hardware at each TV in my home. Option 3 is likely the best route for me... I only care about consuming a small portion of racing content which is harder to automate adding to my library through sonarr/sickbeard/ragetv etc, though it is available in other ways, and while it would be nice to have a live tv feel for the whole family it seems like it simply isn't reasonably possible to integrate into my current set of systems without a bit of work and/or money... If xteve or anyone else ever creates a method for modifying the epg data in the way I discussed I'll happily jump back to attempting to get IPTV integrated with my plex setup, but until then I think it might just be an experiment requiring too much of my time and/or money to warrant pursuit.

MCTyler commented 3 years ago

You could also fork xTeVe and re-code it some way to make EPG Offset possible. I can't see this being done by us for such a small audience.

winguru commented 3 years ago

@iammeuru, I made a branch of xTeVe that supports basic channel time offset / timeshifting. I'm not 100% sure the best term to use, because timeshifting has traditionally meant any DVR which could record and play back at a different (non-live) time, whether buffered or stored on disk. Regardless, I use the term "timeshift" to support the Tvg-shift attribute in the M3U files. I then recalculate the EPG program start and stop times based upon the timeshift offset.

@niallobr, my initial idea and attempt was to pass through the tvg-shift attribute via the xTeVe generated M3U file. This worked great with Emby, but the Homerunner emulation which is used by Plex does not support per channel time shifting. So I re-worked my code and just modified the generated xTeVe EPG XML file so that all programs for a channel in question are modified by the appropriate offset.

Currently, there isn't much error correcting in my code yet, as it assumes you are entering numbers and not random characters. However, it seems to work for me and my testing when I use a single EPG source for both East Coast (GMT -4) and West Coast (GMT -7) programs.

I wrote this modification because it's useful to me and may be useful to others, but I'm not a native Go/GoLang programmer, so my code is very basic. Please feel free to look over my changes and/or test my code. The only other significant change is that I wanted to preserve the channel number from the M3U file instead of using a base channel that is incremented for each new channel. I would like to make that a per-filter option, but for right now, I just made it a global change to test out for my purposes.

Hope that helps...

briansturrock commented 2 years ago

I know this is an old thread, but I faced this problem, so i thought I'd share my solution, and it's sort of [iammeuru}'s solution, but that doesn't work. Plex ignores the offset in the EPG XML file and works solely on the timezone set while adding the tuner. So I wrote a PS script that works channel by channel (for channels that need to change), with an offset, then changes the timestamp for start and finish in the xmltv file based on the offset for that channel.

briansturrock commented 2 years ago

takes a bit of manual configuration, but if the EPG says a show starts at 16:00, but it actually starts at 14:00, the script allows to amend the EPG, for that channel, to show srtatime as -2, or 14:00. Or +. Also tells xTeve to update once the work is done, so has to be run between the default EPG update in xTeve and the Plex import of the EPG.

simondmorias commented 2 years ago

@briansturrock - are you able to share the script?

briansturrock commented 2 years ago

@simondmorias sure - let me clean it up and document it and i'll dm it to you (if i can figure out how!)

red-centre commented 2 years ago

great work @briansturrock - I'd love to see the code too, if possible?

briansturrock commented 2 years ago

My xTeve runs on Windows Server Core, so I just have a task that runs this. I've updated it as well, so it also tells Plex to download the lastest available guide. so long as it runs after xTeve does its daily update it works fine. epg_timezone_fix.txt .

simondmorias commented 2 years ago

Excellent. Many thanks for this.


From: briansturrock @.> Sent: Wednesday, June 29, 2022 3:46:35 PM To: xteve-project/xTeVe @.> Cc: Simon D'Morias @.>; Mention @.> Subject: Re: [xteve-project/xTeVe] Time offset (#205)

My xTeve runs on Windows Server Core, so I just have a task that runs this. I've updated it as well, so it also tells Plex to download the lastest available guide. so long as it runs after xTeve does its daily update it works fine. epg_timezone_fix.txthttps://github.com/xteve-project/xTeVe/files/9011594/epg_timezone_fix.txt .

— Reply to this email directly, view it on GitHubhttps://github.com/xteve-project/xTeVe/issues/205#issuecomment-1170076418, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADBMOSDNHJDB6GCUBQTZKGTVRROUXANCNFSM4VWPAPMA. You are receiving this because you were mentioned.Message ID: @.***>

briansturrock commented 2 years ago

It's important to figure out the offset from the Plex epg, as Plex tries to fix them based on the source xmltv, it's just that it for whatever reason (probably source data) it fails. So it's not a simple matter of that channel is that timezone and I'm in this timezone, so it's a -5 offset, for example. It won't be. it might actually only be only -2 once Plex has tried, so you'll need to figure it out for each channel by watching the channel and seeing what's on and figuring out the offset you need. Sometimes you see things like, "News at 6," so from the ACTUAL TZ offset (what 6 is in that TZ versus your own), you can figure out what offset you need to use for that channel - so that makes it easier. You just need to shift it by x hours.

red-centre commented 1 year ago

Thanks mate, really appreciate you sharing. My Plex server is running in a Docker container on a Linux server, and I definitely don’t have the skills to do the translation!


From: briansturrock @.> Sent: Thursday, June 30, 2022 1:52:43 AM To: xteve-project/xTeVe @.> Cc: red-centre @.>; Comment @.> Subject: Re: [xteve-project/xTeVe] Time offset (#205)

It's important to figure out the offset from the Plex epg, as Plex tries to fix them based on the source xmltv, it's just that it for whatever reason (probably source data) it fails. So it's not a simple matter of that channel is that timezone and I'm in this timezone, so it's a -5 offset, for example. It won't be. it might actually only be only -2 once Plex has tried, so you'll need to figure it out for each channel by watching the channel and seeing what's on and figuring out the offset you need. Sometimes you see things like, "News at 6," so from the ACTUAL TZ offset (what 6 is in that TZ versus your own), you can figure out what offset you need to use for that channel - so that makes it easier. You just need to shift it by x hours.

— Reply to this email directly, view it on GitHubhttps://github.com/xteve-project/xTeVe/issues/205#issuecomment-1170159968, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AV4QXBFIZWYMSMETBX4RI2DVRRWMXANCNFSM4VWPAPMA. You are receiving this because you commented.Message ID: @.***>

Sergio-GitHub75 commented 1 month ago

@briansturrock thank you for the file, i am trying to adapt this to my needs but i receive this error "Invoke-WebRequest : Locked [423]" when executing the following line: Invoke-WebRequest -Uri $uri -Method POST -Body ($body|ConvertTo-Json) -ContentType "application/json" -UseBasicParsing

I have also a doubt, should i change something in this line? i don't have that file $body = @{"cmd"="update.xmltv"}

This is the complete error:

Invoke-WebRequest : Locked [423]
+ Invoke-WebRequest -Uri $uri -Method POST -Body ($body|ConvertTo-Json) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Any thoughts will be apreciated, thanks