Merge branch 'master' of github.com:xdtianyu/scripts

This commit is contained in:
tianyu 2015-06-10 21:36:19 +08:00
commit 232ecdcd5b
3 changed files with 61 additions and 1 deletions

31
u2helper/README-CN.md Normal file
View File

@ -0,0 +1,31 @@
###u2helper###
u2helper 是一个整理transmission下载的脚本
###配置###
重命名 `config.json.example``config.json`
1. 设置 `download_dir` 为你的 transmission 下载位置,与 `download-dir` 一致
2. 设置 `target_dir_parent` 到你要移动到的位置 , 比如: `/mnt/usb`. 然后这个脚本会根据分类自动生成 `/mnt/usb/动漫`, `/mnt/usb/音乐`, `/mnt/usb/字幕` 目录. 你可以在 `transmission.py` `target_dir` 中修改这些名称.
3. 设置 `transmission_url` 到 transmission web rpc 地址, 如 `https://your.doamin.name/transmission/rpc`
4. 设置 `transmission_user``transmission_password` 为 transmission 网页管理用户名和密码
5. 设置 `uid` 为你的 u2 uid
6. 设置 `nexusphp_u2``__cfduid` 为你 u2 cookies.
###用法###
这个脚本依赖 `BeautifulSoup4` and `requests`, 先确保它们已被安装.
1\. 首先获得所你当前做种的信息
`python u2.py`
这一步会生成一个 `seeding.json` 文件, 它包含你的所有做种信息 `标题`, `类`, `副标题`, `文件夹(或文件名)`, `id`, `名称`. 此文件被 `transmission.py` 调用, 每一个种子的抓取过程限制在3秒. 所以抓取60个种子信息会耗时3分钟.
2\. 设置下载位置
`python transmission.py`
这一步会调用 transmission rpc 设置下载位置接口,会自动将文件移动到 `目标父目录/类别名/资源名`。每一个请求会有1秒延时所以移动60个种子会耗时1分钟

View File

@ -1 +1,31 @@
###u2helper###
u2helper is a script for arranging torrents downloaded by transmission.
###config###
rename `config.json.example` to `config.json`
1. set `download_dir` to your transmission `download-dir`
2. set `target_dir_parent` to the directory which you want move the files in, for example: `/mnt/usb`. Then the script will generate `/mnt/usb/动漫`, `/mnt/usb/音乐`, `/mnt/usb/字幕` forders for different catalog. You can modify the names in `transmission.py` `target_dir` by yourself.
3. set `transmission_url` to your transmission web rpc url, e.g. `https://your.doamin.name/transmission/rpc`
4. set `transmission_user` and `transmission_password` to your transmission web rpc username and password
5. set `uid` to your u2 uid
6. set `nexusphp_u2` and `__cfduid` the same as your u2 cookies.
###usage###
This script requires `BeautifulSoup4` and `requests`, make sure your have install them first.
1\. First get the torrent info you are seeding
`python u2.py`
This will generate a file named `seeding.json`, it contains an array of your torrents's `title`, `catalog`, `description`, `folder(or filename)`, `id`, `name`. It's used by `transmission.py`, and each torrent fetch shall be limited in 3 seconds. So it will take 3 minutes to get 60 torrents's info.
2\. Set the location of your files
`python transmission.py`
This will call transmission's rpc set location method, it will move the files to `target_dir_parent/catalog/name`. Each request has a delay for 1 second, so it will take 1 minutes to set all 60 torrents.

View File

@ -66,7 +66,6 @@ for td, table in itertools.izip(td_list, table_list):
torrents.append(json.JSONDecoder().decode(u2torrent.json()))
count += 1
time.sleep(3)
break
torrents_dict["count"] = count
torrents_dict["torrents"] = torrents