1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 11:16:58 -05:00

Strip Multiprocessing and Re-add Windows Support

This commit is contained in:
deathbybadaid 2021-01-05 11:28:40 -05:00
parent 5c66f2594e
commit 3f314f3863
6 changed files with 8 additions and 44 deletions

View File

@ -15,6 +15,3 @@ Please Check the [Docs](docs/README.md) for Installation information.
fHDHR is labeled as beta until we reach v1.0.0
Join us in `#fHDHR <irc://irc.freenode.net/#fHDHR>`_ on Freenode.
Due to multiple issues, I'm dropping official support for Windows.

View File

@ -10,11 +10,6 @@
"config_file": true,
"config_web": true
},
"thread_method":{
"value": "multiprocessing",
"config_file": true,
"config_web": true
},
"servicename":{
"value": "fHDHR",
"config_file": false,

View File

@ -2,9 +2,7 @@ import os
import sys
import argparse
import time
import multiprocessing
import threading
import platform
from fHDHR import fHDHR_VERSION, fHDHR_OBJ
import fHDHR.exceptions
@ -19,10 +17,6 @@ if sys.version_info.major == 2 or sys.version_info < (3, 7):
print('Error: fHDHR requires python 3.7+.')
sys.exit(1)
opersystem = platform.system()
if opersystem in ["Windows"]:
print("WARNING: This script may fail on Windows. Try Setting the `thread_method` to `threading`")
def build_args_parser():
"""Build argument parser for fHDHR"""
@ -45,30 +39,18 @@ def run(settings, logger, db, script_dir, fHDHR_web, origin, alternative_epg):
try:
fhdhr.logger.info("HTTP Server Starting")
if settings.dict["main"]["thread_method"] in ["multiprocessing"]:
fhdhr_web = multiprocessing.Process(target=fhdhrweb.run)
elif settings.dict["main"]["thread_method"] in ["threading"]:
fhdhr_web = threading.Thread(target=fhdhrweb.run)
if settings.dict["main"]["thread_method"] in ["multiprocessing", "threading"]:
fhdhr_web.start()
fhdhr_web = threading.Thread(target=fhdhrweb.run)
fhdhr_web.start()
if settings.dict["fhdhr"]["discovery_address"]:
fhdhr.logger.info("SSDP Server Starting")
if settings.dict["main"]["thread_method"] in ["multiprocessing"]:
fhdhr_ssdp = multiprocessing.Process(target=fhdhr.device.ssdp.run)
elif settings.dict["main"]["thread_method"] in ["threading"]:
fhdhr_ssdp = threading.Thread(target=fhdhr.device.ssdp.run)
if settings.dict["main"]["thread_method"] in ["multiprocessing", "threading"]:
fhdhr_ssdp.start()
fhdhr_ssdp = threading.Thread(target=fhdhr.device.ssdp.run)
fhdhr_ssdp.start()
if settings.dict["epg"]["method"]:
fhdhr.logger.info("EPG Update Thread Starting")
if settings.dict["main"]["thread_method"] in ["multiprocessing"]:
fhdhr_epg = multiprocessing.Process(target=fhdhr.device.epg.run)
elif settings.dict["main"]["thread_method"] in ["threading"]:
fhdhr_epg = threading.Thread(target=fhdhr.device.epg.run)
if settings.dict["main"]["thread_method"] in ["multiprocessing", "threading"]:
fhdhr_epg.start()
fhdhr_epg = threading.Thread(target=fhdhr.device.epg.run)
fhdhr_epg.start()
# Perform some actions now that HTTP Server is running
fhdhr.logger.info("Waiting 3 seconds to send startup tasks trigger.")

View File

@ -259,9 +259,6 @@ class Config():
def config_verification(self):
if self.dict["main"]["thread_method"] not in ["threading", "multiprocessing"]:
raise fHDHR.exceptions.ConfigurationError("Invalid Threading Method. Exiting...")
if self.dict["main"]["required"]:
required_missing = []
if isinstance(self.dict["main"]["required"], str):

View File

@ -1,4 +1,3 @@
import multiprocessing
import threading
import datetime
@ -35,12 +34,8 @@ class Tuner():
self.status["status"] = "Scanning"
self.fhdhr.logger.info("Tuner #%s Performing Channel Scan." % str(self.number))
if self.fhdhr.config.dict["main"]["thread_method"] in ["multiprocessing"]:
chanscan = multiprocessing.Process(target=self.runscan)
elif self.fhdhr.config.dict["main"]["thread_method"] in ["threading"]:
chanscan = threading.Thread(target=self.runscan)
if self.fhdhr.config.dict["main"]["thread_method"] in ["multiprocessing", "threading"]:
chanscan.start()
chanscan = threading.Thread(target=self.runscan)
chanscan.start()
def runscan(self):
self.fhdhr.api.client.get(self.chanscan_url)

View File

@ -6,7 +6,6 @@ monkey.patch_all()
import os
import sys
import pathlib
from multiprocessing import freeze_support
from fHDHR.cli import run
import fHDHR_web
@ -16,5 +15,4 @@ import origin
SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
if __name__ == '__main__':
freeze_support()
sys.exit(run.main(SCRIPT_DIR, fHDHR_web, origin, alternative_epg))