Browse Source

corrected some errors in the main script and made it pep8 clean

Helmut Pozimski 10 years ago
parent
commit
313ea28224
1 changed files with 184 additions and 140 deletions
  1. 184 140
      stov

+ 184 - 140
stov

@@ -41,7 +41,6 @@ from lib_stov import stov_exceptions
 from lib_stov import database
 
 
-
 """Setup the logger to log messages to stdout and stderr"""
 
 logger = logging.getLogger("stov")
@@ -76,6 +75,7 @@ else:
 
 """Define a handler for signals sent to the program"""
 
+
 def sighandler(signum, frame):
     if signum == 2:
         print(_("STRG+C has been pressed, quitting..."), file=sys.stderr)
@@ -95,32 +95,34 @@ can be localized
 
 
 class MyOptionParser(OptionParser):
-    def error(self, msg):
-        if "invalid integer" in msg:
+    def error(self, parser_msg):
+        if "invalid integer" in parser_msg:
             print(_("option %s requires an integer value")
-                    % msg.split()[1], file = sys.stderr)
+                  % parser_msg.split()[1], file=sys.stderr)
             self.exit()
-        elif "an argument" in msg:
-            print(_("option %s requires an argument") % msg.split()[0],
-                file=sys.stderr)
+        elif "an argument" in parser_msg:
+            print(_("option %s requires an argument") % parser_msg.split()[0],
+                  file=sys.stderr)
             self.exit()
-        elif "no such" in msg:
-            print(_("invalid option %s") % msg.split()[3],
-                file=sys.stderr)
+        elif "no such" in parser_msg:
+            print(_("invalid option %s") % parser_msg.split()[3],
+                  file=sys.stderr)
             self.exit()
         else:
-            print(msg, file=sys.stderr)
+            print(parser_msg, file=sys.stderr)
             self.exit()
 
 """Process the given options and parameters,
-        add: Add a new subscription (which can be a search, channel or playlist)
+        add: Add a new subscription (which can be a search, channel or
+        playlist)
         channel: with add, specify the name of the channel or user
         lssubs: List the currently available subscriptions
         remove: remove a subscription
         update: update the information about the available videos
-        download: download all available videos which haven't already been downloaded
-        search: optionally add a search string to a new subscription or create a
-            search subscription with add
+        download: download all available videos which haven't already been
+        downloaded
+        search: optionally add a search string to a new subscription or
+        create a search subscription with add
         playlist: with add, subscribe to a youtube playlist
         catchup: Mark all videos in a subscription as downloaded
         version: Print version number
@@ -133,48 +135,52 @@ class MyOptionParser(OptionParser):
 """
 
 parser = MyOptionParser(usage=_("Usage: %prog [options]"), prog="stov",
-                add_help_option=True, conflict_handler="resolve")
+                        add_help_option=True, conflict_handler="resolve")
 
 parser.add_option("-h", "--help", action="store_true", dest="help",
-help=_("show this help message and exit"))
+                  help=_("show this help message and exit"))
 parser.add_option("-a", "--add", dest="add", action="store_true",
-help=_("Add a new subscription (requires either \
---search, --channel or --playlist)"))
+                  help=_("Add a new subscription (requires either \
+                  --search, --channel or --playlist)"))
 parser.add_option("-p", "--playlist", dest="playlist",
-help=_("Add a new Playlist subscription (requires add)"))
+                  help=_("Add a new Playlist subscription (requires add)"))
 parser.add_option("-l", "--lssubs", action="store_true", dest="list",
-help=_("List the currently available subscriptions"))
+                  help=_("List the currently available subscriptions"))
 parser.add_option("-r", "--remove", type="int", dest="deleteid",
-help=_("remove a subscription"))
+                  help=_("remove a subscription"))
 parser.add_option("-u", "--update", action="store_true", dest="update",
-help=_("update the information about the available videos"))
+                  help=_("update the information about the available videos"))
 parser.add_option("-d", "--download", action="store_true", dest="download",
-help=_("download all available videos which haven't already been downloaded"))
+                  help=_("download all available videos which haven't already "
+                         "been downloaded"))
 parser.add_option("-s", "--search", dest="searchparameter",
-help=_("optionally add a search string to a new channel subscription or \
-create a new search subscription (requires --add)"))
+                  help=_("optionally add a search string to a new channel "
+                         "subscription or create a new search subscription "
+                         "(requires --add)"))
 parser.add_option("-l", "--lsvids", type="int", dest="subscriptionid",
-help=_("Print all videos from a subscription"))
+                  help=_("Print all videos from a subscription"))
 parser.add_option("-c", "--catchup", dest="catchup",
-help=_("Mark all videos from one channel as read \
-(requires subscription-id as argument)"))
+                  help=_("Mark all videos from one channel as read \
+                  (requires subscription-id as argument)"))
 parser.add_option("-c", "--channel", dest="channel",
-help=_("specify a channel for a new subscription (requires --add)"))
+                  help=_("specify a channel for a new subscription "
+                         "(requires --add)"))
 parser.add_option("-l", "--license", dest="license", action="store_true",
-help=_("show the license of the program"))
+                  help=_("show the license of the program"))
 parser.add_option("-v", "--version", dest="version", action="store_true",
-help=_("show the current running version number"))
+                  help=_("show the current running version number"))
 parser.add_option("-q", "--quiet", dest="quiet", action="store_true",
-help=_("Suppress all output"))
+                  help=_("Suppress all output"))
 parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
