@@ -65,6 +65,31 @@ def read_config() -> configparser.ConfigParser:
6565requests .delete = partial (requests .delete , headers = {"Authorization" : f"Bearer { token } " })
6666
6767
68+ def write_config (config : configparser .ConfigParser ):
69+ mcch = os .environ .get ("MURFEY_CLIENT_CONFIG_HOME" )
70+ murfey_client_config_home = Path (mcch ) if mcch else Path .home ()
71+ with open (murfey_client_config_home / ".murfey" , "w" ) as configfile :
72+ config .write (configfile )
73+
74+
75+ def main_loop (
76+ source_watchers : List [murfey .client .watchdir .DirWatcher ],
77+ appearance_time : float ,
78+ transfer_all : bool ,
79+ ):
80+ log .info (
81+ f"Murfey { murfey .__version__ } on Python { '.' .join (map (str , sys .version_info [0 :3 ]))} entering main loop"
82+ )
83+ if appearance_time > 0 :
84+ modification_time : float | None = time .time () - appearance_time * 3600
85+ else :
86+ modification_time = None
87+ while True :
88+ for sw in source_watchers :
89+ sw .scan (modification_time = modification_time , transfer_all = transfer_all )
90+ time .sleep (15 )
91+
92+
6893def _enable_webbrowser_in_cygwin ():
6994 """Helper function to make webbrowser.open() work in CygWin"""
7095 if "cygwin" in platform .system ().lower () and shutil .which ("cygstart" ):
@@ -190,12 +215,6 @@ def run():
190215 default = False ,
191216 help = "Remove source files immediately after their transfer" ,
192217 )
193- parser .add_argument (
194- "--relax" ,
195- action = "store_true" ,
196- default = False ,
197- help = "Relax the condition that the source directory needs to be recognised from the configuration" ,
198- )
199218 parser .add_argument (
200219 "--name" ,
201220 type = str ,
@@ -319,34 +338,8 @@ def run():
319338 gain_ref = gain_ref ,
320339 redirected_logger = rich_handler ,
321340 force_mdoc_metadata = not args .ignore_mdoc_metadata ,
322- strict = not args .relax ,
323341 processing_enabled = machine_data .get ("processing_enabled" , True ),
324342 skip_existing_processing = args .skip_existing_processing ,
325343 )
326344 app .run ()
327345 rich_handler .redirect = False
328-
329-
330- def main_loop (
331- source_watchers : List [murfey .client .watchdir .DirWatcher ],
332- appearance_time : float ,
333- transfer_all : bool ,
334- ):
335- log .info (
336- f"Murfey { murfey .__version__ } on Python { '.' .join (map (str , sys .version_info [0 :3 ]))} entering main loop"
337- )
338- if appearance_time > 0 :
339- modification_time : float | None = time .time () - appearance_time * 3600
340- else :
341- modification_time = None
342- while True :
343- for sw in source_watchers :
344- sw .scan (modification_time = modification_time , transfer_all = transfer_all )
345- time .sleep (15 )
346-
347-
348- def write_config (config : configparser .ConfigParser ):
349- mcch = os .environ .get ("MURFEY_CLIENT_CONFIG_HOME" )
350- murfey_client_config_home = Path (mcch ) if mcch else Path .home ()
351- with open (murfey_client_config_home / ".murfey" , "w" ) as configfile :
352- config .write (configfile )
0 commit comments