123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- # This file is part of stov, written by Helmut Pozimski in 2014.
- #
- # 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/>.
- # -*- coding: utf8 -*-
- from __future__ import unicode_literals
- class DBConnectionFailedException(Exception):
- """ This exception will be raised when the initial connetion attempt
- to the database fails.
- """
- def __init__(self):
- self.__message = _("Could not access the database, please check path"
- " and permissions and try again!")
- def __str__(self):
- return self.__message
- class DBWriteAccessFailedException(Exception):
- """This exception will be raised when a write access to the database fails
- (e.g. when the database file permissions are set to read only).
- """
- def __init__(self):
- self.__message = _("Write access to the database failed, please check "
- "file permissions and the file system and try"
- " again!")
- def __str__(self):
- return self.__message
- class SubscriptionNotFoundException(Exception):
- """This exception will be raised when a requested subscription can't be
- found in the database
- """
- def __init__(self):
- self.__message = _("The subscription you requested could not be "
- "found in the database, requested action aborted.")
- def __str__(self):
- return self.__message
- class NoDataFromYoutubeAPIException(Exception):
- """This exception will be raised when the Connection to the youtube API
- failed or no data was returned
- """
- def __init__(self):
- self.__message = _("The connection to the youtube API failed or "
- "no data was returned.")
- def __str__(self):
- return self.__message
- class YoutubeAPITimeoutException(Exception):
- """This exception will be raised when an API request times out"""
- def __init__(self, title):
- self.__message = _("The API Request timed out for subscription %s,"
- "please try again later.") % title
- def __str__(self):
- return self.__message
- class ConfigFileWriteErrorException(Exception):
- """This exception will be raised when a write access to the configuration
- file fails.
- """
- def __init__(self):
- self.__message = _("The configuration could not be written, please"
- " check that the configuration direcroty exists"
- " and is writable.")
- def __str__(self):
- return self.__message
- class DirectoryCreationFailedException(Exception):
- """This exception will be raised when the creation of a directory failed.
- """
- def __init__(self):
- self.__message = _("The directory could not be created, "
- "please check that the parent directory "
- "exists and is writable")
- def __str__(self):
- return self.__message
- class ConfigFileReadErrorException(Exception):
- """This exception will be raised when the configuration file couldn't be
- opened for reading
- """
- def __init__(self):
- self.__message = _("The configuration could not be read, please check "
- "that the configuration file exists and is "
- "readable.")
- def __str__(self):
- return self.__message
- class InvalidConfigurationVersionException(Exception):
- """This exception will be raised when an invalid configuration version
- is detected.
- """
- def __init__(self):
- self.__message = _("Invalid config version read.")
- def __str__(self):
- return self.__message
- class SubscriptionDisabledException(Exception):
- """This exception will be raised when an exception is disabled and
- a requested action is not taken because of this fact.
- """
- def __init__(self, subscription):
- self.__message = _("The subscription %s is disabled, videos will"
- " not be downloaded.") % subscription
- def __str__(self):
- return self.__message
- class DownloadDirectoryCreationFailedException(Exception):
- """This exception will be raised when the creation of a subscription
- directory to download a video failed.
- """
- def __init__(self):
- self.__message = _("The download directory does not exist and can't "
- "be created. Please check your configuration and "
- "try again.")
- def __str__(self):
- return self.__message
|