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

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