Răsfoiți Sursa

Translate the help screen, catch signals, improve German localization

Helmut Pozimski 11 ani în urmă
părinte
comite
adf2be5537
7 a modificat fișierele cu 214 adăugiri și 151 ștergeri
  1. 0 3
      TODO
  2. BIN
      locale/de/LC_MESSAGES/stov.mo
  3. 17 1
      locale/de/LC_MESSAGES/stov.po
  4. 149 133
      messages.pot
  5. 28 3
      stov.py
  6. 19 10
      subscription.py
  7. 1 1
      youtube.py

+ 0 - 3
TODO

@@ -2,6 +2,3 @@ TODOs for 0.4:
 
 *Rework and correct strings
 *Make the whole help screen translateable
-*Don't report success on deletion if the subscription didn't exist
-*Correctly catch signals
-*Full compability with python 3 (mostly done)

BIN
locale/de/LC_MESSAGES/stov.mo


+ 17 - 1
locale/de/LC_MESSAGES/stov.po

@@ -176,13 +176,21 @@ msgstr "Schreibe die initiale Konfiguration anhand deiner Eingaben, viel Spaß!"
 msgid "Translation files could not be found, localization won't be available"
 msgstr ""
 
+#: stov.py:65
+msgid "STRG+C has been pressed, quitting..."
+msgstr "STRG+C wurde gedrückt, beende..."
+
+#: stov.py:68
+msgid "Received SIGTERM, quitting..."
+msgstr "SIGTERM wurde empfangen, beende..."
+
 #: stov.py:66
 msgid "option %s requires an integer value"
 msgstr "die Option %s erfordert einen ganzzahligen Wert"
 
 #: stov.py:71
 msgid "option %s requires an argument"
-msgstr "die Option %s erforder ein Argument"
+msgstr "die Option %s erfordert ein Argument"
 
 #: stov.py:75
 msgid "invalid option %s"
@@ -192,6 +200,10 @@ msgstr "ungültige Option %s"
 msgid "Usage: %prog [options]"
 msgstr "Benutzung %prog [Optionen]"
 
+#: stov.py:124
+msgid "show this help message and exit"
+msgstr "zeigt diese Nachricht an und beendet das Programm"
+
 #: stov.py:104
 msgid "Add a new subscription (requires either --search, --channel or --playlist)"
 msgstr "fügt ein neues Abonnement hinzu (erfordert entweder --search, --channel oder --playlist)"
@@ -426,6 +438,10 @@ msgstr "Die Lock-Datei konnte nicht gelöscht werden. Bitte überprüfe, was sch
 msgid "Could not write to database, subscription was NOT deleted. Please check permissions and try again."
 msgstr "Konnte nicht in die Datenbank schreiben, das Abonnement wurde NICHT gelöscht. Bitte überprüfe die Dateiberechtigungen und versuche es erneut."
 
+#: subscription.py:72
+msgid "The subscription could not be found and was therefore not deleted"
+msgstr "Das Abonnement wurde nicht gefunden und wurde daher nicht gelöscht"
+
 #: subscription.py:69
 msgid "Subscription deleted successfully!"
 msgstr "Das Abonnement wurde erfolgreich gelöscht!"

+ 149 - 133
messages.pot

@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2013-03-21 21:39+CET\n"
+"POT-Creation-Date: 2013-04-12 16:56+CEST\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,541 +15,557 @@ msgstr ""
 "Generated-By: pygettext.py 1.5\n"
 
 
-#: configuration.py:57
+#: configuration.py:59
 msgid "the name of your database file"
 msgstr ""
 
-#: configuration.py:58
+#: configuration.py:60
 msgid "the directory where downloaded videos are saved"
 msgstr ""
 
-#: configuration.py:59
+#: configuration.py:61
 msgid "the maximum number of videos to retrieve for each subscription"
 msgstr ""
 
