|
@@ -455,3 +455,32 @@ def print_license():
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
along with stov. If not, see <http://www.gnu.org/licenses/>.""")
|
|
|
+
|
|
|
+
|
|
|
+def download_notify(database, conf):
|
|
|
+ """
|
|
|
+ starts an update of not yet downloaded videos and notifies the user
|
|
|
+
|
|
|
+ :param database: database object
|
|
|
+ :type database: lib_stov.database.Db
|
|
|
+ :param conf: configuration object
|
|
|
+ :type conf: lib_stov.configuration.Conf
|
|
|
+ """
|
|
|
+ videos_downloaded, videos_failed, video_titles = \
|
|
|
+ download_videos(database, conf)
|
|
|
+ if videos_downloaded > 0 and conf.values["notify"] == "yes":
|
|
|
+ msg = compose_email(conf, videos_downloaded, video_titles)
|
|
|
+ send_email(conf, msg)
|
|
|
+ elif videos_downloaded == 0 and videos_failed == 0:
|
|
|
+ if conf.values["notify"] == "no":
|
|
|
+ LOGGER.info(_("There are no videos to be downloaded."))
|
|
|
+ elif conf.values["notify"] == "no":
|
|
|
+ if videos_failed == 0:
|
|
|
+ LOGGER.info(_("The following videos have been downloaded:\n"))
|
|
|
+ for i in video_titles:
|
|
|
+ LOGGER.info(i)
|
|
|
+ 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."))
|