Commit cd2a76f0 authored by prx's avatar prx

major update. Separated lib

parent 9f5cefaa
all:
find . -name '*.pyc' -exec rm '{}' \;
find . -name '*.deb' -exec rm '{}' \;
find . -name '*.tar.gz' -exec rm '{}' \;
find . -name '*.dsc' -exec rm '{}' \;
find . -name '*.changes' -exec rm '{}' \;
find . -name '*.*un\~' -exec rm '{}' \;
#equivs-build eqctl -f
#equivs-build eqctl
#mv *.deb ./site/downloads/dontpanic-latest.deb
# vim:set ft=make:
#!/bin/sh #!/bin/sh
# start dontpanic as single user or the server # start dontpanic as single user or the server
PYTHON=$(which python3) PYTHON=$(which python3.4)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
PYTHON=$(which python) PYTHON=$(which python3)
fi
if [ $? -ne 0 ]; then
PYTHON=$(which python2.7)
fi fi
if [ -d /usr/share/dontpanic ]; then if [ -d /usr/share/dontpanic ]; then
cd /usr/share/dontpanic cd /usr/share/dontpanic
elif [ -d ./src ]; then
cd src
fi fi
if [ -e ./dontpanic.py ]; then if [ -e ./dontpanic.py ]; then
......
No preview for this file type
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#Auteur : thuban <thuban@yeuxdelibad.net> #Auteur : thuban <thuban@yeuxdelibad.net>
REP=~/geek/gitreps/3hg/dontpanic REP=~/geek/gitreps/3hg/dontpanic
OUT=~/geek/gitreps/3hg-website/dontpanic/downloads/ OUT=~/geek/gitreps/3hg/3hg-website/dontpanic/downloads/
if [ -d /tmp/dontpanic ]; then if [ -d /tmp/dontpanic ]; then
rm -rf /tmp/dontpanic rm -rf /tmp/dontpanic
...@@ -14,7 +14,7 @@ cp -r * /tmp/dontpanic ...@@ -14,7 +14,7 @@ cp -r * /tmp/dontpanic
rm -r /tmp/dontpanic/site rm -r /tmp/dontpanic/site
cd /tmp cd /tmp
tar cvzf "dontpanic-latest.tgz" "dontpanic" tar cvzf "dontpanic-latest.tgz" "dontpanic"
mv dontpanic-latest.tgz $OUT mv /tmp/dontpanic-latest.tgz $OUT/
exit exit
...@@ -18,9 +18,9 @@ import sys ...@@ -18,9 +18,9 @@ import sys
from argparse import ArgumentParser from argparse import ArgumentParser
from dontpanic import DontPanic from dontpanic.ui import DontPanic
from i18n import _ from dontpanic.i18n import _
from utils import setup_logging, progname, progversion from dontpanic.utils import setup_logging, progname, progversion
serverlist = ["cgi", "paste", "cherrypy", "tornado", "auto"] serverlist = ["cgi", "paste", "cherrypy", "tornado", "auto"]
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Auteur : thuban <thuban@yeuxdelibad.net>
licence : MIT
Description :
Just watch your favorite show and keep track of them.
"""
import getpass
import sys
import os
from argparse import ArgumentParser
from dontpanic.ui import *
logger = logging.getLogger(__name__)
if __name__ == '__main__':
parser = ArgumentParser(prog=progname, description=_("Dontpanic is a python app to look for any movie or"
" serie and watch them in streaming. It looks like popcorntime"
", but doesn't depend of a centralized api."))
parser.add_argument("-v", "--verbose", action="count", default=0, help=_("Increase output verbosity"))
parser.add_argument("--version", action="version", version=progversion, help=_("Print version"))
parser.add_argument("magnet", nargs='?', action="store", default="", help=_("Stream a magnet link"))
args = parser.parse_args()
setup_logging(args.verbose)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
prepconfig()
port = lock()
# In case if the login contains weird characters
if sys.platform == 'win32' and sys.version_info < (3, 0):
me = getpass.getuser().decode('utf-8', errors='ignore')
else:
me = getpass.getuser()
# a magnet link is passed as argument
mgt = ""
if args.magnet.startswith("magnet:"):
mgt = quoteurl(args.magnet)
if not port: # already running
with open(lock_file, 'r') as l:
port = l.read().strip()
if mgt != "":
webbrowser.open("http://localhost:{}/stream/dontpanic/{}/0".format(port, mgt))
else:
webbrowser.open("http://localhost:{}".format(port))
else:
myapp = DontPanic('localhost', port, me, magnet=mgt)
myapp.run()
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
...@@ -7,7 +7,7 @@ import os ...@@ -7,7 +7,7 @@ import os
import logging import logging
import sys import sys
from utils import confdir from .utils import confdir
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -14,8 +14,8 @@ import logging ...@@ -14,8 +14,8 @@ import logging
import os import os
import sys import sys
from utils import progname, progversion, progurl, get_hash from .utils import progname, progversion, progurl, get_hash
from webutils import do_req_get from .webutils import do_req_get
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding:Utf-8 -*-
""" """
Auteur : thuban <thuban@yeuxdelibad.net>
licence : MIT
Description : Auteur : thuban <thuban@yeuxdelibad.net>
Just watch your favorite show and keep track of them. licence : MIT
""" """
import getpass
import sys
from argparse import ArgumentParser
from bottle import * from bottle import *
from threading import Thread from threading import Thread
import webbrowser import webbrowser
from database import DontPanicDB from .database import DontPanicDB
from i18n import _ from .i18n import _
import locale from .subtitle import Subtitle
from subtitle import Subtitle from .torrentsession import TorrentSession
from torrentsession import TorrentSession from .utils import *
from utils import * from .webutils import *
from webutils import *
if sys.version_info >= (3, 0): if sys.version_info >= (3, 0):
from urllib.parse import quote as quoteurl from urllib.parse import quote as quoteurl
else: else:
from urllib import quote as quoteurl from urllib import quote as quoteurl
logger = logging.getLogger(__name__) import locale
def search2html(keywords, extrawords=' ', searchengine='kickasstorrents', page=0, isserie=0): def search2html(keywords, extrawords=' ', searchengine='kickasstorrents', page=0, isserie=0):
""" """
...@@ -317,6 +309,8 @@ def pick_logo(): ...@@ -317,6 +309,8 @@ def pick_logo():
return "favicon.png" return "favicon.png"
class DontPanic: class DontPanic:
def __init__(self, host, port, admin, adminpw="password", local_=True, magnet=""): def __init__(self, host, port, admin, adminpw="password", local_=True, magnet=""):
self.startperc = None self.startperc = None
...@@ -985,43 +979,3 @@ class DontPanic: ...@@ -985,43 +979,3 @@ class DontPanic:
del session del session
if __name__ == '__main__':
parser = ArgumentParser(prog=progname, description=_("Dontpanic is a python app to look for any movie or"
" serie and watch them in streaming. It looks like popcorntime"
", but doesn't depend of a centralized api."))
parser.add_argument("-v", "--verbose", action="count", default=0, help=_("Increase output verbosity"))
parser.add_argument("--version", action="version", version=progversion, help=_("Print version"))
parser.add_argument("magnet", nargs='?', action="store", default="", help=_("Stream a magnet link"))
args = parser.parse_args()
setup_logging(args.verbose)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
prepconfig()
port = lock()
# In case if the login contains weird characters
if sys.platform == 'win32' and sys.version_info < (3, 0):
me = getpass.getuser().decode('utf-8', errors='ignore')
else:
me = getpass.getuser()
# a magnet link is passed as argument
mgt = ""
if args.magnet.startswith("magnet:"):
mgt = quoteurl(args.magnet)
if not port: # already running
with open(lock_file, 'r') as l:
port = l.read().strip()
if mgt != "":
webbrowser.open("http://localhost:{}/stream/dontpanic/{}/0".format(port, mgt))
else:
webbrowser.open("http://localhost:{}".format(port))
else:
myapp = DontPanic('localhost', port, me, magnet=mgt)
myapp.run()
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
...@@ -16,7 +16,7 @@ if sys.version_info >= (3, 0): ...@@ -16,7 +16,7 @@ if sys.version_info >= (3, 0):
else: else:
import ConfigParser as cp import ConfigParser as cp
from i18n import _ from .i18n import _
#################### ####################
# Global variables # # Global variables #
......
...@@ -4,9 +4,8 @@ import sys ...@@ -4,9 +4,8 @@ import sys
import requests import requests
import bs4 import bs4
from utils import convb from .utils import convb
from .i18n import _
from i18n import _
if sys.version_info >= (3, 0): if sys.version_info >= (3, 0):
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
import logging import logging
import os import os
import subprocess import subprocess
from utils import localedir, podir, progname, setup_logging from dontpanic.i18n import _, i18n_domain
from dontpanic.utils import localedir, podir, progname, setup_logging
from argparse import ArgumentParser from argparse import ArgumentParser
from glob import glob from glob import glob
from i18n import _, i18n_domain
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -20,7 +20,7 @@ def update_pot(): ...@@ -20,7 +20,7 @@ def update_pot():
cmd = ['xgettext', '--language=Python', '--package-name', i18n_domain, cmd = ['xgettext', '--language=Python', '--package-name', i18n_domain,
'--output', '{}/{}.pot'.format(podir, i18n_domain)] '--output', '{}/{}.pot'.format(podir, i18n_domain)]
for path, names, filenames in os.walk(os.curdir): for path, names, filenames in os.walk(os.path.join(os.curdir, "dontpanic")):
for f in filenames: for f in filenames:
if f.endswith('.py'): if f.endswith('.py'):
cmd.append(os.path.join(path, f)) cmd.append(os.path.join(path, f))
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
<h3 style="font-size: 40px;">{{version}}</h3> <h3 style="font-size: 40px;">{{version}}</h3>
<br/><br/><br/><br/> <br/><br/><br/><br/>
<div style="font-size: 25px; line-height:1.15em;">{{ !htmlstuff }}</div> <div style="font-size: 21px; line-height:1.15em;margin-top:1em">{{ !htmlstuff }}</div>
</div> </div>
% include('footer.tpl') % include('footer.tpl')
% include('scripts.tpl') % include('scripts.tpl')
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="middle-center"> <div class="middle-center">
<h1 style="font-size: 50px;">{{title}}</h1> <h1 style="font-size: 50px;">{{title}}</h1>
<br/><br/> <br/><br/>
<div style="font-size: 25px; line-height:1.15em;">{{ !htmlstuff }}</div> <div style="font-size: 25px; line-height:1.15em;margin-top:1em;">{{ !htmlstuff }}</div>
</div> </div>
% include('footer-gb.tpl') % include('footer-gb.tpl')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment