Browse Source

Modified the design for more flexibility.

sachinmanawadi271 7 years ago
parent
commit
373ad7eab7
4 changed files with 47 additions and 34 deletions
  1. 4 6
      BussinessLogic.py
  2. 14 11
      app.py
  3. 5 11
      automate.py
  4. 24 6
      conf.py

+ 4 - 6
BussinessLogic.py

@@ -12,20 +12,18 @@ class business_logic:
         Path = PathConfig( )
         #app = application.Application()
         backslash = "\\"
-        FolderPaths = Path.getPath()
-        print(FolderPaths[1])
-        print(file)
-        app_path = FolderPaths[1]+backslash+file
+        #FolderPaths = Path.getPath()
+        app_path = Path.Moved_Path+backslash+file
         print(app_path)
         os.startfile(app_path)
-        time.sleep(100)
+        time.sleep(50)
         print("Sleep End!!!")
         app = Application().connect(path=r"C:\Program Files\TechSmith\Camtasia 9\CamtasiaStudio.exe")
         #for TRIAL
         app.Window_(best_match='Dialog', top_level_only=True).ChildWindow(best_match='Finish').Click()
         #end for TRIAL
         hwndwrappercamtasiastudioexebbedcaecbaeffaf = app[u'Camtasia 9']
-
+        #remark
         hwndwrappercamtasiastudioexebbedcaecbaeffaf.ClickInput(coords=(200, 20))
         hwndwrappercamtasiastudioexebbedcaecbaeffaf.TypeKeys("{DOWN}")
         hwndwrappercamtasiastudioexebbedcaecbaeffaf.TypeKeys("{ENTER}")

+ 14 - 11
app.py

@@ -1,19 +1,22 @@
 from automate import Automate
 from BussinessLogic import business_logic
-Files1=[]
-Files2=[]
+from conf import PathConfig
+from MACROS import MACROS
+Files=[]
+
 Auto = Automate()
-Paths=Auto.Init()
+#Initializes from the configuration file
+Auto.Init()
 
-Files1=Auto.GetFiles(Paths[0])
-print (Paths[0])
-print (Files1)
+Path = PathConfig( )
+#Get the folder paths to copy from src to dest
+#src_folder = Path.get_Original_Path()
+#dest_folder = Path.get_Moved_Path()
+Auto.copyFiles(Path.Original_Path,Path.Moved_Path)
 
-Auto.copyFiles(Paths)
+#Get the files from the dest folder to start the conversion process
+Files=Auto.GetFiles(Path.Moved_Path)
 
-for file in Files1:
-    #Files2=Auto.GetFiles(Paths[1])
-    print (file)
-    #print (Files2)
+for file in Files:
     bi = business_logic()
     bi.convert_files(file)

+ 5 - 11
automate.py

@@ -9,11 +9,7 @@ class Automate:
 
     def Init(self):
         Path = PathConfig( )
-        FolderPaths = []
-        Path.SetPath( )
-        FolderPaths = Path.getPath()
-        return FolderPaths
-        # print (FolderPaths)
+        Path.SetPath()
 
     def GetFiles(self, paths):
         files = []
@@ -21,11 +17,9 @@ class Automate:
             files.append( file )
         return files
 
-    def copyFiles(self, paths):
-        for file in os.listdir( paths[0] ):
+    def copyFiles(self, src_folder,dest_folder):
+        for file in os.listdir( src_folder ):
             print ("File being moved -----> " + file)
-            full_file_name = os.path.join( paths[0], file )
+            full_file_name = os.path.join( src_folder, file )
             if os.path.isfile(full_file_name):
-                shutil.move( full_file_name, paths[1] )
-
-                #shutil.copy( full_file_name, paths[1] )
+                shutil.move( full_file_name, dest_folder )

+ 24 - 6
conf.py

@@ -2,18 +2,36 @@ import xml.etree.ElementTree as ET
 
 class PathConfig:
     'Configuration Class for File Paths'
+    Original_Path = ""
+    Moved_Path = ""
 
-    filePaths=[]
+    #def __init__(self):
+    #    self.Original_Path = ''
+    #    self.Moved_Path = ''
 
     def SetPath(self):
         tree = ET.parse('configuration.xml')
         root = tree.getroot()
-        for path in root:
-            PathConfig.filePaths.append(path.get('value'))
-           # print(path.get('value'))
+        #Get the folder path where the files are present
+        path = root.find('Path')
+        #PathConfig.filePaths.append(path.get('path1'))
+        PathConfig.Original_Path = path.get('path1')
+        #Get the folder path where files are to be moved
+        move_path = root.find('MovePath')
+        PathConfig.Moved_Path = move_path.get('path2')
+        #PathConfig.filePaths.append(move_path.get('path2'))
 
 
-    def getPath(self):
-        return PathConfig.filePaths
+        #for path in root:
+            #PathConfig.filePaths.append(path.get('path1'))
+            #PathConfig.filePaths.append(path.get('path2'))
+            #print(path.get('path'))
 
 
+
+    def get_Moved_Path(self):
+        return PathConfig.Moved_Path
+
+    def get_Original_Path(self):
+        return PathConfig.Original_Path
+