-help=_("Be verbose and print also diagnostical messages"))
+                  help=_("Be verbose and print also diagnostical messages"))
 parser.add_option("-c", "--clean-database", dest="cleanup",
-action="store_true", help=_("Clean the database of entries no longer listed "
-"in the current API response"))
+                  action="store_true", help=_("Clean the database of entries "
+                                              "no longer listed in the current"
+                                              " API response"))
 parser.add_option("-e", "--enable", type="int", dest="enableid",
-help=_("enables the subscription with the provided ID"))
+                  help=_("enables the subscription with the provided ID"))
 parser.add_option("--disable", type="int", dest="disableid",
-help=_("disables the subscription with the provided ID"))
+                  help=_("disables the subscription with the provided ID"))
 (options, arguments) = parser.parse_args()
 
 """Check if stov is run directly from command line since it shouldn't be
@@ -184,7 +190,7 @@ loaded as a module
 
 if __name__ != "__main__":
     print("This file should not be imported as a module"
-                "please run it directly from command line")
+          "please run it directly from command line")
     sys.exit(1)
 
 """Variable to determine if the exit code should be success or not"""
@@ -199,7 +205,7 @@ of the user defined setting
 
 if options.verbose is True and options.quiet is True:
     print(_("--quiet and --verbose can't be defined at the same time, "
-        "exiting."), file=sys.stderr)
+            "exiting."), file=sys.stderr)
     sys.exit(1)
 elif options.verbose is True:
     outputlevel = "verbose"
@@ -222,14 +228,14 @@ if os.access("/tmp/stov.lock", os.F_OK):
         lockfile = open("/tmp/stov.lock", "r")
     except IOError:
         logger.error(_("The lock file could not be opened, please check that "
-                    "it exists and is readable, quitting now"))
+                       "it exists and is readable, quitting now"))
         sys.exit(1)
     oldpid = lockfile.read().strip()
     if os.access("/proc/" + oldpid, os.F_OK):
         logger.error(_("The lock file already exists, probably another"
-                 "instance of this program is already running\n"
-                 "if you are sure this is not the case, delete it"
-                 " manually and try again!"))
+                       "instance of this program is already running\n"
+                       "if you are sure this is not the case, delete it"
+                       " manually and try again!"))
         sys.exit(1)
     lockfile.close()
     if os.access("/proc/" + oldpid, os.F_OK) is not True:
@@ -242,8 +248,8 @@ try:
     lockfile.write(str(os.getpid()))
     lockfile.close()
 except IOError:
-    logger.error(_("The lock file could not be created, please check that /tmp is "
-        "writable and properly configured, quitting now."))
+    logger.error(_("The lock file could not be created, please check that /tmp"
+                   " is writable and properly configured, quitting now."))
     sys.exit(1)
 
 """Check if the configuration directory exists and is writeable. If it
@@ -251,10 +257,13 @@ doesnt, create it using the configuration class.
 
 """
 if os.access(os.environ['HOME'] + "/.stov", os.F_OK & os.W_OK) is not True:
-    logger.info(_("This seems to be the first time you run the programm, do you"
-        " want to run the interactive assistant? (yes/no)"))
+    logger.info(_("This seems to be the first time you run the programm, do "
+                  "you want to run the interactive assistant? (yes/no)"))
     conf = configuration.conf()
-    temp_input = raw_input()
+    if sys.version_info >= (3, 0):
+        temp_input = input()
+    else:
+        temp_input = raw_input()
     if temp_input == "yes":
         conf.assist()
         try:
@@ -268,7 +277,7 @@ if os.access(os.environ['HOME'] + "/.stov", os.F_OK & os.W_OK) is not True:
         logger.info(_("Writing initial configuration according to default"
                       "values."))
         logger.debug(_("Creating hidden directory in home for configuration"
-                      "and database."))
+                       "and database."))
         try:
             conf.Initialize()
         except stov_exceptions.DirectoryCreationFailedException, e:
@@ -281,33 +290,19 @@ else:
         logger.debug(_("Comparing current and running configuration version."))
         check_result = conf.CheckConfig()
     except stov_exceptions.ConfigFileReadErrorException, e:
-        logging.error(e)
+        logger.error(e)
     except stov_exceptions.InvalidConfigurationVersionException, e:
-        logging.error(e)
-    if check_result is not True:
-        logger.info(_("Your configuration needs to be updated, performing"
-            " update now."))
-        try:
-            conf.UpdateConfig()
-        except stov_exceptions.ConfigFileReadErrorException, e:
-            logging.error(e)
-        except stov_exceptions.ConfigFileWriteErrorException, e:
-            logging.error(e)
-    try:
-        logger.debug(_("Comparing current and running database version."))
-        check_result = conf.CheckDB()
-    except stov_exceptions.ConfigFileReadErrorException,e:
         logger.error(e)
-    if check_result is not True:
-        logger.info(_("Your database needs to be updated, performing"
-            " update now."))
-        db.Update()
-        conf.values["db_version"] = db.GetVersion()
-        logger.debug("Opening configuration file.")
-        try:
-            conf.WriteConfig()
-        except stov_exceptions.ConfigFileWriteErrorException, e:
-            logger.error(e)
+    else:
+        if check_result is not True:
+            logger.info(_("Your configuration needs to be updated, performing"
+                          " update now."))
+            try:
+                conf.UpdateConfig()
+            except stov_exceptions.ConfigFileReadErrorException, e:
+                logger.error(e)
+            except stov_exceptions.ConfigFileWriteErrorException, e:
+                logger.error(e)
 
 
 """Create the initial connection to the database"""
@@ -331,6 +326,21 @@ else:
             logger.error(e)
             sys.exit(1)
 
+try:
+    logger.debug(_("Comparing current and running database version."))
+    if conf.CheckDB() is not True:
+                logger.info(_("Your database needs to be updated, performing"
+                              " update now."))
+                db.Update()
+                conf.values["db_version"] = db.GetVersion()
+                logger.debug("Opening configuration file.")
+                try:
+                    conf.WriteConfig()
+                except stov_exceptions.ConfigFileWriteErrorException, e:
+                    logger.error(e)
+except stov_exceptions.DBWriteAccessFailedException as e:
+    logger.error(e)
+
 """Check which outputlevel is defined and update the configuration object
 accordingly.
 """
@@ -343,23 +353,26 @@ functionality without it so we need to check that here
 """
 
 if conf.values["youtube-dl"] == "":
-    conf.values["youtube-dl"] = subprocess.Popen(["which", "youtube-dl"],
-                stdout=subprocess.PIPE).communicate()[0].strip()
+    youtube_dl_path = subprocess.Popen(["which", "youtube-dl"],
+                                       stdout=subprocess.PIPE)\
+        .communicate()[0]
+    conf.values["youtube-dl"] = youtube_dl_path.strip()
     if os.access(conf.values["youtube-dl"], os.F_OK & os.R_OK & os.X_OK):
         logger.info(_("Found youtube-dl, writing it's path to the "
                       "configuration file."))
         logger.debug("Opening configuration file.")
         try:
             conf.WriteConfig()
-        except stov_exceptions.ConfigFileWriteErrorException:
+        except stov_exceptions.ConfigFileWriteErrorException as e:
             logger.error(e)
     else:
         logger.error(_("Could not find youtube-dl, it either does not exist, "
-                    "is not readable or not executable. Please note that "
-                    "youtube-dl is not needed for the program to run but is"
-                    " needed to use the download option which won't work otherwise."
-                    " If youtube-dl isn't found automatically, you may also enter "
-                    "the path to it in the configuration file."))
+                       "is not readable or not executable. Please note that "
+                       "youtube-dl is not needed for the program to run but "
+                       "is needed to use the download option which won't work "
+                       "otherwise. If youtube-dl isn't found automatically, "
+                       "you may also enter the path to it in the configuration"
+                       " file."))
 
 """Variable to save the text that is later sent as e-mail"""
 mailcontent = []
