Пример #1
0
 def __getattr__(self, name):
     if name == 'fetcher':
         from django.models.aurora import fetchers
         self.fetcher = fetchers.get_object(pk=self.id)
         return self.fetcher
     elif name == 'metainfo':
         from django.models.aurora import metainfos
         self.metainfo = metainfos.get_object(pk=self.id)
         return self.metainfo
     else:
         raise AttributeError, name
Пример #2
0
def pause(request, t_id):
    torrent = get_object_or_404(torrents, pk=t_id)
    torrent.status = 'pa'
    torrent.save()

    try:
        fetcher = fetchers.get_object(pk=torrent.id)
        fetcher.kill_process()
    except fetchers.FetcherDoesNotExist:
        pass

    return HttpResponseRedirect('..')
Пример #3
0
def torrent(request, t_id):
    torrent = get_object_or_404(torrents, pk=t_id)
    try:
        fetcher = fetchers.get_object(pk=torrent.id)
    except fetchers.FetcherDoesNotExist:
        fetcher = None
    msgs = messages.get_list(order_by=['-logged'], limit=30, torrent__id__exact=torrent.id)
    return render_to_response('aurora/torrent', {
            'torrent': torrent,
            'fetcher': fetcher,
            'aurora_messages': msgs,
        })