diff --git a/rilis/conf.yaml.ini b/conf.yaml.ini similarity index 100% rename from rilis/conf.yaml.ini rename to conf.yaml.ini diff --git a/rilis/README.md b/rilis/README.md deleted file mode 100644 index 148cc4c..0000000 --- a/rilis/README.md +++ /dev/null @@ -1,30 +0,0 @@ - -# InstalaciĆ³n - -Descarga el zip - -Extraelo a un directorio. - -El directorio debe contener el archivo rilis.exe y el conf.yaml - -Modifica el conf.yaml con los datos correctos. - -abre un CMD - -muevete al directorio donde esta el filis.exe - -`cd C:\Users\crx\Desktop\fansub_rilis\rilis\dist\` - -y ejecuta para ver los comandos: - - -`rilis.exe --help` - - -para ver el ayuda de cada comando - - -`rilis.exe nyaa --help` - - -PD: ** si no sabes usar el CMD no uses esta aplicacion \ No newline at end of file diff --git a/rilis/__init__.py b/rilis/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rilis/anidex.py b/rilis/anidex.py deleted file mode 100644 index 0925059..0000000 --- a/rilis/anidex.py +++ /dev/null @@ -1,30 +0,0 @@ -import requests -import os -from utils import get_conf - -ANIDEX_API_KEY = get_conf("anidex_api_key") -END_POINT = "https://anidex.info/api/" - -ANIME_SUB=1 -ANIME_RAW=2 -ANIME_DUB=3 -LA_SUB=4 -LA_RAW=5 -SPANISH=29 - -### -# curl -F "subcat_id=1" -F "file=@/path/filename.torrent" -F "group_id=1" -F "lang_id=1" -F "api_key=x-xxxxxxxxxxxxxxxxx" https://anidex.info/api/ -def upload_file(torrent_file, subcat_id=ANIME_SUB, lang_id=SPANISH,**kwargs): - torrent_filename = os.path.basename(torrent_file) - files = {'file':(torrent_filename, open(torrent_file, "rb"))} - data = {'subcat_id': subcat_id, 'group_id': 0, - # 'debug':1, - 'lang_id': lang_id, - 'api_key':ANIDEX_API_KEY} - data.update(kwargs) - resp = requests.post(END_POINT, data=data, files=files) - resp_content = resp.content - if 'error' in str(resp_content.lower()): - return False, resp_content - else: - return True, resp_content \ No newline at end of file diff --git a/rilis/frozen.py b/rilis/frozen.py deleted file mode 100644 index b423132..0000000 --- a/rilis/frozen.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# encoding=utf8 -# made by zodman - -import grab -import click -import urllib.parse -import logging -import slugify -from utils import get_conf - -logger = logging.getLogger('grab') -logger.addHandler(logging.StreamHandler()) -logger.setLevel(logging.DEBUG) - - -def _upload_frozen(file, frozen_anime_slug,episode, images): - cfg = get_conf("frozen_layer") - user, passwd = cfg.get("username"), cfg.get("password") - anime_id = frozen_anime_slug - - if not anime_id: - click.secho("No se subio a Frozen-Layer no se encontro fronzen id", bg="red", fg="white") - return - - #robot = grab.Grab(verbose_logging=True, debug=True) - robot = grab.Grab(timeout=1080, connect_timeout=1080) - robot.setup(follow_location=True) - robot.setup(debug_post=True) - robot.go("https://www.frozen-layer.com/users/sign_in") - robot.doc.set_input('user[login]', user) - robot.doc.set_input('user[password]',passwd) - resp = robot.doc.submit() - - if "Has conectado correctamente." in str(robot.response.body): - click.echo("login success") - else: - click.secho("No se subio a Frozen-Layer login failed", bg="red", fg="white") - return - # fansub_id = 827 # Puya+ - fansub_id = cfg.get("fansub_id") # PuyaSUbs - language = 'Japones' - subs = u"EspaƱol" - torrent_file = grab.UploadContent(open(file, "rb").read(), - filename="{}.torrent".format(file) - ) - desc = cfg.get("description") - # magic! - print (torrent_file.filename, desc) - r=robot.go("https://www.frozen-layer.com/descargas/nuevo/anime?id={}".format(anime_id)) - - robot.doc.set_input("descarga[episodio]", u"{}".format(episode)) - robot.doc.set_input("descarga[fansub_id]", str(fansub_id)) - robot.doc.set_input("idioma", language) - robot.doc.set_input("subtitulos", subs) - robot.doc.set_input("descarga[descripcion]",desc) - robot.doc.set_input("torrent", torrent_file) - resp = robot.doc.submit(submit_name="login", remove_from_post=['torrent2',]) - - if "Ha habido un problema" in str(robot.response.body): - click.secho("No se subio a Frozen-Layer", bg="red", fg="white") - click.echo("upload failed") - if images: - url_for_images = robot.doc.select("//div[@id='editar_imagenes']/b/a/@href").text() - url = "https://www.frozen-layer.com{}".format(url_for_images) - for i in images: - ff = grab.UploadContent(open(i).read()) - file = os.path.basename("{}.jpg".format(slugify.slugify(u"{}".format(i)))) - files_to_post = {'Filename':file, 'tipo':'descarga','Filedata':ff,'Upload':'Submit Query'} - robot.go(url,multipart_post=files_to_post) - url = robot.response.url - click.echo("frozen edit url {}".format(url)) - #url = urllib.parse.urlparse(url) - #id = urllib.parse.parse_qs(url.query).get("descarga_id").pop() - return "https://www.frozen-layer.com/descargas/{}".format(id) - diff --git a/rilis/nyaa.py b/rilis/nyaa.py deleted file mode 100644 index ef3efa3..0000000 --- a/rilis/nyaa.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# encoding=utf8 -# made by zodman -import click -import requests -import json -from utils import get_conf -import os -import io - -NYAA_DOMAIN = "https://nyaa.si/" - -def _get_login(): - cfg = get_conf("nyaa") - return cfg.get("username"),cfg.get("password") - - -def upload_torrent(file): - u,p = _get_login() - nyaa_cfg = get_conf("nyaa") - info = nyaa_cfg.get("info") - hidden = nyaa_cfg.get("hidden") - filename = os.path.basename(file).replace(".torrent","") - desc = nyaa_cfg.get("description") - data = { - 'category':"1_3", - 'information': info, - 'description':desc, - 'name':filename, - 'remake':False, - 'anonymous':False, - 'hidden':hidden, - } - encoded_data = {'torrent_data':json.dumps(data)} - f = open(file,"rb") - files = {'torrent': f } - res = requests.post(NYAA_DOMAIN +'api/upload', - data=encoded_data, - files=files, - auth=(u,p)) - click.echo("upload status_code: {}".format(res.status_code)) - if "Upload failed" in str(res.content): - click.echo("failed to upload") - click.echo(str(res.content)) - return - - if res.status_code != 200: - click.echo("failed to upload status_code {}".format(res.status_code)) - click.echo(str(res.content)) - return - elif res.status_code == 461: - click.echo("El torrent ya existe") - return - else: - return res.json().get("id") - - -def upload_nyaa(file): - tid = upload_torrent(file) - if tid is not None: - view_url = NYAA_DOMAIN + "view/{0}".format(tid) - click.secho("{}".format(view_url), fg="green") - return view_url - diff --git a/rilis/rilis.py b/rilis/rilis.py deleted file mode 100644 index 8c079d7..0000000 --- a/rilis/rilis.py +++ /dev/null @@ -1,58 +0,0 @@ -import click -from frozen import _upload_frozen -from nyaa import upload_torrent -from anidex import upload_file as anidex_upload_file -import formic -from utils import get_conf -import os - -@click.group() -def cli(): - pass - -@cli.command() -@click.argument("torrent") -@click.argument("episode") -@click.argument("anime_slug") -@click.option("--images", '-i', multiple=True) -def frozen(torrent, episode, anime_slug, images): - """ - Subir a frozen, recuerda usar comillas en windows para parametros - - Recuerda que seria frozen "file.torrent" 560 "anime_slug" - - Donde anime_slug es "cardcaptor-sakura-clean-card-hen" de la url - https://www.frozen-layer.com/animes/cardcaptor-sakura-clean-card-hen - - """ - _upload_frozen(torrent, anime_slug, episode, images) - - -@cli.command() -@click.option("--subcat_id", default=1) -@click.option("--lang_id", default=29) -@click.option("--torrent_name", default="") -@click.argument("file") -def anidex(subcat_id, lang_id, torrent_name, file): - params = get_conf("anidex") - if not torrent_name: - name = os.path.basename(file).replace(".torrent","") - params.update({'torrent_name': name}) - success, resp = anidex_upload_file(file, subcat_id=subcat_id, - lang_id=lang_id, **params) - if success: - click.echo(resp) - else: - click.echo("FAILED") - click.echo(resp) - -@cli.command() -@click.argument("files", default="output_cr/*.torrent") -def nyaa(files): - """ upload torrent files to NYAA """ - for file in formic.FileSet(include=files): - print(upload_torrent(file)) - - -if __name__ == '__main__': - cli() \ No newline at end of file diff --git a/rilis/tasks.py b/rilis/tasks.py deleted file mode 100644 index 916a4c7..0000000 --- a/rilis/tasks.py +++ /dev/null @@ -1,10 +0,0 @@ -from invoke import task - -@task -def deploy(ctx, up=False): - ctx.run("pyinstaller -F rilis.py") - ctx.run("copy conf.yaml.ini dist\conf.yaml") - ctx.run("copy README.md dist\\ ") - if up: - ctx.run("7z a rilis.zip dist\\") - ctx.run("curl --progress-bar -T rilis.zip transfer.sh -k -L") \ No newline at end of file diff --git a/rilis/utils.py b/rilis/utils.py deleted file mode 100644 index 39ecdac..0000000 --- a/rilis/utils.py +++ /dev/null @@ -1,27 +0,0 @@ -import os -import yaml -import click -import sys - -if getattr(sys, 'frozen', False): - application_path = os.path.dirname(sys.executable) -elif __file__: - application_path = os.path.dirname(__file__) - -ROOT_DIR = BASE_DIR = application_path - -def get_conf(section=None): - path_file = os.path.join(ROOT_DIR, "conf.yaml") - click.echo("try to open {}".format(path_file)) - if not os.path.exists(path_file): - raise Exception("File {} not found".format(path_file)) - content = yaml.load(open(path_file).read()) - if not section: - return content - else: - return content.get(section) - - -if __name__ == '__main__': - get_conf() - pass \ No newline at end of file