-#: configuration.py:61
+#: configuration.py:63
 msgid "the host of your mail server"
 msgstr ""
 
-#: configuration.py:62
+#: configuration.py:64
 msgid "the address used for notifications"
 msgstr ""
 
-#: configuration.py:63
+#: configuration.py:65
 msgid "the sender address of notification e-mails"
 msgstr ""
 
-#: configuration.py:64
+#: configuration.py:66
 msgid "the port to use on your mail server"
 msgstr ""
 
-#: configuration.py:65
+#: configuration.py:67
 msgid "if your mail server requires authentication"
 msgstr ""
 
-#: configuration.py:66
+#: configuration.py:68
 msgid "the user name used to authenticate to your mail server"
 msgstr ""
 
-#: configuration.py:67
+#: configuration.py:69
 msgid "the password used to authenticate to your mail server"
 msgstr ""
 
-#: configuration.py:68
+#: configuration.py:70
 msgid "the path to your youtube-dl installation"
 msgstr ""
 
-#: configuration.py:69
+#: configuration.py:71
 msgid "if you want to be notified via e-mail about new videos"
 msgstr ""
 
-#: configuration.py:70
+#: configuration.py:72
 msgid "which video codec you prefer (h264, webm or flv)"
 msgstr ""
 
-#: configuration.py:71
+#: configuration.py:73
 msgid "which resolution you prefer (360p, 480p, 720p or 1080p)"
 msgstr ""
 
-#: configuration.py:73
+#: configuration.py:75
 msgid "if you want to compare the title of a video with the subscription search string"
 msgstr ""
 
-#: configuration.py:86
+#: configuration.py:88
 msgid "Opening configuration file"
 msgstr ""
 
-#: configuration.py:90
+#: configuration.py:92
 msgid "Configuration could not be written, please check that the configuration directory exists and is writable"
 msgstr ""
 
-#: configuration.py:95
+#: configuration.py:97
 msgid "Writing value for %s"
 msgstr ""
 
-#: configuration.py:105
+#: configuration.py:107
 msgid "The database could not be created, please check that the configuration directory exists and is writable"
 msgstr ""
 
-#: configuration.py:110
+#: configuration.py:112
 msgid "Creating table subscriptions"
 msgstr ""
 
-#: configuration.py:120
+#: configuration.py:122
 msgid "Creating table videos"
 msgstr ""
 
-#: configuration.py:140
+#: configuration.py:142
 msgid "Creating hidden directory in home for configuration and database"
 msgstr ""
 
-#: configuration.py:145
+#: configuration.py:147
 msgid "Configuration directory could not be created, please check that your home directory exists and is writable"
 msgstr ""
 
-#: configuration.py:149
+#: configuration.py:151
 msgid "Looking for youtube-dl file"
 msgstr ""
 
-#: configuration.py:162
+#: configuration.py:164
 msgid "Opening config file for reading"
 msgstr ""
 
-#: configuration.py:166
+#: configuration.py:168
 msgid "Configuration could not be read, please check that the configuration file exists and is readable"
 msgstr ""
 
-#: configuration.py:170
+#: configuration.py:172
 msgid "Reading line %s"
 msgstr ""
 
-#: configuration.py:183
+#: configuration.py:185
 msgid "Checking current and running configuration version"
 msgstr ""
 
-#: configuration.py:188
+#: configuration.py:190
 msgid "Invalid config version read"
 msgstr ""
 
-#: configuration.py:193
+#: configuration.py:195
 msgid "Found running version: "
 msgstr ""
 
-#: configuration.py:194 configuration.py:218
+#: configuration.py:196 configuration.py:220
 msgid "Current version: "
 msgstr ""
 
-#: configuration.py:213
+#: configuration.py:215
 msgid "Checking current and running database version."
 msgstr ""
 
-#: configuration.py:217
+#: configuration.py:219
 msgid "Found running database version: "
 msgstr ""
 
