# Path: photobooth/worker/WorkerTask.py
# class WorkerTask:
# 
#     def __init__(self, **kwargs):
# 
#         assert not kwargs
# 
#     def do(self, picture):
# 
#         raise NotImplementedError()


import logging
import requests
from pathlib import Path
from .WorkerTask import WorkerTask
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.





class PictureUploadWebdav(WorkerTask):

    def __init__(self, config):

        super().__init__()

        self._baseurl = config.get('UploadWebdav', 'url')
        if config.getBool('UploadWebdav', 'use_auth'):
            self._auth = (config.get('UploadWebdav', 'user'),
                          config.get('UploadWebdav', 'password'))
        else:
            self._auth = None

    def do(self, picture, filename):


# Path: photobooth/worker/WorkerTask.py
# class WorkerTask:
# 
#     def __init__(self, **kwargs):
# 
#         assert not kwargs
# 
#     def do(self, picture):
# 
#         raise NotImplementedError()


# Path: photobooth/worker/PictureUploadWebdav.py
import logging
import requests
from pathlib import Path
from .WorkerTask import WorkerTask

# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.





class PictureUploadWebdav(WorkerTask):

    def __init__(self, config):

        super().__init__()

        self._baseurl = config.get('UploadWebdav', 'url')
        if config.getBool('UploadWebdav', 'use_auth'):
            self._auth = (config.get('UploadWebdav', 'user'),
                          config.get('UploadWebdav', 'password'))
        else:
            self._auth = None

    def do(self, picture, filename):


        url = self._baseurl + '/' + Path(filename).name