Frndly TV with Python on Windows without Docker: the easy way

One thing I just realized: this will fail to reload the M3Us on the server if this runs at startup before the Channels DVR server is started. That will depend on how Windows does it, if it starts services before the Startup folder.

I will need to add some logic to wait for the Channels DVR server to be running before sending the commands to refresh the M3U sources.
I have an idea what to do but that won't be until tomorrow night, maybe.

Thank you for your work on this!

Maybe check for dvr running ...

example

:loop
curl http://127.0.0.1:8089/dvr | findstr  /I /C:"running"
set running=%ERRORLEVEL%
if %running% EQU 0 do this
if %running% NEQ 0 timeout /t 60
if %running% NEQ 0 goto loop
2 Likes

This is a great solution that will work whether the server is running locally or remotely (with the right DVR URL). Thanks for the piece of code! :+1:

I will implement it as soon as I get the chance. :slightly_smiling_face:

Where would I put this code/script in the code @mjitkop presented above? I can combine the two and five it a whirl if I knew where to put it so as to be in the correct order. I'm thinking up front?

OTOH, I don't think that code is specific enough in that it probably needs path names etc. so I'll wait.

It should be at the end like this:

REM Wait 5 seconds
timeout /t 5

REM Check whether the Channels DVR is running
curl http://%DVR_IP%:%DVR_PORT%/dvr | findstr  /I /C:"running"
set running=%ERRORLEVEL%

if %running% EQU 0 (
    REM The server is already running. 

    REM Reload the Frndly TV M3Us on the server
    set "SOURCE_1=%FRNDLY_SOURCE_WITH_EPG: =%"
    set "SOURCE_2=%FRNDLY_SOURCE_NO_EPG: =%"

    curl -X POST "http://%DVR_IP%:%DVR_PORT%/providers/m3u/sources/%SOURCE_1%/refresh"
    curl -X POST "http://%DVR_IP%:%DVR_PORT%/providers/m3u/sources/%SOURCE_2%/refresh"
)

I just typed this here.
I'm not at my computer right now to try it out. There might be syntax errors in this post.

Note that I've chosen not to have a loop because if the server is not running, there is nothing that needs to be done. Whenever the server starts, it will automatically load all sources and the Python server for Frndly TV will be running already.

In theory, it should work. :crossed_fingers:

1 Like

I don't have time to test at the present as I have to go to work but will later.

I'll be out for the weekend but look forward to testing some code for startup on the frndlyTV and automatic loading of the data in the ChannelsDVR Server next week whenever it is ready to go.

I uploaded a new version of run_frndly_tv_on_startup.bat.

That should do it. :crossed_fingers:

It seems to me some changes are necessary?

It just happens that I had to restart my computer and noticed that this didn't start as expected.
I just found the reason why. At some point, I missed a piece of code when I did a copy-paste.

I am fixing it now. Sorry.

1 Like

Uploaded corrected version.

1 Like

I downloaded, moved and reconfigured the corrected version. I then shut down the ChannelsDVR Server and closed the command windows for the startup loading of FrndlyTV . I then reloaded Channels DVR Server and of course the FrndlyTV sources had no channels. After that, I went to the Startup Folder and ran the shortcut. It took a bit but I could see it load up everything. I'm no sure if it's an issue or not but I see this in the first few steps where it fails to log in then succeeds:

Requesting: https://frndlytv-api.revlet.net/service/api/v1/tvguide/channels?skip_tabs=0
401
Unauthorized access
logging in....
Logged in!

At some point I'll force a reboot of my PC and see if this works. I have a LOT load on startup, including drive pool so I may need to increase the pause time to ensure Channels DVR is loaded before the script runs.

Additionally I see a lot of these:

Skipping frndly-53 due to gracenote

I assume this is because there's no login for TVE for these channels but am not sure.

This is all normal. :slightly_smiling_face:

The Frndly script handles connection errors and has retries. What matters in the end is that you see "Logged in!"

There are 5 channels for which there is no Gracenote data available for EPG. That's what you see when it says "Skipping".

All good. :slightly_smiling_face:

1 Like

My PC crashed last night and upon reloading, ChannelsDVR loaded and the FrndlyTV channels and guide loaded on startup! THANK YOU!

 <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" /> 
  <EventID>41</EventID> 
  <Version>8</Version> 
  <Level>1</Level> 
  <Task>63</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x8000400000000002</Keywords> 
  <TimeCreated SystemTime="2024-06-22T03:17:49.7922236Z" /> 
  <EventRecordID>929684</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="4" ThreadID="8" /> 
  <Channel>System</Channel> 
  <Computer>Ryzen-Beast</Computer> 
  <Security UserID="S-1-5-18" /> 
  </System>
- <EventData>
  <Data Name="BugcheckCode">307</Data> 
  <Data Name="BugcheckParameter1">0x0</Data> 
  <Data Name="BugcheckParameter2">0x501</Data> 
  <Data Name="BugcheckParameter3">0x500</Data> 
  <Data Name="BugcheckParameter4">0xfffff807436fb320</Data> 
  <Data Name="SleepInProgress">0</Data> 
  <Data Name="PowerButtonTimestamp">0</Data> 
  <Data Name="BootAppStatus">0</Data> 
  <Data Name="Checkpoint">0</Data> 
  <Data Name="ConnectedStandbyInProgress">false</Data> 
  <Data Name="SystemSleepTransitionsToOn">0</Data> 
  <Data Name="CsEntryScenarioInstanceId">0</Data> 
  <Data Name="BugcheckInfoFromEFI">false</Data> 
  <Data Name="CheckpointStatus">0</Data> 
  <Data Name="CsEntryScenarioInstanceIdV2">0</Data> 
  <Data Name="LongPowerButtonPressDetected">false</Data> 
  </EventData>
  </Event>
1 Like

Great, I'm very glad it worked! :tada:

Thank you for sharing the good news.

Today is going to be a good day. :smiley:

haha, not easier than docker. if you can follow this guide you can setup docker.

1 Like

Fair statement. :wink:

As I pointed out in my original post:

For those people, this is the method for them. :slightly_smiling_face:

I don't want to set up docker. Emby can run in docker too but I haven't bothered.

I found setting up this script with the right credentials and paths and running it at start-up pretty straightforward and easy.