-#: configuration.py:235
+#: configuration.py:237
 msgid "The database could not be updated, please check that the configuration directory exists and is writable"
 msgstr ""
 
-#: configuration.py:255
+#: configuration.py:257
 msgid "Trying to determine the itag value for youtube-dl from your quality and codec settings"
 msgstr ""
 
-#: configuration.py:286
+#: configuration.py:288
 msgid "Found value: %s"
 msgstr ""
 
-#: configuration.py:293
+#: configuration.py:295
 msgid ""
 "This assistant will help you to perform the initial configuration of stov. \n"
 "The default value will be displayed in brackets.\n"
 "Please specify now :\n"
 msgstr ""
 
-#: configuration.py:306
+#: configuration.py:308
 msgid "Writing initial configuration according to your input, have fun!"
 msgstr ""
 
-#: stov.py:51
+#: stov.py:53
 msgid "Translation files could not be found, localization won't be available"
 msgstr ""
 
-#: stov.py:66
+#: stov.py:65
+msgid "STRG+C has been pressed, quitting..."
+msgstr ""
+
+#: stov.py:68
+msgid "Received SIGTERM, quitting..."
+msgstr ""
+
+#: stov.py:86
 msgid "option %s requires an integer value"
 msgstr ""
 
-#: stov.py:71
+#: stov.py:91
 msgid "option %s requires an argument"
 msgstr ""
 
-#: stov.py:75
+#: stov.py:95
 msgid "invalid option %s"
 msgstr ""
 
-#: stov.py:100
+#: stov.py:120
 msgid "Usage: %prog [options]"
 msgstr ""
 
-#: stov.py:104
+#: stov.py:124
+msgid "show this help message and exit"
+msgstr ""
+
+#: stov.py:126
 msgid "Add a new subscription (requires either --search, --channel or --playlist)"
 msgstr ""
 
-#: stov.py:107
+#: stov.py:129
 msgid "Add a new Playlist subscription (requires add)"
 msgstr ""
 
-#: stov.py:109
+#: stov.py:131
 msgid "List the currently available subscriptions"
 msgstr ""
 
-#: stov.py:111
+#: stov.py:133
 msgid "remove a subscription"
 msgstr ""
 
-#: stov.py:113
+#: stov.py:135
 msgid "update the information about the available videos"
 msgstr ""
 
-#: stov.py:115
+#: stov.py:137
 msgid "download all available videos which haven't already been downloaded"
 msgstr ""
 
-#: stov.py:117
+#: stov.py:139
 msgid "optionally add a search string to a new channel subscription or create a new search subscription (requires --add)"
 msgstr ""
 
-#: stov.py:120
+#: stov.py:142
 msgid "Print all videos from a subscription"
 msgstr ""
 
-#: stov.py:122
+#: stov.py:144
 msgid "Mark all videos from one channel as read (requires subscription-id as argument)"
 msgstr ""
 
-#: stov.py:125
+#: stov.py:147
 msgid "specify a channel for a new subscription (requires --add)"
 msgstr ""
 
-#: stov.py:127
+#: stov.py:149
 msgid "show the license of the program"
 msgstr ""
 
-#: stov.py:129
+#: stov.py:151
 msgid "show the current running version number"
 msgstr ""
 
-#: stov.py:131
+#: stov.py:153
 msgid "Suppress all output"
 msgstr ""
 
-#: stov.py:133
+#: stov.py:155
 msgid "Be verbose and print also diagnostical messages"
 msgstr ""
 
-#: stov.py:135
+#: stov.py:157
 msgid "Clean the database of entries no longer listed in the current API response"
 msgstr ""
 
-#: stov.py:156
+#: stov.py:182
 msgid "--quiet and --verbose can't be defined at the same time, exiting."
 msgstr ""
 
-#: stov.py:176
+#: stov.py:202
 msgid "Lock file could not be opened, please check that it exists and is readable, quitting now"
 msgstr ""
 
