]> git.parisson.com Git - deefuzzer.git/commitdiff
use argparse
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Fri, 22 Aug 2025 10:16:52 +0000 (12:16 +0200)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Fri, 22 Aug 2025 10:16:52 +0000 (12:16 +0200)
scripts/deefuzzer

index e7285141e53eeed29c2e326c2952bd23a6df9e86..50817ad55a37d71b6aac97e340ae43d2b67a8ba1 100755 (executable)
@@ -1,56 +1,18 @@
 #!/usr/bin/python3
 
-import os
-import sys
-import shout
-import datetime
-import platform
+import argparse
 import deefuzzer
 
-year = datetime.datetime.now().strftime("%Y")
-platform_system = platform.system()
-
-
-def prog_info():
-    desc = """ deefuzzer : easy and instant media streaming tool
- version : %s
- running on system : %s
-
- Copyright (c) 2007-%s Guillaume Pellerin <yomguy@parisson.com>
- All rights reserved.
-
- This software is licensed as described in the file COPYING, which
- you should have received as part of this distribution. The terms
- are also available at https://github.com/yomguy/DeeFuzzer/blob/master/LICENSE
-
- depends:  python, python-dev, python-xml, python-shout | shout-python, libshout3,
-           libshout3-dev, python-mutagen, python-pycurl
-
- recommends: icecast2, python-twitter, python-liblo | pyliblo (>= 0.26)
-
- Usage : deefuzzer [file]
-
-  where [file] is the path for a XML config file.
-
-  Edit an example in example/deefuzzer.xml
-  and then start one or more stations:
-
-  $ deefuzzer example/deefuzzer.xml
-
- see http://github.com/yomguy/DeeFuzzer for more details and debugging.
-        """
-
-    return desc % (deefuzzer.__version__, platform_system, year)
-
+from deefuzzer.version import __version__
 
 def main():
-    if len(sys.argv) >= 2:
-        d = deefuzzer.core.DeeFuzzer(sys.argv[-1])
-        d.start()
-    else:
-        text = prog_info()
-        sys.exit(text)
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-v', '--version', help='show version', action="version", version='%(prog)s ' + __version__)
+    parser.add_argument('config_file', type=str, help='config file (YAML, XML or JSON)')
+    args = parser.parse_args()
 
+    d = deefuzzer.core.DeeFuzzer(**args)
+    d.start()
 
 if __name__ == '__main__':
     main()