Cross-seed implemented watch_path.

This commit is contained in:
Jon 2021-02-27 06:05:17 -05:00
parent 3a6ca4a38c
commit 56791824ac
2 changed files with 23 additions and 13 deletions

View file

@ -13,9 +13,15 @@ directory:
cross_seed: '/your/path/here/' cross_seed: '/your/path/here/'
# Category/Pathing Parameters # Category/Pathing Parameters
cat: cat:
# <File path keyword>: <Category Name> # <Category Name>
movies: movies # - save_path #Path of your save directory. Can be a keyword or full path
tv: tv # - watch_path #OPTIONAL parameter: where cross_seed will drop the torrents to. (Defaults to save_path if not defined)
movies:
- save_path: '/data/torrents/Movies'
- watch_path: '/data/torrents/watch/Movies'
tv:
- save_path: 'TV'
# Tag Parameters # Tag Parameters
tags: tags:
# <Tracker URL Keyword>: <Tag Name> # <Tracker URL Keyword>: <Tag Name>

View file

@ -116,11 +116,11 @@ def trunc_val(s, d, n=3):
def get_category(path): def get_category(path):
cat_path = cfg["cat"] for cat, attr in cfg["cat"].items():
for i, f in cat_path.items(): for attr_path in attr:
if i in path: if 'save_path' in attr_path and attr_path['save_path'] in path:
category = f category = cat
return category return category
else: else:
category = '' category = ''
logger.warning('No categories matched. Check your config.yml file. - Setting tag to NULL') logger.warning('No categories matched. Check your config.yml file. - Setting tag to NULL')
@ -182,13 +182,17 @@ def cross_seed():
torrentdict = get_torrent_info(torrent_list) torrentdict = get_torrent_info(torrent_list)
for file in cs_files: for file in cs_files:
t_name = file.split("]",2)[2].split('.torrent')[0] t_name = file.split("]",2)[2].split('.torrent')[0]
dest = ''
if t_name in torrentdict: if t_name in torrentdict:
category = torrentdict[t_name]['Category'] category = torrentdict[t_name]['Category']
dest = torrentdict[t_name]['save_path'] dest = os.path.join(torrentdict[t_name]['save_path'],'') #Default save destination to save path if watch_path not defined
for attr_path in cfg["cat"][category]:
#Replace remote directory with local directory if 'watch_path' in attr_path: #Update to watch path if defined
for dir in cfg["remote_dir"]: dest=os.path.join(attr_path['watch_path'],'')
if dir in dest : dest = dest.replace(dir,cfg["remote_dir"][dir]) if "remote_dir" in cfg:
#Replace remote directory with local directory
for dir in cfg["remote_dir"]:
if dir in dest : dest = dest.replace(dir,cfg["remote_dir"][dir])
src = dir_cs + file src = dir_cs + file
dest += file dest += file
categories.append(category) categories.append(category)