-#: stov.py:182
+#: stov.py:208
 msgid ""
 "The lock file already exists, probably anotherinstance of this program is already running\n"
 "if you are sure this is not the case, delete it manually and try again!"
 msgstr ""
 
-#: stov.py:193
+#: stov.py:219
 msgid "Old lock file could not be deleted!"
 msgstr ""
 
-#: stov.py:200
+#: stov.py:226
 msgid "Lock file could not be created, please check that /tmp is writable and properly configured, quitting now"
 msgstr ""
 
-#: stov.py:210
+#: stov.py:236
 msgid "This seems to be the first time you run the programm, do you want to run the interactive assistant? (yes/no)"
 msgstr ""
 
-#: stov.py:218
+#: stov.py:244
 msgid "Writing initial configuration according to default values"
 msgstr ""
 
-#: stov.py:224
+#: stov.py:250
 msgid "Your configuration needs to be updated, performing update now."
 msgstr ""
 
-#: stov.py:229
+#: stov.py:255
 msgid "Your database needs to be updated, performing update now."
 msgstr ""
 
-#: stov.py:251
+#: stov.py:277
 msgid "Found youtube-dl, writing to configuration file."
 msgstr ""
 
-#: stov.py:255
+#: stov.py:281
 msgid "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."
 msgstr ""
 
-#: stov.py:280
+#: stov.py:306
 msgid "Search_"
 msgstr ""
 
-#: stov.py:283
+#: stov.py:309
 msgid "Playlists do not support searching, search option will be ignored!"
 msgstr ""
 
-#: stov.py:289
+#: stov.py:315
 msgid "No valid subscription options given, subscription could not be added"
 msgstr ""
 
-#: stov.py:296
+#: stov.py:322
 msgid "New subscription "
 msgstr ""
 
-#: stov.py:297
+#: stov.py:323
 msgid " successfully added"
 msgstr ""
 
-#: stov.py:304 stov.py:338 stov.py:479 stov.py:503 stov.py:521
+#: stov.py:330 stov.py:364 stov.py:509 stov.py:533 stov.py:551
 msgid "Could not access the database, please check path and permissions and try again!"
 msgstr ""
 
-#: stov.py:312
+#: stov.py:338
 msgid "ID Title"
 msgstr ""
 
-#: stov.py:319
+#: stov.py:345
 msgid "No subscriptions added yet, add one!"
 msgstr ""
 
-#: stov.py:328
+#: stov.py:354
 msgid "Invalid Option, please use the ID of the subscriptionyou want to delete as parameter for the remove option"
 msgstr ""
 
-#: stov.py:358
+#: stov.py:384
 msgid "Could not access the database, please check pathand permissions and try again!"
 msgstr ""
 
-#: stov.py:367
+#: stov.py:393
 msgid "Codec and resolution could not be determined, using maximum possible value"
 msgstr ""
 
-#: stov.py:388
+#: stov.py:414
 msgid "Downloaded %i new video"
 msgstr ""
 
-#: stov.py:389
+#: stov.py:415
 msgid ""
 "The following episode has been downloaded by stov: \n"
 "\n"
 msgstr ""
 
-#: stov.py:391
+#: stov.py:417
 msgid "Downloaded %i new videos"
 msgstr ""
 
-#: stov.py:392
+#: stov.py:418
 msgid ""
 "The following episodes have been downloaded by stov: \n"
 "\n"
 msgstr ""
 
-#: stov.py:403
+#: stov.py:433
 msgid "Could not connect to the smtp server, please check your settings!"
 msgstr ""
 
-#: stov.py:409
+#: stov.py:439
 msgid "TLS not available, proceeding unencrypted"
 msgstr ""
 
-#: stov.py:415
+#: stov.py:445
 msgid "Authentication failed, please check user nameand password!"
 msgstr ""
 
-#: stov.py:419
+#: stov.py:449
 msgid "Could not authenticate, server probably does not support authentication!"
 msgstr ""
 
