Skip to content

Commit

Permalink
Changed to using command class
Browse files Browse the repository at this point in the history
  • Loading branch information
sdfordham committed Nov 23, 2022
1 parent 43790d1 commit 2c99d87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
21 changes: 8 additions & 13 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from pathlib import Path
from typing import Optional

from .torrent import TorrentData
from .methods import find_files, add_to_transmission
from transmission import TransmissionCommand


def main(
Expand All @@ -28,18 +27,14 @@ def main(
continue
tf.find_data(data_files)
if tf.data:
print(f"Torrent file @ {tf.path}")
print(f" from tracker {tf.tracker}")
print(f"Torrent file @ {tf.path}\n from tracker {tf.tracker}")
if len(tf.data) == 1:
print(f"matched data @ {tf.data[0].parent}")
print(f"Adding to transmission...")
res = add_to_transmission(
add=tf.path,
download_dir=tf.data[0].parent,
username=username,
password=password,
)
print("Response:", res)
download_dir = tf.data[0].parent
print(f"matched data @ {download_dir}\nAdding to transmission...")
cmd = TransmissionCommand()
cmd.add(tf.path).download_dir(download_dir)
res = cmd.auth(username, password).exec()
print("Transmission response:", res)
time.sleep(sleep)
elif len(tf.data) > 1:
uniq_parents = {f.parent for f in tf.data}
Expand Down
2 changes: 1 addition & 1 deletion methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from typing import Optional

from .transmission import TransmissionRow
from transmission import TransmissionRow


def find_files(
Expand Down

0 comments on commit 2c99d87

Please sign in to comment.