mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 10:16:58 -05:00
Strip Multiprocessing and Re-add Windows Support
This commit is contained in:
parent
5c66f2594e
commit
3f314f3863
@ -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
|
fHDHR is labeled as beta until we reach v1.0.0
|
||||||
|
|
||||||
Join us in `#fHDHR <irc://irc.freenode.net/#fHDHR>`_ on Freenode.
|
Join us in `#fHDHR <irc://irc.freenode.net/#fHDHR>`_ on Freenode.
|
||||||
|
|
||||||
|
|
||||||
Due to multiple issues, I'm dropping official support for Windows.
|
|
||||||
|
|||||||
@ -10,11 +10,6 @@
|
|||||||
"config_file": true,
|
"config_file": true,
|
||||||
"config_web": true
|
"config_web": true
|
||||||
},
|
},
|
||||||
"thread_method":{
|
|
||||||
"value": "multiprocessing",
|
|
||||||
"config_file": true,
|
|
||||||
"config_web": true
|
|
||||||
},
|
|
||||||
"servicename":{
|
"servicename":{
|
||||||
"value": "fHDHR",
|
"value": "fHDHR",
|
||||||
"config_file": false,
|
"config_file": false,
|
||||||
|
|||||||
@ -2,9 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import time
|
import time
|
||||||
import multiprocessing
|
|
||||||
import threading
|
import threading
|
||||||
import platform
|
|
||||||
|
|
||||||
from fHDHR import fHDHR_VERSION, fHDHR_OBJ
|
from fHDHR import fHDHR_VERSION, fHDHR_OBJ
|
||||||
import fHDHR.exceptions
|
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+.')
|
print('Error: fHDHR requires python 3.7+.')
|
||||||
sys.exit(1)
|
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():
|
def build_args_parser():
|
||||||
"""Build argument parser for fHDHR"""
|
"""Build argument parser for fHDHR"""
|
||||||
@ -45,30 +39,18 @@ def run(settings, logger, db, script_dir, fHDHR_web, origin, alternative_epg):
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
fhdhr.logger.info("HTTP Server Starting")
|
fhdhr.logger.info("HTTP Server Starting")
|
||||||
if settings.dict["main"]["thread_method"] in ["multiprocessing"]:
|
fhdhr_web = threading.Thread(target=fhdhrweb.run)
|
||||||
fhdhr_web = multiprocessing.Process(target=fhdhrweb.run)
|
fhdhr_web.start()
|
||||||
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()
|
|
||||||
|
|
||||||
if settings.dict["fhdhr"]["discovery_address"]:
|
if settings.dict["fhdhr"]["discovery_address"]:
|
||||||
fhdhr.logger.info("SSDP Server Starting")
|
fhdhr.logger.info("SSDP Server Starting")
|
||||||
if settings.dict["main"]["thread_method"] in ["multiprocessing"]:
|
fhdhr_ssdp = threading.Thread(target=fhdhr.device.ssdp.run)
|
||||||
fhdhr_ssdp = multiprocessing.Process(target=fhdhr.device.ssdp.run)
|
fhdhr_ssdp.start()
|
||||||
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()
|
|
||||||
|
|
||||||
if settings.dict["epg"]["method"]:
|
if settings.dict["epg"]["method"]:
|
||||||
fhdhr.logger.info("EPG Update Thread Starting")
|
fhdhr.logger.info("EPG Update Thread Starting")
|
||||||
if settings.dict["main"]["thread_method"] in ["multiprocessing"]:
|
fhdhr_epg = threading.Thread(target=fhdhr.device.epg.run)
|
||||||
fhdhr_epg = multiprocessing.Process(target=fhdhr.device.epg.run)
|
fhdhr_epg.start()
|
||||||
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()
|
|
||||||
|
|
||||||
# Perform some actions now that HTTP Server is running
|
# Perform some actions now that HTTP Server is running
|
||||||
fhdhr.logger.info("Waiting 3 seconds to send startup tasks trigger.")
|
fhdhr.logger.info("Waiting 3 seconds to send startup tasks trigger.")
|
||||||
|
|||||||
@ -259,9 +259,6 @@ class Config():
|
|||||||
|
|
||||||
def config_verification(self):
|
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"]:
|
if self.dict["main"]["required"]:
|
||||||
required_missing = []
|
required_missing = []
|
||||||
if isinstance(self.dict["main"]["required"], str):
|
if isinstance(self.dict["main"]["required"], str):
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import multiprocessing
|
|
||||||
import threading
|
import threading
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
@ -35,12 +34,8 @@ class Tuner():
|
|||||||
self.status["status"] = "Scanning"
|
self.status["status"] = "Scanning"
|
||||||
self.fhdhr.logger.info("Tuner #%s Performing Channel Scan." % str(self.number))
|
self.fhdhr.logger.info("Tuner #%s Performing Channel Scan." % str(self.number))
|
||||||
|
|
||||||
if self.fhdhr.config.dict["main"]["thread_method"] in ["multiprocessing"]:
|
chanscan = threading.Thread(target=self.runscan)
|
||||||
chanscan = multiprocessing.Process(target=self.runscan)
|
chanscan.start()
|
||||||
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()
|
|
||||||
|
|
||||||
def runscan(self):
|
def runscan(self):
|
||||||
self.fhdhr.api.client.get(self.chanscan_url)
|
self.fhdhr.api.client.get(self.chanscan_url)
|
||||||
|
|||||||
2
main.py
2
main.py
@ -6,7 +6,6 @@ monkey.patch_all()
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import pathlib
|
import pathlib
|
||||||
from multiprocessing import freeze_support
|
|
||||||
|
|
||||||
from fHDHR.cli import run
|
from fHDHR.cli import run
|
||||||
import fHDHR_web
|
import fHDHR_web
|
||||||
@ -16,5 +15,4 @@ import origin
|
|||||||
SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
|
SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
freeze_support()
|
|
||||||
sys.exit(run.main(SCRIPT_DIR, fHDHR_web, origin, alternative_epg))
|
sys.exit(run.main(SCRIPT_DIR, fHDHR_web, origin, alternative_epg))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user