-#: stov.py:426
+#: stov.py:456
 msgid "The server refused the recipient address, please check your settings"
 msgstr ""
 
-#: stov.py:430
+#: stov.py:460
 msgid "The server refused the sender address, please check your settings"
 msgstr ""
 
-#: stov.py:436
+#: stov.py:466
 msgid "No videos to be downloaded."
 msgstr ""
 
-#: stov.py:440
+#: stov.py:470
 msgid ""
 "The following videos have been downloaded:\n"
 msgstr ""
 
-#: stov.py:446
+#: stov.py:476
 msgid "Could not determine how you want to be informed about new videos, please check the notify parameter in your configuration"
 msgstr ""
 
-#: stov.py:456
+#: stov.py:486
 msgid "Could not access the database, please checkpath and permissions and try again!"
 msgstr ""
 
-#: stov.py:472
+#: stov.py:502
 msgid "Invalid subscription, please check the list and try again"
 msgstr ""
 
-#: stov.py:492
+#: stov.py:522
 msgid "Subscription could not be updated, please check if the ID given is correct"
 msgstr ""
 
-#: stov.py:554
+#: stov.py:587
 msgid "Could not delete the lock file. Please check what went wrong and clean up manually!"
 msgstr ""
 
-#: subscription.py:58
+#: subscription.py:64
 msgid "Could not write to database, subscription was NOT deleted. Please check permissions and try again."
 msgstr ""
 
-#: subscription.py:69
-msgid "Subscription deleted successfully!"
+#: subscription.py:72
+msgid "The subscription could not be found and was therefore not deleted"
 msgstr ""
 
 #: subscription.py:84
+msgid "Subscription deleted successfully!"
+msgstr ""
+
+#: subscription.py:99
 msgid "Could not write to database, new video was NOT added! Please check permissions and try again."
 msgstr ""
 
-#: subscription.py:89
+#: subscription.py:104
 msgid "Checking if video \"%s\" exists in the database"
 msgstr ""
 
-#: subscription.py:94
+#: subscription.py:109
 msgid "You have requested title checking and the title of the video does not match with the search string, ignoring it"
 msgstr ""
 
-#: subscription.py:102
+#: subscription.py:118
 msgid "Video %s not found in database, inserting..."
 msgstr ""
 
-#: subscription.py:123
+#: subscription.py:139
 msgid "Could not access database. Please check permissions and try again."
 msgstr ""
 
-#: subscription.py:127
+#: subscription.py:143
 msgid "Getting all videos for subscription %s from database"
 msgstr ""
 
-#: subscription.py:135
+#: subscription.py:151
 msgid "Got video %s"
 msgstr ""
 
-#: subscription.py:158
+#: subscription.py:174
 msgid "Videos in subscription "
 msgstr ""
 
-#: subscription.py:162
+#: subscription.py:178
 msgid "   (pending)"
 msgstr ""
 
-#: subscription.py:165
+#: subscription.py:181
 msgid "   (downloaded)"
 msgstr ""
 
-#: subscription.py:168
+#: subscription.py:184
 msgid "   (failed)"
 msgstr ""
 
-#: subscription.py:177
+#: subscription.py:193
 msgid "Could not write to database, new subscription was NOT added! Please check permissions and try again."
 msgstr ""
 
-#: subscription.py:183
+#: subscription.py:199
 msgid "Found subscription title %s"
 msgstr ""
 
-#: subscription.py:186
+#: subscription.py:202
 msgid "Directory: %s"
 msgstr ""
 
-#: subscription.py:192
+#: subscription.py:208
 msgid "Writing subscription info into database..."
 msgstr ""
 
-#: subscription.py:202
+#: subscription.py:218
 msgid "Subscription got internal ID %s"
 msgstr ""
 
-#: subscription.py:212
+#: subscription.py:228
 msgid "Connectiong to youtube API."
 msgstr ""
 