@@ -372,19 +385,24 @@ if options.add is True:
     AddSub = True
     if options.channel is not None and options.searchparameter is None:
         NewSubscription = subscription.sub(type="channel",
-        name=options.channel, conf=conf)
+                                           name=options.channel, conf=conf)
     elif options.channel is not None and options.searchparameter is not None:
         NewSubscription = subscription.sub(type="channel",
-        name=options.channel, search=options.searchparameter, conf=conf)
+                                           name=options.channel,
+                                           search=options.searchparameter,
+                                           conf=conf)
     elif options.channel is None and options.searchparameter is not None:
         NewSubscription = subscription.sub(type="search",
-        name=_("Search_"), search=options.searchparameter, conf=conf)
+                                           name=_("Search_"),
+                                           search=options.searchparameter,
+                                           conf=conf)
     elif options.playlist is not None:
         if options.searchparameter is not None:
-            logger.error(_("Playlists do not support searching, the search option "
-                    "will be ignored!"))
+            logger.error(_("Playlists do not support searching, the search "
+                           "option will be ignored!"))
         NewSubscription = subscription.sub(type="playlist",
-                name=options.playlist, conf=conf)
+                                           name=options.playlist,
+                                           conf=conf)
     else:
         logger.error(_("None or invalid subscription type given, please check "
                        "the type option and try again."))
@@ -406,7 +424,7 @@ if options.add is True:
                 if NewSubscription.CheckStringMatch(video):
                     db.InsertVideo(video, NewSubscription.GetId())
         logger.info(_("New subscription ") + NewSubscription.GetTitle()
-        + _(" successfully added"))
+                    + _(" successfully added"))
 
 elif options.list is True:
     Listofsubscriptions = db.GetSubscriptions()
@@ -418,15 +436,17 @@ elif options.list is True:
             elif int(subscription[2]) == 1:
                 sub_state = _("disabled")
             if subscription[0] is not None:
-                logger.info(str(subscription[0]) + " " + subscription[1] + " (%s)" % sub_state)
+                logger.info(str(subscription[0]) + " " + subscription[1]
+                            + " (%s)" % sub_state)
     else:
         logger.info(_("No subscriptions added yet, add one!"))
 elif options.deleteid is not None:
     try:
         DeleteID = int(options.deleteid)
     except ValueError:
-        logger.error(_("Invalid Option, please use the ID of the subscription"
-            "you want to delete as parameter for the remove option"))
+        logger.error(_("Invalid Option, please use the ID of the subscription "
+                       "you want to delete as parameter for the remove "
+                       "option"))
     else:
         try:
             deletemessage = db.DeleteSubscription(DeleteID)
@@ -441,8 +461,13 @@ elif options.update is True:
     subscriptions = db.GetSubscriptions()
     for element in subscriptions:
         listofsubscriptions.append(subscription.sub(id=element[0],
-        title=element[1], type=element[2], name=element[3],
-        search=element[4], directory=element[5], disabled=element[6], conf=conf))
+                                   title=element[1],
+                                   type=element[2],
+                                   name=element[3],
+                                   search=element[4],
+                                   directory=element[5],
+                                   disabled=element[6],
+                                   conf=conf))
     for element in listofsubscriptions:
         try:
             element.ParseAPIData()
@@ -463,13 +488,18 @@ elif options.download is True:
     itag_value = conf.GetYoutubeParameter()
     logger.debug(_("Found value: %s.") % itag_value)
     if itag_value == 0:
-        logger.debug(_("Codec and resolution could not be determined, using maximum "
-            "possible value"))
+        logger.debug(_("Codec and resolution could not be determined, using "
+                       "maximum possible value"))
         itag_value = 38
     for element in subscriptions:
         listofsubscriptions.append(subscription.sub(id=element[0],
-        title=element[1], type=element[2], name=element[3],
-        search=element[4], directory=element[5], disabled=element[6], conf=conf))
+                                                    title=element[1],
+                                                    type=element[2],
+                                                    name=element[3],
+                                                    search=element[4],
+                                                    directory=element[5],
+                                                    disabled=element[6],
+                                                    conf=conf))
     videosdownloaded = 0
     videosfailed = 0
     for element in listofsubscriptions:
