Browse Source

move license printing to program

Helmut Pozimski 6 years ago
parent
commit
b25c9a6c8c
2 changed files with 21 additions and 20 deletions
  1. 18 0
      lib_stov/program.py
  2. 3 20
      stov

+ 18 - 0
lib_stov/program.py

@@ -437,3 +437,21 @@ def change_subscription_state(database, sub_id, enable=False):
     except IndexError:
         LOGGER.error(_("Could not find the subscription with ID %s, "
                        "please check and try again."), sub_id)
+
+
+def print_license():
+    """
+    Prints the license of the application.
+    """
+    LOGGER.info("""
+        stov is free software: you can redistribute it and/or modify
+        it under the terms of the GNU General Public License as published by
+        the Free Software Foundation, version 2 of the License.
+
+        stov is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        GNU General Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with stov.  If not, see <http://www.gnu.org/licenses/>.""")

+ 3 - 20
stov

@@ -25,11 +25,8 @@
 everything together, performing all the actions a user wants.
 """
 
-import sys
 import logging
 
-from lib_stov import subscription
-from lib_stov import stov_exceptions
 from lib_stov import helpers
 from lib_stov import program
 
@@ -78,7 +75,6 @@ elif ARGUMENTS.download:
             LOGGER.error(_("Could not determine how you want to be informed "
                            "about new videos, please check the notify "
                            "parameter in your configuration."))
-
 elif ARGUMENTS.subscriptionid:
     program.list_videos(DB, CONF, ARGUMENTS.subscriptionid)
 elif ARGUMENTS.catchup:
@@ -89,23 +85,10 @@ elif ARGUMENTS.enableid:
     program.change_subscription_state(DB, ARGUMENTS.enableid, True)
 elif ARGUMENTS.disableid:
     program.change_subscription_state(DB, ARGUMENTS.disableid, False)
-elif ARGUMENTS.license is True:
-    LOGGER.info("""
-    stov is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, version 2 of the License.
-
-    stov is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with stov.  If not, see <http://www.gnu.org/licenses/>.""")
-elif ARGUMENTS.version is True:
+elif ARGUMENTS.license:
+    program.print_license()
+elif ARGUMENTS.version:
     LOGGER.info("1.0wip")
 else:
     PARSER.print_help()
-
-
 helpers.remove_lock()