tgorgdotcom / locast2plex

A very simple script to connect locast to Plex's live tv/dvr feature.
MIT License
232 stars 43 forks source link

Unable To Start Windows Service #121

Open DanTheTechMan opened 3 years ago

DanTheTechMan commented 3 years ago

I can't seem to get the Windows service for Locast2Plex to run. I follow the guide to the letter. The only things I change are the path to Python and the Arguments for the service. Here's what my screen looks like:

image

The arguments I put for the service are as follows: D:\Plex\Plex Media Server\Scripts\locast2plex\main.py -u:xxxxxxxxxx@xxxxx.xxx -p:xxxxxxxxxx --debug --addy:127.0.0.1 --port:6077

Note that I've replaced the all characters for the username and password with "x".

Here's the error message I get:

image

Any help will be greatly appreciated.

chris00780 commented 3 years ago

I'm seeing the same thing on windows 10. Not sure what I'm doing wrong either

deathbybandaid commented 3 years ago

The arguments were moved into the config file a while back. Please look at the config example for more Information

DanTheTechMan commented 3 years ago

Does that mean I can no longer create a Windows service and avoid having to open a Command Line window after every reboot?

deathbybandaid commented 3 years ago

Not at all. Put those settings in the config file instead of cmdline args. Not sure about nssm, but I know running things via cmd, you may need quotes around the paths that have spaces (ie "Program Files")

DanTheTechMan commented 3 years ago

I have it running successfully via the command line. I'm using it as I type this. However, I'm trying to have a more automated solution. I would like to be able to, as the tutorial suggests, automatically load on reboot, just restart the service when updates are made to the py scripts, and not need to have a windows command line window open in order to use it. Is that still possible?

deathbybandaid commented 3 years ago

It should be. I haven't touched nssm in a very long time

deathbybandaid commented 3 years ago

Try setting the nssm startup directory to the l2p folder

tharris9d commented 3 years ago

It works great for me. Make sure you have the python 3 version, fill in the config.ini and just point to main.py in nssm.

DanTheTechMan commented 3 years ago

I have Python3 already, and I already I filled in the config.ini file. It runs fine via the command line, however I don't want to have to go through the process of starting it every time I reboot.

I am now getting a different error:

image

I looked at the System Event Viewer for details on this error, and the error is occurring because the system can't find one of the files or folders, however that's all it says. It doesn't tell me which file or folder can't be located.

Also, do I need to add all the additional arguments still, or do I just point to Python in the "Path" field, and the main.py script in the "Arguments" field, without any additional arguments (such as Username, Password, IP:Port)?

BTW, thanks for all the help so far! Greatly appreciated!

tharris9d commented 3 years ago

I just installed a new service successfully. Make sure you point to main.py without ANY arguments. All options are in the config. Use srvman.exe to make it easy to delete any unwanted services. If you dont have it check my wiki article. i have the website listed there. i need to update it to remove the command line args.

On Oct 28, 2020, 3:43 PM, at 3:43 PM, DanTheTechMan notifications@github.com wrote:

I have Python3 already, and I already I filled in the config.ini file. It runs fine via the command line, however I don't want to have to go through the process of starting it every time I reboot.

I am now getting a different error:

image

I looked at the System Event Viewer for details on this error, and the error is occurring because the system can't find one of the files or folders, however that's all it says. It doesn't tell me which file or folder can't be located.

Also, do I need to add all the additional arguments still, or do I just point to Python in the "Path" field, and the main.py script in the "Arguments" field, without any additional arguments (such as Username, Password, IP:Port)?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/tgorgdotcom/locast2plex/issues/121#issuecomment-718250604

DanTheTechMan commented 3 years ago

Ok. Thanks. This is what my NSSM window looks like:

image

Path: "C:\Program Files\Python38\python.exe" Startup Directory: D:\Plex\Plex Media Server\Scripts\locast2plex Arguments: "D:\Plex\Plex Media Server\Scripts\locast2plex\main.py" Service Name: Locast2Plex

Is that correct?

tharris9d commented 3 years ago

Yes! Make sure you don't already have a service named Locast2Plex

On Oct 28, 2020, 4:11 PM, at 4:11 PM, DanTheTechMan notifications@github.com wrote:

Ok. Thanks. This is what my NSSM window looks like:

image

Path: "C:\Program Files\Python38\python.exe" Startup Directory: D:\Plex\Plex Media Server\Scripts\locast2plex Arguments: "D:\Plex\Plex Media Server\Scripts\locast2plex\main.py" Service Name: Locast2Plex

Is that correct?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/tgorgdotcom/locast2plex/issues/121#issuecomment-718260011

DanTheTechMan commented 3 years ago

Thanks, however, it doesn't work for me. I get this error again:

image

The specific message from the Event Viewer is: The Locast2Plex service terminated with service-specific error The system cannot find the path specified..

Any ideas as to what the issue could be?

DanTheTechMan commented 3 years ago

Does anyone have any other ideas on how to remedy this issue?

chris00780 commented 3 years ago

Does anyone have any other ideas on how to remedy this issue?

Upgrading Python did it for me. Point nssm to the new python and the arguments with no quotes to main.py.

Make sure you have the config.ini filled out with your username and password. Mine is working perfectly

DanTheTechMan commented 3 years ago