@@ -496,10 +526,12 @@ elif options.download is True:
         msg = MIMEMultipart()
         if videosdownloaded == 1:
             msg["Subject"] = _("Downloaded %i new video") % videosdownloaded
-            MailText = _("The following episode has been downloaded by stov: \n\n")
+            MailText = _("The following episode has been downloaded by stov: "
+                         "\n\n")
         else:
             msg["Subject"] = _("Downloaded %i new videos") % videosdownloaded
-            MailText = _("The following episodes have been downloaded by stov: \n\n")
+            MailText = _("The following episodes have been downloaded by stov:"
+                         " \n\n")
         msg["From"] = "stov <%s>" % conf.values["mailfrom"]
         msg["To"] = "<%s>" % conf.values["mailto"]
         for line in mailcontent:
@@ -509,14 +541,15 @@ elif options.download is True:
         serverconnection = smtplib.SMTP()
         try:
             if sys.version_info >= (3, 0):
-                serverconnection.connect(conf.values["mailhost"], conf.values["smtpport"])
+                serverconnection.connect(conf.values["mailhost"],
+                                         conf.values["smtpport"])
             else:
                 serverconnection.connect(str(conf.values["mailhost"]),
-                    str(conf.values["smtpport"]))
+                                         str(conf.values["smtpport"]))
         except (smtplib.SMTPConnectError, smtplib.SMTPServerDisconnected,
-        socket.error):
-            logger.error(_("Could not connect to the smtp server, please check your "
-                        "settings!"))
+                socket.error):
+            logger.error(_("Could not connect to the smtp server, please check"
+                           " your settings!"))
             logger.error(MailText)
         else:
             try:
@@ -525,22 +558,24 @@ elif options.download is True:
                 logger.debug(_("TLS not available, proceeding unencrypted."))
             if conf.values["auth_needed"] == "yes":
                 try:
-                    serverconnection.login(conf.values["user_name"], conf.values["password"])
+                    serverconnection.login(conf.values["user_name"],
+                                           conf.values["password"])
                 except smtplib.SMTPAuthenticationError:
-                    logger.error(_("Authentication failed, please check user name"
-                                "and password!"))
+                    logger.error(_("Authentication failed, please check user "
+                                   "name and password!"))
                 except smtplib.SMTPException:
-                    logger.error(_("Could not authenticate, server probably does not"
-                                " support authentication!"))
+                    logger.error(_("Could not authenticate, server probably "
+                                   "does not support authentication!"))
             try:
-                serverconnection.sendmail(conf.values["mailfrom"], conf.values["mailto"],
-                        msg.as_string())
+                serverconnection.sendmail(conf.values["mailfrom"],
+                                          conf.values["mailto"],
+                                          msg.as_string())
             except smtplib.SMTPRecipientsRefused:
                 logger.error(_("The server refused the recipient address, "
-                            "please check your settings."))
+                               "please check your settings."))
             except smtplib.SMTPSenderRefused:
                 logger.error(_("The server refused the sender address, "
-                            "please check your settings."))
+                               "please check your settings."))
             serverconnection.quit()
     elif videosdownloaded == 0 and videosfailed == 0:
         if conf.values["notify"] == "no":
@@ -553,38 +588,41 @@ elif options.download is True:
     else:
         if conf.values["notify"] != "yes":
             logger.error(_("Could not determine how you want to be informed "
-                        "about new videos, please check the notify parameter "
-                        "in your configuration"))
+                         "about new videos, please check the notify parameter "
+                         "in your configuration"))
 
 elif options.subscriptionid is not None:
     try:
         Data = db.GetSubscription(options.subscriptionid)
     except stov_exceptions.DBWriteAccessFailedException, e:
         logger.error(e)
-    if Data != []:
+    if Data:
         Subscription = subscription.sub(id=Data[0][0], title=Data[0][1],
-        type=Data[0][2], name=Data[0][3], search=Data[0][4],
-        directory=Data[0][5], disabled=Data[0][6], conf=conf)
+                                        type=Data[0][2], name=Data[0][3],
+                                        search=Data[0][4],
+                                        directory=Data[0][5],
+                                        disabled=Data[0][6], conf=conf)
         videos = db.GetVideos(Subscription.GetId())
         Subscription.GatherVideos(videos)
         video_list = Subscription.PrintVideos()
         for video in video_list:
             logger.info(video)
     else:
