@@ -1,66 +1,59 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import glob
import importlib
import logging
import os
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import threading
import logging
import click
import time

import click
import six
from tqdm import tqdm
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer


import importlib
import glob
import os
import six
from core import CURRENT_PATH, VIDEO_EXT, AUDIO_EXT, initialize
import core
from core import CURRENT_PATH, USERDATA_PATH, VIDEO_EXT, AUDIO_EXT, initialize
# has to be imported after initalize
from core import CONFIG

print'top autoup', CONFIG

log = logging.getLogger(__name__)


class Fsh(FileSystemEventHandler):

def __init__(self, au):
self.au = au

def on_created(self, event):
print('on_created')
self.au.upload(event.src_path)
return event.src_path


class Autoup(object):
""" Class to Auto upload files to your favorite
torrent tracker"""

def __init__(self, config_file=None, watched_paths=None,
def __init__(self, config=None, watched_paths=None,
enabled_sites=None, enabled_clients=None, dry_run=False, report=False,
comment=False, *args, **kwargs): # add kwargs

self._config_file = config_file
# Init_config file
initialize(self._config_file)
# Oh, i feels to dirty # fixme
from core import CONFIG
self.config = CONFIG
#core.CONFIG = CONFIG
if isinstance(config, str):
core.CONFIG = config = initialize(config)

self._config_file = core.CONFIG._config_file
self.config = core.CONFIG
self.comment = comment
self._enabled_sites = self.load_sites(enabled_sites)
self_enabled_clients = self.load_clients(enabled_clients)
self._enabled_clients = self.load_clients(enabled_clients)
self.__watch_paths = watched_paths or self.config.WATCHED_PATHS
self.__watcher = Observer()
self.__watcher = Observer(timeout=10)
self.dry_run = dry_run
self._resport = report

def _load_config(self, section):
pass

def sites(self, path=None):
""" try to load all python in sites folder """
pass

def load_clients(self, enabled_clients=None):
"""Simple function that dynamically loads the torrent sites
@@ -72,11 +65,34 @@ def load_clients(self, enabled_clients=None):
"""

if enabled_clients is None:
enabled_clients = '' # fix me
enabled_clients = self.config.ENABLED_CLIENTS

# If it was passed manually as a cmd line arg
if isinstance(enabled_clients, (six.binary_type, six.text_type)):
enabled_clients = enabled_clients.split()

if not len(enabled_clients):
log.warning('There isnt any enabled torrent clients')

from core.clients import qbt
print self.config.get('qbittorrent')
#enabled_clients = [qbt.Qbittorrent(self.config.get('qbittorrent'))]
clients = []

for name in glob.glob(os.path.join(CURRENT_PATH, 'clients/') + '*.py'):
basename = os.path.splitext(os.path.basename(name))[0]
real_basename = basename
if real_basename == 'qbt':
real_basename = 'qbittorrent'

if not name.startswith('_') and real_basename in enabled_clients:
for k, v in self.config.items():
if k in real_basename:
m = importlib.import_module(
'core.clients.%s' % basename)
my_class = getattr(m, real_basename.capitalize())
c_dict = self.config[k].copy()
if len(c_dict):
clients.append(my_class(**c_dict))

return clients

def load_sites(self, enabled_sites=None):
"""Simple function that dynamically loads the torrent sites
@@ -113,55 +129,73 @@ def load_sites(self, enabled_sites=None):

return sites

def upload(self, media_elements=None, seed=None):
def upload(self, path=None, seed=True):
"""Upload the torrent to the torrent sites
Args:
media_elements (class.mediaelements): If media_elements is omitted
this function will scan the default paths for media_elements
path(string): filepath that the self.scan should use to create find files.
seed(bool)
Returns:
"""

if seed is None:
seed = True # core.CONFIG.SEED # fix me

if media_elements is None:
# default paths
media_elements = self.scan()
else:
media_elements = self.scan(media_elements)
media_elements = self.scan(path)

if not isinstance(media_elements, list):
media_elements = list(media_elements)

# Make media elements from paths
media_elements = self.prepare(media_elements)
media_elements = self.prepare(media_elements, path)
torrent_files = []

for site in self._enabled_sites: # Just add site param to?
for media_element in media_elements:
s, tf = self._upload_site(site, media_element, self.dry_run)
torrent_files.append(tf)
for site in tqdm(self._enabled_sites, desc='Sites:'): # Just add site param to?
for media_element in tqdm(media_elements, desc='torrents:'):
s, tf, scan_path = self._upload_site(site, media_element, self.dry_run)
if tf:
torrent_files.append((tf, scan_path))

if seed is True:
self.seed(torrent_files)

def _upload_site(self, site, media_element, dry_run):

return site.upload(media_element, dry_run=dry_run)

def download(self, torrent, path=None):
""" Download a torrent, intended to be used from cross posting """
pass

def seed(self):
""" start add the torrent to your torrent client """
def seed(self, torrents=None, save_path=None, label=None):
""" Add torrents the torrent clients and creates a progress bars
Args:
torrents(list): A list of tuples with the path to the torrent path and the scan path
save_path(None): Dunno what the fuck this is fore fix plx
Returns:
None
"""

click.echo('Adding torrents to the torrent clients')

for client in tqdm(self._enabled_clients, desc='Torrent clients'):
for t in tqdm(torrents, desc='torrents'):
try:
client.download_torrent(*t)
except Exception as e:
log.exception(e)

print('\n')

def scan(self, paths=None):
""" find the abs path of all the files in the watched paths """
""" find the abs path of all the files in the watched paths
Args:
paths(str, list): path to check if its a file or folder
Returns:
list of file/files
"""
af = []

if paths is None:
@@ -179,67 +213,73 @@ def scan(self, paths=None):

return af

def prepare(self, files):
def prepare(self, files, scan_path=None):
"""Build media elements
Args:
files (list): List of filepaths
scan_path: This is used to set the correct seed location in self.seed
Returns:
list of media_elements
"""
from mediaelements import Video, Audio # fix me, has to be import after the config is initialized
from mediaelements import Video, Audio

def do_files(f):
if os.path.isfile(f):
name, ext = os.path.splitext(os.path.basename(f))
if ext.lower() in VIDEO_EXT:
return Video(f)
return Video(f, scan_path)
elif ext.lower() in AUDIO_EXT:
return Audio(f)
return Audio(f, scan_path)

if os.path.isdir(f):
for root, dirs, files in os.walk(f):
for _f in files:
name, ext = os.path.splitext(os.path.basename(_f))
if ext.lower() in VIDEO_EXT:
return Video(f)
return Video(f, scan_path)
break
elif ext.lower() in AUDIO_EXT:
return Audio(f)
return Audio(f, scan_path)
break

return filter(None, list(do_files(f) for f in files))

def add_watch_path(self, path):
self.__watch_paths.append(path)

def _watch(self):
event_handler = Fsh()
def _watch(self, path=None):
""" Watch files paths for changes. FHS calls scan on the
path that changed thus extracing metadata upload to
the torrent sites seeding to torrent clients
Args:
path(string): File path to watch for changes
Return:
None
"""

event_handler = Fsh(self)
if path:
self.__watch_paths.append(path)

for fp in self.__watch_paths:
self.__watcher.schedule(event_handler, fp, recursive=True)

self.__watcher.start()

try:
while True:
time.sleep(1)
print('***')
time.sleep(5)
except KeyboardInterrupt:
self.__watcher.stop()

self.__watcher.join()

def __watch(self):
thread = threading.Thread(target=self._watch)
thread.daemon = True
thread.start()
#thread.join()

def watch(self):
self._watch()

def test(self):
log.debug('This is a lame test')

@@ -258,21 +298,5 @@ def table(self):
pass



if __name__ == '__main__': # pragma: no cover
pass
#import time
#start = time.time()
AU = Autoup()
AU.load_clients()
#AU.scan()
#AU.sites()
#AU.upload()
#t = time.time() - start
#print('total time was %s' % (t))

#AU.upload_test()
#AU.test_prepare()
#AU.watch()
#AU.test()
# add cli option so its ez to cross post
@@ -1,27 +1,24 @@
import click
import core.autoup
import os
from core import CURRENT_PATH, USERDATA_PATH, initialize, CONFIG


@click.group(context_settings={'max_content_width': 100},
epilog='This tool was a made for education purposes, use on your own risk \n https://github.com/Hellowlol/AutoUp')
@click.option('-w', '--webserver', required=False, is_flag=True)
@click.option('--debug', is_flag=True, default=False, help='Print useful information for debugging autoup and for reporting bugs.')
@click.option('-p', '--profile', required=False, is_flag=True)
@click.option('-d', '--debug', is_flag=True, default=False, help='Print useful information for debugging autoup and for reporting bugs.')
@click.option('-c', '--config', required=False, type=click.Path())
@click.option('-report', required=False, default=False)
@click.option('-r', '-report', required=False, default=False)
@click.option('-dr', '--dry_run', required=False, default=False, is_flag=True)
@click.option('--enabled_sites', type=click.Choice(['all', 'norbits']))
@click.option('--watched_paths', required=False, default=None)
@click.option('--comment', required=False, default=None)
@click.pass_context
def cli(ctx, webserver, debug, config, report, dry_run, enabled_sites, watched_paths, comment):
# make a new config if it dont exist
if config is None:
if not os.path.isfile(os.path.join(USERDATA_PATH, 'config.ini')):
config = initialize(os.path.join(USERDATA_PATH, 'config.ini'))
else:
config = initialize(os.path.join(USERDATA_PATH, 'config.ini'))
def cli(ctx, webserver, profile, debug, config, report, dry_run, enabled_sites, watched_paths, comment):
from core import initialize, CONFIG

CONFIG = initialize(config, lvl=debug)

import core.autoup

if isinstance(enabled_sites, str):
enabled_sites = enabled_sites.split()
@@ -31,7 +28,10 @@ def cli(ctx, webserver, debug, config, report, dry_run, enabled_sites, watched_p

lvl = 'debug' if debug else 'info'

ctx.obj = core.autoup.Autoup(config_file=config,
if profile:
pass

ctx.obj = core.autoup.Autoup(config_file=CONFIG,
enabled_sites=enabled_sites,
watched_paths=watched_paths,
loglevel=lvl,
@@ -53,8 +53,7 @@ def upload(ctx, path):
@click.pass_obj
def watch(ctx, path):
""" """
print('orginal watch %s' % path)
print ctx.watch()
ctx._watch(path)


@cli.command()
@@ -65,5 +64,5 @@ def webserver(ctx, host, port):
ctx.webserver('%s:%s' % (host, port))


#if __name__ == '__main__':
#cli()
# if __name__ == '__main__':
# cli()
@@ -8,11 +8,15 @@ def __init__(self, *args, **kwargs):
self.username = kwargs.get('username', 'admin')
self.password = kwargs.get('password', '123456')
self.url = kwargs.get('url', 'http://127.0.0.1:7777/')
self.qb = None

self.qb = q_client(self.url)
self.qb.login(username=self.username, password=self.password)
try:
self.qb = q_client(self.url)
self.qb.login(username=self.username, password=self.password)
except:
pass

def download_torrent(self, torrent, save_path, label=''):
def download_torrent(self, torrent, save_path, label='', *args, **kwargs):
""" Add a torrent to the torrent client
Args:
@@ -23,15 +27,19 @@ def download_torrent(self, torrent, save_path, label=''):
Returns:
Ok regardsless if fails or not
"""
if any(i for i in ['http', 'magnet:', 'bc://bt/'] if torrent.startswith(i)):
return self.qb.download_from_link(torrent, save_path=save_path, label=label)
if self.qb:

if ',' in torrent: # Assume its a sting, , should never be in a fp anyway
torrent = [open(t, 'rb') for t in torrent.split(',')]
else:
torrent = open(torrent, 'rb')
if any(i for i in ['http', 'magnet:', 'bc://bt/'] if torrent.startswith(i)):
return self.qb.download_from_link(torrent, save_path=save_path, label=label)

return self.qb.download_from_file(torrent, save_path=save_path, label=label)
if ',' in torrent: # Assume its a sting, , should never be in a fp anyway
torrent = [open(t, 'rb') for t in torrent.split(',')]
else:
torrent = open(torrent, 'rb')

# add fix for dirs etc..

return self.qb.download_from_file(torrent, save_path=save_path, label=label)

def get_torrents(self, **kwargs):
r = self.qb.torrents(status='all', limit=9999, **kwargs)
@@ -85,5 +93,7 @@ def get_torrents_for_tracker(self, annonce_url):
from pprint import pprint
start = time.time()
x = Qbittorrent(username='admin', password='123456')
print pprint(x.get_torrents_for_tracker('https://www.norbits.net'))
print(time.time() - start)
#print pprint(x.get_torrents_for_tracker('https://www.norbits.net'))
#print(time.time() - start)

#x.download_torrent(r'C:\Users\steffen\Documents\GitHub\AutoUp\userdata\torrents\Colony.S01E10.1080p.WEB.DL-VietHD.torrent', r'C:\htpc\upload3\Colony.S01E10.1080p.WEB.DL-VietHD')
@@ -1,7 +1,8 @@
import logging
import re

from configobj import ConfigObj
import os


log = logging.getLogger(__name__)

@@ -17,24 +18,23 @@ def bool_int(value):

_CONFIG_DEFINITIONS = {
'LOGLVL': (str, 'general', 'info'),
'WATCHED_PATHS': (list, 'general', ''), #list
'WATCHED_PATHS': (list, 'general', ''), # list
'BLOCKED': (str, 'general', ''),
'MEDIA_INFO_CLI': (str, 'general', 'media_info_cli'), # fullpath or in env path
'MEDIA_INFO_CLI': (str, 'general', 'media_info_cli'), # fullpath or in env path
'EPISODE_SUMMARY': (bool, 'general', False),
'MOVIE_SITES': (bool, 'general', False),
'ENABLED_SITES': (list, 'general', ''),
'ENABLED_CLIENTS': (list, 'general', ''),
'FFMPEG': (str, 'general', 'ffmpeg'),
'DB': (str, 'general', 'C:\Users\steffen\Documents\GitHub\AutoUp\userdata\autoup.db'), # fix me
'DB': (str, 'general', 'C:\Users\steffen\Documents\GitHub\AutoUp\userdata\autoup.db'), # fix me

'IMGUR_CLIENT_ID': (str, 'imgur', '47d69f063752039'), # Use your own.
'IMGUR_CLIENT_ID': (str, 'imgur', '47d69f063752039'), # Use your own.
'IMGUR_CLIENT_SECRET': (str, 'imgur', '34b43ca44eb088ed05f0ae1bbf22edcd489589a0'),

'THETVDB_APIKEY': (str, 'thetvdb', 'C614040AE87171D0'),
'THETVDB_USERNAME': (str, 'thetvdb', 'autoup'),
'THETVDB_USERPASS': (str, 'thetvdb', 'A80D10B8022EBDFE'),



# Norbits
'NORBITS_USERNAME': (str, 'norbits', ''),
'NORBITS_PASSWORD': (str, 'norbits', ''),
@@ -6,11 +6,12 @@
import time
from functools import wraps

from bs4 import BeautifulSoup as bs

import requests
import six.moves.urllib.parse as parse
import concurrent.futures as cf
import itertools
from bs4 import BeautifulSoup as bs

from imgurpython import ImgurClient
import tvdbapi_client
@@ -20,9 +21,6 @@
log = logging.getLogger(__name__)
SESSION = requests.Session()




try:
import lxml
bestparser = 'lxml'
@@ -39,7 +37,7 @@ def inner(*args, **kwargs):
return inner


@timeme
#@timeme
def imdb_aka(s):
""" Simple helper function that parses the result from a imdb aka search to find the correct imdbid
This is only used since alof of the uploaded content is norwegian and
@@ -86,7 +84,7 @@ def imdb_aka(s):
return res


@timeme
#@timeme
def get_media_info(path, format='dict', media_info_cli=None):
""" Note this is media info cli """

@@ -170,15 +168,16 @@ def upload_to_imgurl(fp, name):
'title': name,
'description': ''
}