-#: subscription.py:215
+#: subscription.py:231
 msgid "Connection established, reading data."
 msgstr ""
 
-#: subscription.py:220
+#: subscription.py:236
 msgid "Could not get API data, maybe the API is down or you have given wrong parameters, please check and try again!"
 msgstr ""
 
-#: subscription.py:226
+#: subscription.py:242
 msgid "Parsing youtube API response."
 msgstr ""
 
-#: subscription.py:249
+#: subscription.py:265
 msgid "None or invalid subscription type given, please check the type option and try again"
 msgstr ""
 
-#: subscription.py:252
+#: subscription.py:268
 msgid "Constructed the following API URL: %s"
 msgstr ""
 
-#: subscription.py:268
+#: subscription.py:284
 msgid "Video %s deleted from the database!"
 msgstr ""
 
-#: subscription.py:272
+#: subscription.py:288
 msgid "Videos %s could not be deleted from the database"
 msgstr ""
 
-#: youtube.py:44
+#: youtube.py:46
 msgid "Creating directory %s"
 msgstr ""
 
-#: youtube.py:48
+#: youtube.py:50
 msgid "Download directory does not exist and can't be created. Please check your configuration and try again"
 msgstr ""
 
-#: youtube.py:55
+#: youtube.py:57
 msgid "Downloading video \"%s\""
 msgstr ""
 
-#: youtube.py:72
+#: youtube.py:74
 msgid "The Video \"%s\" has been downloaded but the status could not be updated in the database. Please check what went wrong and correct it"
 msgstr ""
 
-#: youtube.py:79
+#: youtube.py:81
 msgid "Downloaded video \"%s\", updating database accordingly."
 msgstr ""
 
-#: youtube.py:88
+#: youtube.py:90
 msgid "The video %s could not be downloaded due to some problem with youtube-dl. If this happens to more than one video, please check your youtube-dl version"
 msgstr ""
 
-#: youtube.py:95
+#: youtube.py:97
 msgid "The Video \"%s\" has failed downloading but the status could not be updated in the database. Please check what went wrong and correct it"
 msgstr ""
 
-#: youtube.py:104
+#: youtube.py:106
 msgid "The video \"%s\" has failed downloading too often, marking as failed"
 msgstr ""
 
-#: youtube.py:124
+#: youtube.py:126
 msgid "Could not connect to the database, please check settings and permissions and try again"
 msgstr ""
 

+ 28 - 3
stov.py

@@ -4,7 +4,7 @@
 #stov - a program to subscribe to channels and users from youtube
 #	and download the videos automatically
 #
-#	written by Helmut Pozimski in 2012
+#	written by Helmut Pozimski 2012-2013
 #
 #	This program is free software; you can redistribute it and/or
 #	modify it under the terms of the GNU General Public License
@@ -29,6 +29,7 @@ import sqlite3
 import email
 import smtplib
 import subprocess
+import signal
 from email.mime.multipart import MIMEMultipart
 from email.mime.text import MIMEText
 from optparse import OptionParser
@@ -58,6 +59,21 @@ else:
 	else:
 		trans.install(unicode=True)
 
+"""Define a handler for signals sent to the program"""
+def sighandler(signum, frame):
+	if signum == 2:
+		printf(_("STRG+C has been pressed, quitting..."),
+			outputlevel="default", descriptor="stderr")
+	elif signum == 15:
+		printf(_("Received SIGTERM, quitting..."),
+			outputlevel="default", descriptor="stderr")
+	os.killpg(os.getpid(), 1)
+	os.remove("/tmp/stov.lock")	
+	sys.exit(0)
+
+signal.signal(signal.SIGTERM, sighandler)
+signal.signal(signal.SIGINT, sighandler)
+
 """Overwrite the default OptionParser class so error messages
 can be localized
 
@@ -104,6 +120,8 @@ class MyOptionParser(OptionParser):
 parser = MyOptionParser(usage=_("Usage: %prog [options]"), prog="stov",
 				add_help_option=True, conflict_handler="resolve")
 
+parser.add_option("-h", "--help", action="store_true", dest="help",
+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)"))
@@ -150,6 +168,10 @@ if __name__ != "__main__":
 				please run it directly from command line"""
 	sys.exit(1)
 
