download_tv 2.6.0 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +35 -0
- data/.gitignore +2 -1
- data/CHANGELOG.md +208 -0
- data/README.md +22 -19
- data/bin/tv +10 -8
- data/download_tv.gemspec +3 -1
- data/lib/download_tv.rb +1 -1
- data/lib/download_tv/configuration.rb +21 -40
- data/lib/download_tv/downloader.rb +61 -81
- data/lib/download_tv/grabbers/eztv.rb +7 -18
- data/lib/download_tv/grabbers/torrentapi.rb +11 -13
- data/lib/download_tv/grabbers/torrentz2.rb +27 -0
- data/lib/download_tv/linkgrabber.rb +4 -3
- data/lib/download_tv/myepisodes.rb +2 -2
- data/lib/download_tv/torrent.rb +9 -17
- data/lib/download_tv/version.rb +1 -1
- data/test/config_test.rb +29 -31
- data/test/downloader_test.rb +23 -23
- data/test/grabbers_test.rb +11 -11
- data/test/torrent_test.rb +5 -5
- metadata +40 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3bb73c3cccddd294060908acd7d79d619b1af0927aa51b5c7b7ac04aff6dd20
|
4
|
+
data.tar.gz: ea159d175a5bcdc1bdf71c35264756ee41d7da2d9b53aa7169258c37926279cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f052f503bea9ceec1c5010b174680cd9efeb5f657d0db0747018cc232c2a66468e394a574776231472cb3506adf0f3a01def502e0adaa9dd86aa39a42e3328d4
|
7
|
+
data.tar.gz: 3a5d5d52294d770adc7c73879568c3ccfb88d7e88110bb78d02e7671b883cf8be88ad4e54e2c951d15f8508529d464b5014b4525068982c88598d80ae037830c
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- name: Set up Ruby
|
27
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
+
# uses: ruby/setup-ruby@v1
|
30
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- name: Run tests
|
35
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
# download_tv CHANGELOG
|
2
|
+
|
3
|
+
## 2.6.5 (2021-06-10)
|
4
|
+
|
5
|
+
* Fixes
|
6
|
+
* Bump HTTP read timeout to avoid errors on new grabber.
|
7
|
+
|
8
|
+
## 2.6.4 (2021-06-07)
|
9
|
+
|
10
|
+
* Grabbers
|
11
|
+
* Torrentz: added Torrentz2 grabber.
|
12
|
+
|
13
|
+
## 2.6.3 (2021-05-24)
|
14
|
+
|
15
|
+
* Fixes
|
16
|
+
* Fix download full season feature (`-s/--season`), inadvertently broken in 2.6.2.
|
17
|
+
|
18
|
+
## 2.6.2 (2021-05-20)
|
19
|
+
|
20
|
+
* Fixes
|
21
|
+
* Avoid duplicate downloads when using `-t` and `-o` together.
|
22
|
+
|
23
|
+
* Improvements
|
24
|
+
* Add `-s` shorthand to the `--season` flag.
|
25
|
+
|
26
|
+
## 2.6.1 (2020-09-22)
|
27
|
+
|
28
|
+
* Features
|
29
|
+
* Add `-q/--queue` to manually add an episode to the pending list.
|
30
|
+
|
31
|
+
* Improvements
|
32
|
+
* Gracefully exits after option parsing errors.
|
33
|
+
|
34
|
+
* Grabbers
|
35
|
+
* EZTV: now sorts torrents by number of seeders.
|
36
|
+
* ThePirateBay: disable grabber.
|
37
|
+
|
38
|
+
## 2.5.5 (2019-04-06)
|
39
|
+
|
40
|
+
* Features
|
41
|
+
* Allow user to configure include/exclude filters of the results.
|
42
|
+
|
43
|
+
* Improvements
|
44
|
+
* The `-t/--tomorrow` flag now also performs a normal run if needed.
|
45
|
+
|
46
|
+
## 2.5.4 (2019-01-19)
|
47
|
+
|
48
|
+
* Features
|
49
|
+
* Add `--season` to try and sequentially download all episodes of the given show, for the given season.
|
50
|
+
* Add `-t/--tomorrow` to download the shows airing in the current day.
|
51
|
+
|
52
|
+
## 2.5.3 (2018-12-14)
|
53
|
+
|
54
|
+
* Fixes
|
55
|
+
* Fix bug preventing clearing pending shows from working properly.
|
56
|
+
|
57
|
+
## 2.5.2 (2018-12-10)
|
58
|
+
|
59
|
+
* Fixes
|
60
|
+
* Changing the configuration no longer resets the list of pending downloads.
|
61
|
+
|
62
|
+
## 2.5.1 (2018-12-03)
|
63
|
+
|
64
|
+
* Fixes
|
65
|
+
* Fix pending shows handling.
|
66
|
+
|
67
|
+
## 2.5.0 (2018-12-02)
|
68
|
+
|
69
|
+
* Fixes
|
70
|
+
* Fix not detecting successful MyEpisodes login.
|
71
|
+
* Fix not detecting non-backwards compatible version changes.
|
72
|
+
* Fix names not being sanitised when downloading through `-d/--download`
|
73
|
+
* Fix names not being sanitised when downloading through `-f/--file`
|
74
|
+
|
75
|
+
* Features
|
76
|
+
* Persist list of episodes not found in the configuration.
|
77
|
+
* Add `-p/--pending` to show the list of pending downloads.
|
78
|
+
* Add `--clear-pending` to empty the list of pending downloads.
|
79
|
+
|
80
|
+
* Grabbers
|
81
|
+
* KAT: disable grabber.
|
82
|
+
|
83
|
+
## 2.4.7 (2018-10-05)
|
84
|
+
|
85
|
+
* Grabbers
|
86
|
+
* KAT: re-enable grabber, updating rules for new CSS structure.
|
87
|
+
|
88
|
+
## 2.4.6 (2018-07-19)
|
89
|
+
|
90
|
+
* Grabbers
|
91
|
+
* KAT: disable grabber.
|
92
|
+
|
93
|
+
## 2.4.5 (2018-05-04)
|
94
|
+
|
95
|
+
* Grabbers
|
96
|
+
* TorrentAPI: now sorts by seeders.
|
97
|
+
|
98
|
+
## 2.4.4 (2018-03-22)
|
99
|
+
|
100
|
+
* Grabbers
|
101
|
+
* TorrentAPI: fix timeouts.
|
102
|
+
|
103
|
+
## 2.4.3 (2018-03-22)
|
104
|
+
|
105
|
+
* Fixes
|
106
|
+
* Fix new trackers' availability not being checked before attempting to use them.
|
107
|
+
|
108
|
+
## 2.4.2 (2018-03-14)
|
109
|
+
|
110
|
+
* Fixes
|
111
|
+
* Fix bug where the wrong grabber was being removed when offline.
|
112
|
+
|
113
|
+
## 2.4.1 (2018-03-12)
|
114
|
+
|
115
|
+
* Fixes
|
116
|
+
* Fix bug accessing wrong variable when a grabber was offline.
|
117
|
+
|
118
|
+
## 2.4.0 (2018-03-04)
|
119
|
+
|
120
|
+
* Fixes
|
121
|
+
* Fix not reporting "Nothing to download" when it was due to ignored shows.
|
122
|
+
* Fix downloading from file not handling newlines well.
|
123
|
+
|
124
|
+
* Improvements
|
125
|
+
* Reset grabber order after every download.
|
126
|
+
|
127
|
+
* Grabbers
|
128
|
+
* KAT: fix parsing rules.
|
129
|
+
* ThePirateBay: change proxy URL.
|
130
|
+
|
131
|
+
## 2.3.0 (2017-09-24)
|
132
|
+
|
133
|
+
* Improvements
|
134
|
+
* Store configuration file as JSON instead of Marshaling the hash.
|
135
|
+
* Use custom User-Agent for all connections.
|
136
|
+
|
137
|
+
* Grabbers
|
138
|
+
* ThePirateBay: change proxy URL.
|
139
|
+
|
140
|
+
## 2.2.2 (2017-08-06)
|
141
|
+
|
142
|
+
* Fixes
|
143
|
+
* Fix date not being saved in the configuration.
|
144
|
+
|
145
|
+
## 2.2.1 (2017-08-03)
|
146
|
+
|
147
|
+
* Add LICENSE.md to repo
|
148
|
+
|
149
|
+
* Fixes
|
150
|
+
* Fix default grabber not being properly selected.
|
151
|
+
|
152
|
+
* Improvements
|
153
|
+
* Add support for OS X.
|
154
|
+
|
155
|
+
* Grabbers
|
156
|
+
* TorrentAPI: add temporary workaround for CloudFlare errors.
|
157
|
+
|
158
|
+
## 2.2.0 (2017-08-01)
|
159
|
+
|
160
|
+
* Add LICENSE information to Gemfile
|
161
|
+
* Move default path to configuration file to `~/.config/download_tv/config`
|
162
|
+
|
163
|
+
* Improvements
|
164
|
+
* Improve detection of ignored shows.
|
165
|
+
|
166
|
+
## 2.1.1 (2017-07-31)
|
167
|
+
|
168
|
+
* Improvements
|
169
|
+
* Minor improvements to configuration file handling.
|
170
|
+
|
171
|
+
## 2.1.0 (2017-07-21)
|
172
|
+
|
173
|
+
* Features
|
174
|
+
* Add `-g/--grabber` to select which grabber to use for finding links.
|
175
|
+
* Add `--show-grabbers` to list available options.
|
176
|
+
* Add `-v` to print gem version.
|
177
|
+
|
178
|
+
* Grabbers
|
179
|
+
* KAT: added KickAssTorrents grabber.
|
180
|
+
|
181
|
+
## 2.0.6 (2017-07-11)
|
182
|
+
|
183
|
+
* Improvements
|
184
|
+
* Remove colons from the show name for searching.
|
185
|
+
|
186
|
+
## 2.0.5 (2017-06-17)
|
187
|
+
|
188
|
+
* Features
|
189
|
+
* Add `--show-config` to print contents of the configuration file in a readable way.
|
190
|
+
|
191
|
+
* Fixes
|
192
|
+
* Fix download from file not properly finding the path.
|
193
|
+
|
194
|
+
## 2.0.3 (2017-06-07)
|
195
|
+
|
196
|
+
* Fixes
|
197
|
+
* Fix missing arguments breaking the main entrypoint.
|
198
|
+
* Fix ignored shows list not handling multiple comma-separated shows.
|
199
|
+
* Minor fixes on configuration file.
|
200
|
+
|
201
|
+
## 2.0.0 (2017-06-07)
|
202
|
+
|
203
|
+
* Features
|
204
|
+
* Add new configuration system.
|
205
|
+
|
206
|
+
## 1.0.0 (2017-06-07)
|
207
|
+
|
208
|
+
Initial published version.
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# download_tv
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Ruby](https://github.com/guille/download_tv/actions/workflows/ruby.yml/badge.svg?branch=master)](https://github.com/guille/download_tv/actions/workflows/ruby.yml)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/download_tv.svg)](https://badge.fury.io/rb/download_tv)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/guille/download_tv.svg)](https://codeclimate.com/github/guille/download_tv)
|
6
6
|
|
7
|
-
download_tv is a tool that allows the user to find magnet links for TV show episodes. It accepts shows as arguments, from a file or it can integrate with your MyEpisodes account.
|
7
|
+
**download_tv** is a tool that allows the user to find magnet links for TV show episodes. It accepts shows as arguments, from a file or it can integrate with your MyEpisodes account.
|
8
8
|
|
9
9
|
### Installation
|
10
10
|
|
@@ -21,67 +21,70 @@ Specific options:
|
|
21
21
|
-o, --offset OFFSET Move back the last run offset
|
22
22
|
-f, --file PATH Download shows from a file
|
23
23
|
-d, --download SHOW Downloads given show
|
24
|
-
|
24
|
+
-s, --season SEASON Limit the show download to a specific season
|
25
25
|
-t, --tomorrow Download shows airing today
|
26
26
|
-c, --configure Configures defaults
|
27
27
|
--show-config Show current configuration values
|
28
28
|
--dry-run Don't write to the date file
|
29
29
|
-a, --[no-]auto Automatically find links
|
30
|
-
-s, --[no-]subtitles Download subtitles
|
31
30
|
-g, --grabber GRABBER Use given grabber as first option
|
32
31
|
--show-grabbers List available grabbers
|
33
32
|
-p, --pending Show list of pending downloads
|
34
33
|
--clear-pending Clear list of pending downloads
|
35
|
-
-q, --queue
|
34
|
+
-q, --queue SHOW Add show episode to pending downloads list
|
36
35
|
-v, --version Print version
|
37
36
|
-h, --help Show this message
|
38
37
|
```
|
39
38
|
|
40
39
|
### MyEpisodes integration
|
41
40
|
|
42
|
-
By default, download_tv connects to your MyEpisodes.com account and fetches the list of episodes that have aired since the program was run for the last time. It then tries to find magnet links to download each of these shows, using the link grabbers available. You can see the grabbers with the
|
41
|
+
By default, **download_tv** connects to your [MyEpisodes.com](https://www.myepisodes.com/) account and fetches the list of episodes that have aired since the program was run for the last time. It then tries to find magnet links to download each of these shows, using the link grabbers available. You can see the grabbers with the `--show-grabbers` option. These magnet links will be executed with whatever program you have configured to handle magnet:// files.
|
43
42
|
|
44
|
-
The
|
43
|
+
The `-o` flag can be used in order to re-download the episodes from previous days. The `--dry-run` option is useful to prevent **download_tv** from updating the date (for example, when running the application shortly after an episode airs).
|
45
44
|
|
46
|
-
|
45
|
+
The application also includes the `-t/--tomorrow` flag. By default, an execution of **download_tv** will download shows airing from the last execution of the program up to a day prior to the current day. This flag can be used to include in the search the episodes airing in the same day. This can be useful depending on your timezone or on the airtime of the shows you follow.
|
47
46
|
|
48
47
|
**Note**: Due to API limitations, the gem won't find shows aired more than 14 days prior to the execution of the script.
|
49
48
|
|
50
|
-
The options
|
49
|
+
The options `-c` and `--show-config` allow the user to change or view the current configuration values, respectively. These options include your MyEpisodes username, whether to save cookies or ask for password on each run and the list of ignored shows among other things. The gem (mostly) follows semver to track configuration file changes. It will automatically trigger a configuration update when it detects an older non-compatible version.
|
51
50
|
|
52
|
-
The
|
51
|
+
The `--auto` flag toggles whether all the results for each show are prompted to the user for him to choose or if the application should try to choose the download link automatically (see Section Filters). By default, all grabbers try to sort by number of seeders.
|
53
52
|
|
54
53
|
### Single torrent download
|
55
54
|
|
56
|
-
In order to download a single episode, use the
|
55
|
+
In order to download a single episode, use the `-d` flag, quoting the string when it contains spaces:
|
56
|
+
|
57
|
+
```
|
58
|
+
tv -d "Breaking Bad S04E01"
|
59
|
+
```
|
57
60
|
|
58
61
|
Although it uses some settings and grabbers specific for TV shows, this option can also be used as a quick way to find and download any torrent.
|
59
62
|
|
60
|
-
It can be used with the
|
63
|
+
It can be optionally used in conjunction with the `--season` flag to try to find and download a whole season of the given show: `tv -d "Breaking Bad" --season 4`. It will start searching from episode 1 and continue upwards until it can't find any torrent for an episode.
|
61
64
|
|
62
65
|
### Multi torrent download
|
63
66
|
|
64
|
-
The
|
67
|
+
The `-f` flag can be used to read the list of episodes to download from a file. Each line of the file is interpreted as a episode to download.
|
65
68
|
|
66
69
|
### Available link grabbers
|
67
70
|
|
68
|
-
With
|
71
|
+
With `-g` and `--show-grabbers`, the user can see what grabbers are available and choose one of these as their preferred option. By default, the application searches for torrents using TorrentAPI. When a grabber doesn't have a torrent for said episode, is offline, or causes any error to appear, it skips to the next grabber until exhausting the list.
|
69
72
|
|
70
73
|
I usually publish a patch update to the gem when I detect one of them isn't working, disabling it or fixing it altogether. If a specific grabber is giving you problems, check whether you're running the latest version of the gem before opening an issue here.
|
71
74
|
|
72
75
|
### Pending shows
|
73
76
|
|
74
|
-
download_tv
|
77
|
+
**download_tv** persists the list of shows it can't find on a given execution (when connecting to MyEpisodes, not for single show or file downloads) and it will try to find them again on following executions. This list can be viewed by passing the -p flag to the tv binary. The list can be cleared with the --clear-pending option.
|
75
78
|
|
76
|
-
|
79
|
+
It also has the functionality to queue an episode by running `tv --queue "show name"`. The --queue parameter cannot be used in conjunction with any other parameters.
|
77
80
|
|
78
81
|
### Filters
|
79
82
|
|
80
|
-
download_tv
|
83
|
+
**download_tv** allows setting include/exclude filters for the automatic download of shows.
|
81
84
|
|
82
|
-
|
85
|
+
Upon installation, the default filters exclude 2060p, 1080p or 720p, and include PROPER or REPACK releases when available. The user can specify in their configuration (`tv -c`) a list of words to include or exclude from their results that will override these defaults.
|
83
86
|
|
84
|
-
|
87
|
+
Keep in mind that this is not a hard filter. The application will sequentially apply as many user-defined filters as possible **while still returning at least one result**.
|
85
88
|
|
86
89
|
### License
|
87
90
|
|
data/bin/tv
CHANGED
@@ -30,7 +30,7 @@ opt_parser = OptionParser.new do |opts|
|
|
30
30
|
options[:arg] = s
|
31
31
|
end
|
32
32
|
|
33
|
-
opts.on('--season SEASON', 'Limit the show download to a specific season') do |s|
|
33
|
+
opts.on('-s', '--season SEASON', 'Limit the show download to a specific season') do |s|
|
34
34
|
options[:cmd] = 'dl'
|
35
35
|
options[:season] = s
|
36
36
|
end
|
@@ -55,10 +55,6 @@ opt_parser = OptionParser.new do |opts|
|
|
55
55
|
config[:auto] = n
|
56
56
|
end
|
57
57
|
|
58
|
-
opts.on('-s', '--[no-]subtitles', 'Download subtitles') do |n|
|
59
|
-
config[:subs] = n
|
60
|
-
end
|
61
|
-
|
62
58
|
opts.on('-g', '--grabber GRABBER', 'Use given grabber as first option') do |g|
|
63
59
|
config[:grabber] = g
|
64
60
|
end
|
@@ -92,7 +88,13 @@ opt_parser = OptionParser.new do |opts|
|
|
92
88
|
end
|
93
89
|
end
|
94
90
|
|
95
|
-
|
91
|
+
begin
|
92
|
+
opt_parser.parse!(ARGV)
|
93
|
+
rescue OptionParser::InvalidOption => e
|
94
|
+
warn e.message
|
95
|
+
puts opt_parser.help
|
96
|
+
exit 1
|
97
|
+
end
|
96
98
|
|
97
99
|
begin
|
98
100
|
case options[:cmd]
|
@@ -111,9 +113,9 @@ begin
|
|
111
113
|
dl.download_from_file(options[:arg])
|
112
114
|
when 'tomorrow'
|
113
115
|
dl = DownloadTV::Downloader.new(config)
|
114
|
-
dl.
|
116
|
+
dl.run(options[:dry], options[:offset].abs, include_tomorrow: true)
|
115
117
|
when 'config'
|
116
|
-
DownloadTV::Configuration.new(config
|
118
|
+
DownloadTV::Configuration.new(config).change_configuration
|
117
119
|
when 'showconfig'
|
118
120
|
DownloadTV::Configuration.new(config).print_config
|
119
121
|
when 'showpending'
|
data/download_tv.gemspec
CHANGED
@@ -24,7 +24,9 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
s.add_development_dependency 'bundler', '~> 2.0'
|
26
26
|
s.add_development_dependency 'minitest', '~> 5.0'
|
27
|
-
s.add_development_dependency
|
27
|
+
s.add_development_dependency "rake", ">= 12.3.3"
|
28
|
+
s.add_development_dependency 'pry', '~> 0.13'
|
29
|
+
s.add_development_dependency 'byebug', '~> 11.1'
|
28
30
|
|
29
31
|
s.add_dependency('json')
|
30
32
|
s.add_dependency('mechanize')
|
data/lib/download_tv.rb
CHANGED
@@ -6,15 +6,14 @@ module DownloadTV
|
|
6
6
|
class Configuration
|
7
7
|
attr_reader :content, :config_path
|
8
8
|
|
9
|
-
def initialize(content = {}
|
10
|
-
FileUtils.mkdir_p(File.join(ENV['HOME'], '.config', 'download_tv'))
|
9
|
+
def initialize(content = {})
|
11
10
|
@config_path = content[:path] || default_config_path
|
11
|
+
FileUtils.mkdir_p(File.expand_path('..', @config_path))
|
12
12
|
|
13
13
|
if File.exist? @config_path
|
14
14
|
load_config
|
15
15
|
@content.merge!(content) unless content.empty?
|
16
16
|
@content[:ignored]&.map!(&:downcase)
|
17
|
-
change_configuration if force_change
|
18
17
|
else
|
19
18
|
@content = content
|
20
19
|
change_configuration
|
@@ -26,61 +25,46 @@ module DownloadTV
|
|
26
25
|
prompt_for_cookie
|
27
26
|
prompt_for_ignored
|
28
27
|
prompt_for_filters
|
29
|
-
|
28
|
+
$stdout.flush
|
30
29
|
|
31
30
|
set_default_values
|
32
31
|
serialize
|
33
32
|
end
|
34
33
|
|
35
34
|
def prompt_for_myep_user
|
36
|
-
if @content[:myepisodes_user]
|
37
|
-
|
38
|
-
|
39
|
-
print 'Enter your MyEpisodes username: '
|
40
|
-
end
|
41
|
-
input = STDIN.gets.chomp
|
35
|
+
existing = "(#{@content[:myepisodes_user]}) " if @content[:myepisodes_user]
|
36
|
+
print "Enter your MyEpisodes username #{existing}: "
|
37
|
+
input = $stdin.gets.chomp
|
42
38
|
@content[:myepisodes_user] = input if input
|
43
39
|
end
|
44
40
|
|
45
41
|
def prompt_for_cookie
|
46
42
|
print 'Save cookie? (y)/n: '
|
47
|
-
@content[:cookie] = !(
|
43
|
+
@content[:cookie] = !($stdin.gets.chomp.casecmp? 'n')
|
48
44
|
end
|
49
45
|
|
50
46
|
def prompt_for_ignored
|
51
|
-
if @content[:ignored]
|
52
|
-
|
53
|
-
else
|
54
|
-
puts 'Enter a comma-separated list of shows to ignore: '
|
55
|
-
end
|
47
|
+
existing = "(#{@content[:ignored]})" if @content[:ignored]
|
48
|
+
puts "Enter a comma-separated list of shows to ignore: #{existing}"
|
56
49
|
|
57
|
-
@content[:ignored] =
|
58
|
-
.chomp
|
59
|
-
.split(',')
|
60
|
-
.map(&:strip)
|
61
|
-
.map(&:downcase)
|
50
|
+
@content[:ignored] = read_and_split_list :downcase
|
62
51
|
end
|
63
52
|
|
64
53
|
def prompt_for_filters
|
65
54
|
puts "Current filters: (#{@content[:filters]})" if @content[:filters]
|
66
|
-
|
67
55
|
@content[:filters] = {}
|
68
56
|
|
69
57
|
puts 'Enter a comma-separated list of terms to include: '
|
70
|
-
|
71
|
-
@content[:filters][:includes] = STDIN.gets
|
72
|
-
.chomp
|
73
|
-
.split(',')
|
74
|
-
.map(&:strip)
|
75
|
-
.map(&:upcase)
|
58
|
+
@content[:filters][:includes] = read_and_split_list :upcase
|
76
59
|
|
77
60
|
puts 'Enter a comma-separated list of terms to exclude: '
|
61
|
+
@content[:filters][:excludes] = read_and_split_list :upcase
|
62
|
+
end
|
78
63
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
.map(&:upcase)
|
64
|
+
def read_and_split_list(case_method)
|
65
|
+
$stdin.gets.chomp.split(',')
|
66
|
+
.map(&:strip)
|
67
|
+
.map(&case_method)
|
84
68
|
end
|
85
69
|
|
86
70
|
def default_filters
|
@@ -90,11 +74,11 @@ module DownloadTV
|
|
90
74
|
}
|
91
75
|
end
|
92
76
|
|
77
|
+
##
|
78
|
+
# Update the +content+ attribute with the defaults, if needed.
|
79
|
+
# Maintains the previous values, in case it's an update from an existing file.
|
93
80
|
def set_default_values
|
94
|
-
# When modifying existing config, keeps previous values
|
95
|
-
# When creating new one, sets defaults
|
96
81
|
@content[:auto] ||= true
|
97
|
-
@content[:subs] ||= true
|
98
82
|
@content[:grabber] ||= 'TorrentAPI'
|
99
83
|
@content[:date] ||= Date.today - 1
|
100
84
|
@content[:filters] ||= default_filters
|
@@ -117,7 +101,6 @@ module DownloadTV
|
|
117
101
|
rescue JSON::ParserError
|
118
102
|
@content = {}
|
119
103
|
change_configuration
|
120
|
-
retry
|
121
104
|
end
|
122
105
|
|
123
106
|
def default_config_path
|
@@ -125,9 +108,7 @@ module DownloadTV
|
|
125
108
|
end
|
126
109
|
|
127
110
|
##
|
128
|
-
# Returns true if a major or minor update has been detected
|
129
|
-
# Returns false if a patch has been detected
|
130
|
-
# Returns nil if it's the same version
|
111
|
+
# Returns true if a major or minor update has been detected, something falsy otherwise
|
131
112
|
def breaking_changes?(version)
|
132
113
|
DownloadTV::VERSION.split('.')
|
133
114
|
.zip(version.split('.'))
|