-        logger.error(_("Invalid subscription, please check the list and try again"))
+        logger.error(_("Invalid subscription, please check the list and try "
+                       "again"))
 elif options.catchup is not None:
     try:
         sub_data = db.GetSubscriptionTitle(options.catchup)
     except stov_exceptions.DBWriteAccessFailedException, e:
         logger.error(e)
     if sub_data != []:
-           try:
-               db.MarkVideosDownloaded(options.catchup)
-           except stov_exceptions.DBWriteAccessFailedException, e:
-               logger.error(e)
+        try:
+            db.MarkVideosDownloaded(options.catchup)
+        except stov_exceptions.DBWriteAccessFailedException, e:
+            logger.error(e)
     else:
-           logger.error(_("The subscription could not be updated, "
-                    "please check if the ID given is correct."))
+        logger.error(_("The subscription could not be updated, "
+                       "please check if the ID given is correct."))
 
 
 elif options.cleanup is True:
@@ -592,14 +630,16 @@ elif options.cleanup is True:
     subscriptions = db.GetSubscriptions()
     for element in subscriptions:
         subscriptions_list.append(subscription.sub(id=element[0],
-        title=element[1], type=element[2], name=element[3],
-        search=element[4], directory=element[5], disabled=element[6],
-        conf=conf))
+                                  title=element[1], type=element[2],
+                                  name=element[3], search=element[4],
+                                  directory=element[5], disabled=element[6],
+                                  conf=conf))
     for element in subscriptions_list:
         videos = db.GetVideos(element.GetId())
         element.CheckAndDelete(videos)
         for delete_video in element.ToDelete:
-            logger.debug(_("Deleting video %s from database") % delete_video.title)
+            logger.debug(_("Deleting video %s from "
+                           "database") % delete_video.title)
             try:
                 db.DeleteVideo(delete_video.GetID())
             except stov_exceptions.DBWriteAccessFailedException, e:
@@ -612,32 +652,36 @@ elif options.enableid is not None:
         subscription_state = db.GetSubscription(options.enableid)
         try:
             if int(subscription_state[0][6]) == 0:
-                logger.error(_("The subscription ID %s is already enabled") % options.enableid)
+                logger.error(_("The subscription ID %s is already enabled")
+                             % options.enableid)
             elif int(subscription_state[0][6]) == 1:
                 try:
                     db.ChangeSubscriptionState(options.enableid, 0)
                 except stov_exceptions.DBWriteAccessFailedException, e:
                     logger.error(e)
                 else:
-                    logger.info(_("Enabled subscription ID %s") % options.enableid)
+                    logger.info(_("Enabled subscription ID %s")
+                                % options.enableid)
         except IndexError:
-            logger.error(_("Could not find the subscription with ID %s, please check "
-            "and try again") % options.enableid)
+            logger.error(_("Could not find the subscription with ID %s, "
+                           "please check and try again") % options.enableid)
 elif options.disableid is not None:
         subscription_state = db.GetSubscription(options.disableid)
         try:
             if int(subscription_state[0][6]) == 1:
-                logger.error(_("Subscription ID %s is already disabled") % options.disableid)
+                logger.error(_("Subscription ID %s is already disabled")
+                             % options.disableid)
             elif int(subscription_state[0][6]) == 0:
                 try:
                     db.ChangeSubscriptionState(options.disableid, 1)
                 except stov_exceptions.DBWriteAccessFailedException, e:
                     logger.error(e)
                 else:
-                    logger.info(_("Disabled subscription ID %s") % options.disableid)
+                    logger.info(_("Disabled subscription ID %s")
+                                % options.disableid)
         except IndexError:
-            logger.error(_("Could not find the subscription with ID %s, please check "
-            "and try again") % options.disableid)
+            logger.error(_("Could not find the subscription with ID %s, please"
+                           " check and try again") % options.disableid)
 elif options.license is True:
     logger.info("""
     stov is free software: you can redistribute it and/or modify
@@ -666,4 +710,4 @@ try:
         sys.exit(1)
 except os.error:
     logger.error(_("Could not delete the lock file. Please check what "
-                "went wrong and clean up manually!"))
+                   "went wrong and clean up manually!"))