Unfortunately, upgrading Python isn't an option for me at the moment, as I'm on the most recent version of Python that supports my OS. The next upgrade of Python compatible with my OS won't be released until Mid-November, so, unless anyone has any other ideas that don't require me waiting for something, it looks like I'm SOL for the moment. Also, as I've said multiple times, I already have it working via the command line (which means the config.ini file is already filled out), however, what I'm ultimately looking for is a completely automated solution (for the script to load automatically with my OS (and Plex), without any intervention from me), which, if I can get this set up correctly and working, will be exactly what I am looking for. The only time I should have to intervene is when the script(s) get updated, and even then, it should be as simple as 1-2-3 (stopping the service, overwriting the files, and starting the service back up). Also, removing the quotes returns me to the original error.

deathbybandaid commented 3 years ago

I'd say, you need to research on google how to use nssm for a python script.

tharris9d commented 3 years ago

@DanTheTechMan Please put your command line in a batch/cmd file and run it to make sure it works.

Here is mine. Please test it on your system and confirm it's running. In a locast2plex.cmd file place your path to python and main.py echo off cls "C:\Users\Valued Customer\AppData\Local\Programs\Python\Python38-32\python.exe" C:\code\locast2plex\main.py rem pause

nssm.exe In nssm.exe put in your path to Python in arguments put C:\code\locast2plex\main.py (or whatever your path is to main.py)

tharris9d commented 3 years ago

Here is what my successfull NSSM ui looks like. image

DanTheTechMan commented 3 years ago

I tried it exactly as you said and I still get an error. I have no idea why it's not working.

tharris9d commented 3 years ago

So you can run it from the cmd file successfully?

DanTheTechMan commented 3 years ago

Yes.

tharris9d commented 3 years ago

Try moving your code out of the plex scripts folder to c:\code\locast2Plex. Just to see....

tharris9d commented 3 years ago

Check services to make sure your non working services are deleted.

DanTheTechMan commented 3 years ago

Ok. I'll try that. I delete the service after every failed test, before I create it again, so there should be nothing to delete.

DanTheTechMan commented 3 years ago

Well, I finally have a working solution. Here are the steps I took to get fully operational: Just as a test, as @tharris9d recommended, I copied the "locast2plex" folder to the "C" drive, then edited the arguments of the "Locast2Plex" service with NSSM (as I apparently forgot to delete it after my last failed test) to point to the new temporary location of the "locast2plex" folder. That worked, however, I did not want to run it from that location permanently, so I created a Directory Junction to point to the original location of the "locast2plex" folder (on the "D" drive), to see if I could fool the service to thinking it was still being run from the "C" drive. That worked like a charm. I am now fully up and running, exactly as I wanted to be. Thank you to everyone for all your help and advice, and a BIG thanks to @tharris9d for your diligence and for helping me get to this point.

tharris9d commented 3 years ago

Awesome! I am so happy you got it working.

On Oct 30, 2020, 3:23 PM, at 3:23 PM, DanTheTechMan notifications@github.com wrote:

Well, I finally came to a working solution. Here are the steps I took to get fully operational: As a test, as @tharris9d recommended, I copied the "locast2plex" folder to the "C" drive, then edited the arguments of the "Locast2Plex" service with NSSM (as I apparently forgot to delete it after my last failed test) to point to the new temporary location of the "locast2plex" folder. That worked, however, I did not want to run it from that location permanently, so I created a Directory Junction to point to the original location of the "locast2plex" folder (on the "D" drive), to see if I could fool the service to thinking it was still being run from the "C" drive. That worked like a charm. I am now fully up and running, exactly as I wanted to be. Thank you to everyone for all your help and advice, and a BIG thanks to @tharris9d for your diligence and for helping me get to this point.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/tgorgdotcom/locast2plex/issues/121#issuecomment-719827504

kogren161 commented 3 years ago

I got the service up and running, but both emby and plex give me errors trying to find the HDhomerun device.

This is my config.ini [main] locast_username = xxxxxx@xxxxx.com locast_password = plex_accessible_ip = 127.0.0.1:6077 c = \locast2plex\main.py uuid = mlliqmoq

The last line was tacked on by some other process.

I have tried it with and without the port info (not sure if the context is correct)

tgorgdotcom commented 3 years ago

Hello @kogren161.

Noticed a few items with the ini file:

Try seeing if making the changes to the ini resolves your issue.

kogren161 commented 3 years ago

Thank you for the suggestions, I was able to get this running in windows terminal, as well as successfully setting up the service and starting it. I was able to find the tuner in Plex as well as Emby. I was able to download the guide in Plex successfully but when I try to tune to a channel I get this error

"Playback Error Could not tune channel. Please check your tuner or antenna."

I have not setup a premium account in Plex, and don't appear to be able to go any further in Emby without a premium account.

I went ahead and signed up for the premium account with Plex. I can now setup a recording, but when I try to tune to a channel I still get the same error. :(

kogren161 commented 3 years ago

I thought perhaps that I needed to "install" ffmpeg, so I went through the instructions on youtube to do that and rebooted. Unfortunately now Plex can't see the tuner. I get the error there was a problem adding the device: 127.0.0.1:6077

kogren161 commented 3 years ago

I shut down the service, and restarted via command line. Plex found the tuner, and now will tune to the channels. It seems that Locast2Plex needed to update the FCC facilities database.

kogren161 commented 3 years ago

Although the service appears to be running, Locast2Plex only seems to be working from the command line.

kogren161 commented 3 years ago

I found that I have the path to the Python shortcut rather than the path to the file. It included a space.

kogren161 commented 3 years ago

No dice :( still only runs from the command line.

Seem to have gotten it. I seem to have misinterpreted where the main.py command needed to reside. Once I put it in the arguments it works. I have Python and Locast2plex in C:\

tharris9d commented 3 years ago

Awesome. Whenever you update the code to a newer version simply restart the service! Have fun.