+"""Variable to determine if the exit code should be success or not"""
+
+exit_status = True
+
 """Check which outputlevel is defined and save it to a temporary variable
 accordingly. Output generated before this will be printed to stdout regardless
 of the user defined setting
@@ -332,7 +354,7 @@ elif options.deleteid is not None:
 		printf(_("Invalid Option, please use the ID of the subscription"
 			"you want to delete as parameter for the remove option"),
 			outputlevel="default", level=conf.outputlevel, descriptor="stderr")
-	Subscription.Delete()
+	exit_status = Subscription.Delete()
 elif options.update is True:
 	listofsubscriptions = []
 	try:
@@ -557,7 +579,10 @@ else:
 
 try:
 	os.remove("/tmp/stov.lock")
-	sys.exit(0)
+	if exit_status is True:
+		sys.exit(0)
+	else:
+		sys.exit(1)
 except os.error:
 	printf(_("Could not delete the lock file. Please check what "
 				"went wrong and clean up manually!"),

+ 19 - 10
subscription.py

@@ -1,5 +1,5 @@
 #
-#	 This file is part of stov, written by Helmut Pozimski in 2012.
+#	 This file is part of stov, written by Helmut Pozimski 2012-2013.
 #
 # 	stov is free software: you can redistribute it and/or modify
 #	it under the terms of the GNU General Public License as published by
@@ -66,15 +66,24 @@ class sub(object):
 				outputlevel="default", level=self.__conf.outputlevel, descriptor="stderr")
 		else:
 			self.__cursor = self.__connection.cursor()
-			self.__deletevideos = "DELETE FROM videos WHERE subscription_id=?"
-			self.__cursor.execute(self.__deletevideos, (self.__ID,))
-			self.__deletesubscription = "DELETE FROM subscriptions WHERE id=?"
-			self.__cursor.execute(self.__deletesubscription, (self.__ID,))
-			self.__connection.commit()
-
-		printf(_("Subscription deleted successfully!"), outputlevel="default",
-			level=self.__conf.outputlevel, descriptor="stdout")
-		self.__connection.close()
+			self.__checkquery = "SELECT * FROM subscriptions WHERE id=?"
+			self.__checkresult = self.__cursor.execute(self.__checkquery, (self.__ID,))
+			if self.__checkresult.fetchall() == []:
+				printf(_("The subscription could not be found and was therefore "
+					"not deleted"), outputlevel="default", level=self.__conf.outputlevel,
+					descriptor="stderr")
+				self.__connection.close()
+				return False
+			else:
+				self.__deletevideos = "DELETE FROM videos WHERE subscription_id=?"
+				self.__cursor.execute(self.__deletevideos, (self.__ID,))
+				self.__deletesubscription = "DELETE FROM subscriptions WHERE id=?"
+				self.__cursor.execute(self.__deletesubscription, (self.__ID,))
+				self.__connection.commit()
+				self.__connection.close()
+				printf(_("Subscription deleted successfully!"), outputlevel="default",
+					level=self.__conf.outputlevel, descriptor="stdout")
+				return True
 
 	def UpdateVideos(self):
 		"""Retrieves the current videos from the youtube API and adds them

+ 1 - 1
youtube.py

@@ -1,5 +1,5 @@
 #
-#	This file is part of stov, written by Helmut Pozimski in 2012.
+#	This file is part of stov, written by Helmut Pozimski 2012-2013.
 #
 #	stov is free software: you can redistribute it and/or modify
 #	it under the terms of the GNU General Public License as published by