Esempio n. 1
0
 def render_GET(self, request):
     manager = self.get_manager(request)
     dl = manager.get_download(self.id)
     store = request.application.get_store()
     user = self.get_user(request)
     libs = store.find(models.Library, models.Library.user_id == user.id)
     if dl.mime_type:
         template = 'downloads/detail_%s.html' % dl.mime_type.replace(
             '/', '_')
     else:
         template = 'downloads/detail.html'
     downloadClient = manager.get_download_client(dl.id, True)
     context = {
         'title': dl.description,
         'download': dl,
         'libraries': organizer.get_media_libraries(libs),
         'mediatypes': organizer.get_media_types(),
         'client': downloadClient,
         'statuscode': download.Status,
         'statusdesc': download.Status.descriptions
     }
     try:
         request.templateFactory.get_template(template)
         return self.render_template(template, request, context)
     except Exception:
         return self.render_template('downloads/detail.html', request,
                                     context)
Esempio n. 2
0
 def render_GET(self, request):
     manager = self.get_manager(request)
     userlibs = manager.get_libraries()
     userdir = manager.get_library_directory()
     context = {
         'title': 'Media Locations',
         'basedir': userdir,
         'mediatypes': organizer.get_media_types(),
         'patterns': organizer.get_file_patterns(),
         'libraries': organizer.get_media_libraries(userlibs)
     }
     return self.render_template('libraries/index.html', request, context)
Esempio n. 3
0
 def render_GET(self, request):
     manager = self.get_manager(request)
     userlibs = manager.get_libraries()
     userdir = manager.get_library_directory()
     context = {
         'title': 'Media Locations',
         'basedir': userdir,
         'mediatypes': organizer.get_media_types(),
         'patterns': organizer.get_file_patterns(),
         'libraries': organizer.get_media_libraries(userlibs)
     }
     return self.render_template('libraries/index.html', request, context)
Esempio n. 4
0
    def render_POST(self, request):
        manager = self.get_manager(request)
        mediatype = request.args['media_type']
        directory = request.args['directory']
        keepall = request.args['keep']
        pattern = request.args['pattern']

        libraries = organizer.get_media_libraries(manager.get_libraries())
        for i in range(0, len(mediatype)):
            if not libraries[mediatype[i]]:
                l = models.Library()
                l.user = self.get_user(request)
                l.media_type = unicode(mediatype[i])
                manager.store.add(l)
                libraries[mediatype[i]] = l
            libraries[mediatype[i]].directory = unicode(directory[i])
            libraries[mediatype[i]].pattern = unicode(pattern[i])
            libraries[mediatype[i]].keepall = (keepall[i] == '1')
        manager.store.commit()
        request.redirect('/')
        request.finish()
        return server.NOT_DONE_YET
Esempio n. 5
0
    def render_POST(self, request):
        manager = self.get_manager(request)
        mediatype = request.args['media_type']
        directory = request.args['directory']
        keepall = request.args['keep']
        pattern = request.args['pattern']

        libraries = organizer.get_media_libraries(manager.get_libraries())
        for i in range(0, len(mediatype)):
            if not libraries[mediatype[i]]:
                l = models.Library()
                l.user = self.get_user(request)
                l.media_type = unicode(mediatype[i])
                manager.store.add(l)
                libraries[mediatype[i]] = l
            libraries[mediatype[i]].directory = unicode(directory[i])
            libraries[mediatype[i]].pattern = unicode(pattern[i])
            libraries[mediatype[i]].keepall = (keepall[i] == '1')
        manager.store.commit()
        request.redirect('/')
        request.finish()
        return server.NOT_DONE_YET
Esempio n. 6
0
 def render_GET(self, request):
     manager = self.get_manager(request)
     dl = manager.get_download(self.id)
     store = request.application.get_store()
     user = self.get_user(request)
     libs = store.find(models.Library, models.Library.user_id == user.id)
     if dl.mime_type:
         template = 'downloads/detail_%s.html' % dl.mime_type.replace('/', '_')
     else:
         template = 'downloads/detail.html'
     downloadClient = manager.get_download_client(dl.id, True)
     context = {'title': dl.description,
                'download': dl,
                'libraries': organizer.get_media_libraries(libs),
                'mediatypes': organizer.get_media_types(),
                'client': downloadClient,
                'statuscode': download.Status,
                'statusdesc': download.Status.descriptions
                }
     try:
         request.templateFactory.get_template(template)
         return self.render_template(template, request, context)
     except Exception:
         return self.render_template('downloads/detail.html', request, context)