using webseed torrents, no need for transmission integration anymore
This commit is contained in:
parent
7890183e01
commit
5826e80d35
10 changed files with 0 additions and 129 deletions
|
@ -132,7 +132,6 @@ INSTALLED_APPS = (
|
||||||
'person',
|
'person',
|
||||||
'place',
|
'place',
|
||||||
'text',
|
'text',
|
||||||
'torrent',
|
|
||||||
'edit',
|
'edit',
|
||||||
'news',
|
'news',
|
||||||
'user',
|
'user',
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
|
||||||
|
|
||||||
import os
|
|
||||||
from os.path import join, dirname, basename, splitext, exists
|
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
from ... import daemon
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
|
||||||
"""
|
|
||||||
listen to rabbitmq and execute encoding tasks.
|
|
||||||
"""
|
|
||||||
help = 'listen to rabbitmq and execute encoding tasks.'
|
|
||||||
args = ''
|
|
||||||
|
|
||||||
def handle(self, **options):
|
|
||||||
transmission.startDaemon()
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
from django.db import models
|
|
||||||
|
|
||||||
# Create your models here.
|
|
|
@ -1,23 +0,0 @@
|
||||||
"""
|
|
||||||
This file demonstrates two different styles of tests (one doctest and one
|
|
||||||
unittest). These will both pass when you run "manage.py test".
|
|
||||||
|
|
||||||
Replace these with more appropriate tests for your application.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
class SimpleTest(TestCase):
|
|
||||||
def test_basic_addition(self):
|
|
||||||
"""
|
|
||||||
Tests that 1 + 1 always equals 2.
|
|
||||||
"""
|
|
||||||
self.failUnlessEqual(1 + 1, 2)
|
|
||||||
|
|
||||||
__test__ = {"doctest": """
|
|
||||||
Another way to test that 1 + 1 is equal to 2.
|
|
||||||
|
|
||||||
>>> 1 + 1 == 2
|
|
||||||
True
|
|
||||||
"""}
|
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
|
||||||
from __future__ import with_statement
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
import base64
|
|
||||||
from subprocess import Popen
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
import ox.torrent
|
|
||||||
import transmissionrpc
|
|
||||||
|
|
||||||
|
|
||||||
def connect():
|
|
||||||
return transmissionrpc.Client(settings.TRANSMISSON_HOST,
|
|
||||||
port=settings.TRANSMISSON_PORT,
|
|
||||||
user=settings.TRANSMISSON_USER,
|
|
||||||
password=settings.TRANSMISSON_PASSWORD)
|
|
||||||
|
|
||||||
|
|
||||||
def remove(info_hash):
|
|
||||||
if settings.DEBUG:
|
|
||||||
print 'remove', info_hash
|
|
||||||
if info_hash:
|
|
||||||
try:
|
|
||||||
tc = connect()
|
|
||||||
tc.remove(info_hash.lower())
|
|
||||||
except:
|
|
||||||
if settings.DEBUG:
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
|
|
||||||
def add(torrent_file):
|
|
||||||
download_dir = os.path.dirname(torrent_file)
|
|
||||||
with open(torrent_file) as f:
|
|
||||||
torrent_data = base64.b64encode(f.read())
|
|
||||||
info_hash = ox.torrent.getInfoHash(torrent_file)
|
|
||||||
try:
|
|
||||||
tc = connect()
|
|
||||||
if not is_seeding(info_hash):
|
|
||||||
tc.add(torrent_data, download_dir=download_dir)
|
|
||||||
except:
|
|
||||||
if settings.DEBUG:
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
|
|
||||||
def is_seeding(info_hash):
|
|
||||||
info_hash = info_hash.lower()
|
|
||||||
try:
|
|
||||||
tc = connect()
|
|
||||||
torrents = tc.info(info_hash)
|
|
||||||
except:
|
|
||||||
torrents = False
|
|
||||||
if settings.DEBUG:
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
if torrents:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def start_daemon():
|
|
||||||
try:
|
|
||||||
tc = connect()
|
|
||||||
except:
|
|
||||||
Popen(['transmission-daemon',
|
|
||||||
'-M',
|
|
||||||
'-a', '127.0.0.1',
|
|
||||||
'-r', '127.0.0.1',
|
|
||||||
'-p', str(settings.TRANSMISSON_PORT),
|
|
||||||
'--auth',
|
|
||||||
'-u', settings.TRANSMISSON_USER,
|
|
||||||
'-v', settings.TRANSMISSON_PASSWORD,
|
|
||||||
'-w', settings.MEDIA_ROOT,
|
|
||||||
])
|
|
||||||
time.sleep(1)
|
|
|
@ -1 +0,0 @@
|
||||||
# Create your views here.
|
|
|
@ -13,5 +13,4 @@ django-celery>2.1.1
|
||||||
-e git://github.com/bit/django-extensions.git#egg=django_extensions
|
-e git://github.com/bit/django-extensions.git#egg=django_extensions
|
||||||
-e bzr+http://firefogg.org/dev/python-firefogg/#egg=python-firefogg
|
-e bzr+http://firefogg.org/dev/python-firefogg/#egg=python-firefogg
|
||||||
-e git+git://github.com/dcramer/django-devserver#egg=django_devserver
|
-e git+git://github.com/dcramer/django-devserver#egg=django_devserver
|
||||||
transmissionrpc
|
|
||||||
gunicorn
|
gunicorn
|
||||||
|
|
Loading…
Reference in a new issue