Code Duplication    Length = 39-73 lines in 2 locations

src/Command/TorrentList.php 1 location

@@ 14-86 (lines=73) @@
11
12
class TorrentList extends Command
13
{
14
    protected function configure()
15
    {
16
        parent::configure();
17
        $this
18
            ->setName('torrent-list')
19
            ->setAliases(['tl'])
20
            ->setDescription('List torrents')
21
            ->addOption('name', null, InputOption::VALUE_OPTIONAL, 'Sort by torrent name (regexp)')
22
            ->addOption('age', null, InputOption::VALUE_OPTIONAL, 'Sort by torrent age, ex. \'>1 <5\'')
23
            ->addOption('sort', null, InputOption::VALUE_OPTIONAL, 'Sort by column number', 4)
24
            ->addOption('limit', null, InputOption::VALUE_OPTIONAL, 'Limit torrent list')
25
            ->setHelp(<<<EOT
26
## List torrents
27
28
You can list torrents from transmission with `torrent-list` command:
29
```
30
transmission-cli torrent-list [--sort=column_number] [--name='name'] [--age='>0'] [--limit=10]
31
```
32
33
**List columns:**
34
35
- Name
36
- Id - need for `torrent-remove` command
37
- Age - days from torrent done date
38
- Size - size of downloaded data
39
- Uploaded - size of uploaded data
40
- Per day - average uploaded GB per day
41
42
43
#### Sorting list
44
45
You can sort torrents by `Per day` column and estimate unpopular torrents:
46
```
47
transmission-cli torrent-list --sort=6
48
```
49
50
For reverse sort ordering, add `-` to column number:
51
```
52
transmission-cli torrent-list --sort=-6
53
```
54
55
56
#### Filtering torrent list
57
58
**By age:**
59
```
60
transmission-cli torrent-list --age '>10'
61
transmission-cli torrent-list --age '< 20'
62
transmission-cli torrent-list --age '>0 <5'
63
```
64
65
**By name:**
66
You can use simple regular expression except `.` and `/` symbols.
67
68
Filter FullHD series:
69
```
70
transmission-cli torrent-list --name 'season*1080*'
71
```
72
73
Filter all mkv and avi:
74
```
75
transmission-cli torrent-list --name '.mkv|.avi'
76
```
77
78
#### Limiting torrent list
79
80
Output 10 worst torrents:
81
```
82
transmission-cli torrent-list --sort=6 --limit 10
83
```
84
EOT
85
            );
86
    }
87
88
    protected function execute(InputInterface $input, OutputInterface $output)
89
    {

src/Command/WeburgDownload.php 1 location

@@ 14-52 (lines=39) @@
11
12
class WeburgDownload extends Command
13
{
14
    protected function configure()
15
    {
16
        parent::configure();
17
        $this
18
            ->setName('weburg-download')
19
            ->setAliases(['wd'])
20
            ->setDescription('Download torrents from weburg.net')
21
            ->addOption('download-torrents-dir', null, InputOption::VALUE_OPTIONAL, 'Torrents destination directory')
22
            ->addOption('days', null, InputOption::VALUE_OPTIONAL, 'Max age of series torrent')
23
            ->addOption('popular', null, InputOption::VALUE_NONE, 'Download only popular')
24
            ->addOption('series', null, InputOption::VALUE_NONE, 'Download only tracked series')
25
            ->addArgument('movie-id', null, 'Movie ID or URL')
26
            ->setHelp(<<<EOT
27
## Download torrents from Weburg.net
28
29
You can automatically download popular torrents from http://weburg.net/movies/new out of the box, use command:
30
```
31
transmission-cli weburg-download --download-torrents-dir=/path/to/torrents/directory
32
```
33
34
or define `download-torrents-dir` in config and just:
35
```
36
transmission-cli weburg-download
37
```
38
39
You can automatically download new series, for add series to tracked list see `transmission-cli weburg-series-add`.
40
It is pretty simple:
41
```
42
transmission-cli weburg-series-add http://weburg.net/series/info/12345
43
```
44
45
After that command `weburg-download` also will download series from list for last day.
46
If you don't want to download popular torrents, but only new series, use command:
47
```
48
transmission-cli weburg-download --download-torrents-dir=/path/to/torrents/directory --series
49
```
50
51
## Add downloaded torrents to Transmission
52
53
After download all torrents, command call `torrent-add` command for each transmission-host from config.
54
If was defined `--transmission-host` option, then `torrent-add` will called only for this host.
55
EOT