image = client.upload_from_path(f, config=config, anon=True)
try:
image = client.upload_from_path(f, config=config, anon=True)
links.append((name, '[img]' + image['link'] + '[/img]'))
except:
pass
except Exception as e:
log.error('imgur %s' % e)
return []

return sorted(links)


def shell(cmd):
try:
process = subprocess.Popen(cmd,
@@ -282,7 +281,7 @@ def check_predb(url=None, raw=None):
return parse_predb(bs(r.text, bestparser))


@timeme
#@timeme
def query_predb(search=None, check_all=False, async=False):
""" Query predb to see if something is in the predb
@@ -299,7 +298,7 @@ def query_predb(search=None, check_all=False, async=False):
log.debug('Searching predb for %s' % search)

q_search = parse.quote_plus(search)
r = requests.get('http://predb.me/?search=%s' % q_search)
r = requests.get('http://predb.me/?search=%s' % q_search, timeout=5)
t = []
# Check every pages.. takes alot of time
if check_all is True:
@@ -311,7 +310,7 @@ def query_predb(search=None, check_all=False, async=False):
# there is only one page result but we add two
pages = 2

log.debug('predbme had %s pages' % len(pages))
log.debug('predbme had %s pages' % pages)

urls = ['http://predb.me/?search=%s&page=%s&jsload=1' % (q_search, z) for z in range(1, int(pages))]
# async is useless since we just get blocked with 503
@@ -333,16 +332,15 @@ def query_predb(search=None, check_all=False, async=False):
t.extend(check_predb(raw=r.text))

for srr in itertools.chain(t):
log.debug('%r' % srr)
if srr.get('name') == search:
log.debug('%s was a scene release' % search)
return True
return False

#print query_predb('Billions.S01E02.720p.WEB-DL-NTb.mkv', check_all=True, async=True)



#print query_predb('test', check_all=True, async=True)

@timeme
#@timeme
def query_tvdb(name=None, id=None, imdbId=None, zap2itId=None, season=None, episode=None):
# fuck this use tvmaze..

@@ -387,8 +385,20 @@ def query_tvdb(name=None, id=None, imdbId=None, zap2itId=None, season=None, epis
print(e)
return {}

#@timeme
def get_maze(imdbid=None, season=None, episode=None):
""" """
import pytvmaze
if season or episode:
show = pytvmaze.get_show(imdb_id=imdbid, embed='episodes')
for e in show.episodes:
if e.season_number == season and episode == e.episode_number:
return e.summary


@timeme


#@timeme
def get_imdb(imdbid=None, season=None, episode=None, cache=False, anonymize=False):
""" use this """

@@ -399,12 +409,22 @@ def get_imdb(imdbid=None, season=None, episode=None, cache=False, anonymize=Fals

for ep in imdb.get_episodes(imdbid):
if ep.season == season and ep.episode == episode:
return (ep, imdb.get_title_plots(ep.imdb_id)[0])
overview = imdb.get_title_plots(ep.imdb_id)
if len(overview):
summary = overview[0]
else:
# fallback to
# summary = query_tvdb(imdbId=imdbid, season=season, episode=episode).get('overview', '')
summary = get_maze(imdbid=imdbid, season=season, episode=episode)

return (ep, summary)

#print(get_maze(imdbid='tt4209256', season=1, episode=10))
#print(get_imdb(imdbid='tt4209256', season=1, episode=10))
#print test_imdb(imdbid='tt1796960', season=1, episode=1)
#print get_imdb(imdbid='tt0450232')
#print get_imdb(imdbid='tt4270492', season=1, episode=2)
#print query_tvdb(imdbId='tt1796960', season=1, episode=2)
#print query_tvdb(imdbId='tt4209256', season=1, episode=10)
#make_images_from_video(r'C:\htpc\upload5\Kaptein Sabeltann og skatten i Kjuttaviga\Kaptein.Sabeltann.og.skatten.i.Kjuttaviga.WEBDL-nrkdl.mkv')

if __name__ == '__main__':

This file was deleted.

@@ -17,10 +17,11 @@


class BaseElement(object):
def __init__(self, path, save_torrent_path=None, *args, **kwargs):
def __init__(self, path, scan_path, save_torrent_path=None, *args, **kwargs):
self.type = self.__class__.__name__.lower()
self.name, self.ext = os.path.splitext(path)
self.fp = path
self.scan_path = scan_path
self.save_folder = save_torrent_path
self.torrent_name = None
self.save_torrent_path = save_torrent_path
@@ -70,14 +71,16 @@ def to_base64(self):


class Video(BaseElement):
def __init__(self, path, save_torrent_path=None, *args, **kwargs):
super(self.__class__, self).__init__(path, *args, **kwargs)
def __init__(self, path, scan_path=None, save_torrent_path=None, *args, **kwargs):
super(self.__class__, self).__init__(path, scan_path, *args, **kwargs)
self.type = 'video'
self.fp = path
self.scan_path = scan_path
self.info = {}
self.files = []
self.has_nfo = False
self.has_images = []
self.autoup_added_images = False
self.summary = ''

fps = []
@@ -123,6 +126,7 @@ def extract(self, path=None, rb=None):

# Extact some images from video files
if not self.has_images:
self.autoup_added_images = True
log.debug('This file has no images, gonna try to extract some')
img = [make_images_from_video(k) for k in z]
for zz in img:
@@ -2,12 +2,10 @@
# -*- coding: utf-8 -*-


import json
import os
import sys
from pprint import pprint as pp
import re
import logging


from bs4 import BeautifulSoup as bs
import requests
@@ -16,8 +14,11 @@
from core.database import Database
from core.sites import Site

import logging


log = logging.getLogger(__name__)
print log


class Norbits(Site):
@@ -68,16 +69,16 @@ def login(self, to='/upload.php'):
'returnto': to}

r = self.session.post(self.norbits_login_url, headers=self.headers, data=data)
log.info('Tried to login to Norbits %s' % r.status_code)
log.debug('Tried to login to Norbits %s' % r.status_code)

html = bs(r.text.encode('latin-1'), 'html5lib')
s = html.select('#userinfo')

if len(s):
log.info('Login Norbits success')
log.debug('Login Norbits success')
return True
else:
log.info('Login Norbits error')
log.debug('Login Norbits error')
False

def fetcher(self, path, action='get', data=None, files=None):
@@ -108,25 +109,30 @@ def fetcher(self, path, action='get', data=None, files=None):

return r

def upload(self, data, dry_run, torrent_path=None):
""" Takes a dict or media_element"""
def upload(self, data, dry_run, torrent_path=None, save_path=None):
""" Takes a dict or media_element
Args:
data(BaseElement): 'Class the holds stuff'
dry_run(bool): 'Commandline arg to stop before the upload'
save_path(None): 'useless'
"""

# _.upload expects a dict
if not isinstance(data, dict):
# returns the form..
data, torrent_path = self.prepare(data)
#print 'torrent_path', torrent_path
data, torrent_path, save_path = self.prepare(data)

if dry_run:
log.debug('Didnt upload to site because of dry run')
return data
return data, torrent_path, save_path

# Try to upload
r = self._upload(data)

if r.status_code == 302:
log.debug('302 somehting')
# return self._upload(data)
return data, torrent_path
return data, torrent_path, save_path

def prepare(self, media_element, categories=None, comment=None):
""" Prepare for upload
@@ -143,16 +149,35 @@ def prepare(self, media_element, categories=None, comment=None):
"""
desc = ''

if self.comment or self.norbits_comment:
desc += '%s\n\n' % self.comment or self.norbits_comment

# Allow
if categories is None and not self.categories:
categories = self._build_categories()
#log.debug(pp(self.categories))

log.info('First extract')
me = media_element.extract()

if media_element.has_images:
imgz = upload_to_imgurl(media_element.has_images, os.path.basename(me['filepath']))
imgz = '\n\n'.join([i for z in imgz for i in z])
desc += 'Some Screenshots\n\n'
desc += imgz

if media_element.autoup_added_images:
# Norbits dont like images in the torrents so if
# it was made automatically delete it.
for ii in media_element.has_images:
try:
os.remove(ii)
except OSError:
log.error('Failed to delete %s' % ii)

torrent_info, save_path = media_element.to_torrent()

if media_element.type in ['video', 'episode', 'movie']:

me = media_element.extract()
# This would be the file name or the foldername
filename = os.path.basename(me['filepath'])

@@ -244,14 +269,8 @@ def prepare(self, media_element, categories=None, comment=None):
if fixed_imdb_id:
self.uploadform['infourl'] = (None, 'http://www.imdb.com/title/%s/' % fixed_imdb_id)

if media_element.has_images:
imgz = upload_to_imgurl(media_element.has_images, filename)
imgz = '\n\n'.join([i for z in imgz for i in z])
desc += 'Some Random Screenshots\n\n'
desc += imgz

if me['type'] == 'episode' and query_predb(filename):
log.info('%s was a found on predb, this is a scene release')
log.info('%s was a found on predb, this is a scene release' % filename)

if media_element.type in ['audio', 'song', 'album']:
pass # todo
@@ -261,11 +280,8 @@ def prepare(self, media_element, categories=None, comment=None):
if desc:
self.uploadform['descr'] = (None, desc + ' \n\ntest upload from https://github.com/Hellowlol/AutoUp, do not publish test of images')

#print(self.uploadform['descr'])
#print(self.uploadform)
#print pp(self.uploadform)

return self.uploadform, torrent_info._filepath
return self.uploadform, torrent_info._filepath, media_element.scan_path

def _upload(self, data=None):
response = self.fetcher(self.norbits_upload_url, action='post', files=data)
@@ -331,7 +347,6 @@ def _build_categories(self):

log.debug('Fetching categories from norbits/browse')
html = self.fetcher(self.norbits_cat_url)
print html
site = bs(html.text.encode('utf-8'), "html5lib")

all_cats = {}
@@ -24,7 +24,6 @@ def __init__(self, *args, **kwargs):

@cherrypy.expose
def index(self):
# return some path to f
return 'Hello you!'

@cherrypy.expose