Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactoring

  • Loading branch information...
commit 73b705c472665828608125e08c13158f98666858 1 parent a1dded5
@adw0rd authored
View
17 README.rst
@@ -5,10 +5,19 @@ Wraps the Torrent Stream http://torrentstream.org/
Installation
-------------
-::
+
+Application is still in alpha, so you can install so::
pip install -e git://github.com/adw0rd/django-torrent-stream.git#egg=torrent_stream
+
+Add to ``settings.py``::
+
+ TORRENT_STREAM_AFFILIATE_KEY = "<HASH>"
+ TORRENT_STREAM_ZONE_ID = <DIGIT>
+
+These ``KEY`` and ``ID`` you can get on a page http://acestream.net/affiliate/
+
Usage
---------
@@ -21,12 +30,12 @@ For example, you have a model Torrent::
Then you can get the ``CONTENT_ID`` like this::
from app.models import Torrent
- from torrent_stream import get_content_id
+ from torrent_stream.helpers import get_content_id
torrent_obj = Torrent.objects.get(pk=42)
# Enough to transmit the content of the torrent file
content_id = get_content_id(torrent_obj.content.read())
- # You can also pass the name of the torrent, and the duration to display the data in the player
- content_id = get_content_id(torrent_obj.content.read(), torrent_obj.name, duration_on_seconds)
+ # Or you can also pass the name of the torrent, and the duration to display the data in the player
+ content_id = get_content_id(torrent_obj.content.read(), torrent_obj.name, duration_in_seconds)
View
35 setup.py
@@ -0,0 +1,35 @@
+from setuptools import setup
+from torrent_stream import __version__
+
+long_description = ""
+try:
+ readme = open("README.rst")
+ long_description = str(readme.read())
+ readme.close()
+except:
+ pass
+
+setup(
+ name='django-torrent-stream',
+ version=__version__,
+ description="Wraps the Torrent Stream http://torrentstream.org/",
+ long_description=long_description,
+ keywords='django, torrent, torrent stream',
+ author='Mikhail Andreev',
+ author_email='x11org@gmail.com',
+ url='http://github.com/adw0rd/django-torrent-stream',
+ license='BSD',
+ packages=['torrent_stream', ],
+ install_requires=['requests', ],
+ zip_safe=False,
+ include_package_data=True,
+ classifiers=[
+ "Development Status :: 3 - Alpha",
+ "Environment :: Web Environment",
+ "Programming Language :: Python",
+ "Framework :: Django",
+ "License :: OSI Approved :: BSD License",
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ ],
+)
View
17 torrent_stream/__init__.py
@@ -1,16 +1 @@
-from django.conf import settings
-from api import TorrentStreamAPI
-
-
-def get_content_id(torrent_data, content_name="", duration=""):
- """Return content id by torrent data
- @param string torrent_data - Content of torrent file
- @param string content_name - Name of video, example "My home video" (optional)
- @param integer duration - Duration of video in seconds (optional)
- @return integer
-
- @see http://acestream.net/affiliate/index.php
- """
- api = TorrentStreamAPI(settings.TORRENT_STREAM_AFFILIATE_KEY, settings.TORRENT_STREAM_ZONE_ID)
- content_id = api.get_content_id(torrent_data, content_name, duration)
- return content_id
+__version__ = "0.1"
View
15 torrent_stream/helpers.py
@@ -0,0 +1,15 @@
+from django.conf import settings
+from api import TorrentStreamAPI
+
+
+def get_content_id(torrent_data, content_name="", duration=""):
+ """Return content id by torrent data
+ @param string torrent_data - Content of torrent file
+ @param string content_name - Name of video, example "My home video" (optional)
+ @param integer duration - Duration of video in seconds (optional)
+
+ @return integer
+ """
+ api = TorrentStreamAPI(settings.TORRENT_STREAM_AFFILIATE_KEY, settings.TORRENT_STREAM_ZONE_ID)
+ content_id = api.get_content_id(torrent_data, content_name, duration)
+ return content_id
Please sign in to comment.
Something went wrong with that request. Please try again.