| 
					
				 | 
			
			
				@@ -1,15 +1,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#!/usr/bin/env python3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-# -*- coding: utf-8 -*- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import datetime as dt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import argparse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import os 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import re 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import sys 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import symuid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import symuid.library.itunes 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import sys 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-def symuid_import_itunes(xml_library_path, path_regex_sub): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+def import_itunes_xml_library(xml_library_path, path_regex_sub): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     lib = symuid.library.itunes.XmlLibrary(xml_library_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for itunes_track in lib.tracks: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # TODO create tag if last_play_dt is None 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -30,12 +28,11 @@ def symuid_import_itunes(xml_library_path, path_regex_sub): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         count=itunes_track.play_count, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tag_set_cb=lambda tr, tag: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        print('{!r}: set tag {!r}'.format(tr.path, tag)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    print('{!r}: set tag {!r}'.format(tr.path, tag)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 def _init_argparser(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    import argparse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     argparser = argparse.ArgumentParser(description=None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     argparser.add_argument('xml_library_path') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     argparser.add_argument( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -49,11 +46,7 @@ def _init_argparser(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return argparser 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-def main(argv): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+def _main(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     argparser = _init_argparser() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    args = argparser.parse_args(argv[1:]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    symuid_import_itunes(**vars(args)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    return 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-if __name__ == "__main__": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    sys.exit(main(sys.argv)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    args = argparser.parse_args() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    import_itunes_xml_library(**vars(args)) 
			 |