eit.py

changeset 17
842120f00078
parent 9
1bf778001041
--- a/eit.py	Tue Nov 28 21:04:03 2017 +0100
+++ b/eit.py	Tue Nov 28 22:27:01 2017 +0100
@@ -146,11 +146,13 @@
         self.eit_file = None
 
         self.eit = {}
-        self.iso = None
+        #self.iso = None
 
         self.load(path)
 
     def load(self, path):
+        self.eit = {}
+        self.eit_file = None
         if path:
             self.eit_file = path
             self._read_file()
@@ -188,8 +190,22 @@
     def get_date(self):
         return todate(self.get_startdate(), self.get_starttime())
 
-    def dumpEit(self):
-        print self.eit
+    def dump(self):
+        """Module docstring.
+        Read Eit File and show the information.
+        """
+        if len(self.eit) == 0:
+            return None
+        out = "Movie name: %s" % self.get_name()
+        out += "\nGenre: %s" % self.get_genre()
+        out += "\nComponents: %s" % self.get_components()
+        out += "\nStartDate: %s" % self.get_date()
+        out += "\nDescription: %s" % self.get_description()
+        out += "\nDuration: %02i:%02i:%02i" % self.get_duration()
+        out += " (%s minutes)" % (self.get_duration_seconds() / 60)
+
+        print out
+        return out
 
     ##############################################################################
     ## File IO Functions
@@ -355,23 +371,6 @@
                 self.eit = {}
 
 
-def readeit(eitfile):
-    """Module docstring.
-    Read Eit File and show the information.
-    """
-    eitlist = eitinfo(eitfile)
-    if len(eitlist.eit) == 0:
-        return None
-    out = "Movie name: %s" % eitlist.get_name()
-    out += "\nGenre: %s" % eitlist.get_genre()
-    out += "\nComponents: %s" % eitlist.get_components()
-    out += "\nStartDate: %s" % eitlist.get_date()
-    out += "\nDescription: %s" % eitlist.get_description()
-    out += "\nDuration: %02i:%02i:%02i" % eitlist.get_duration()
-    out += " (%s minutes)" % (eitlist.get_duration_seconds() / 60)
-
-    print out
-    return out
 
 def main():
     # parse command line options
@@ -387,8 +386,10 @@
             print __doc__
             sys.exit(0)
     # process arguments
+    info = eitinfo()
     for arg in args:
-        readeit(arg) # process() is defined elsewhere
+        info.load(arg)
+        info.dump()
 
 if __name__ == "__main__":
     main()

mercurial