download_tv 2.6.5 → 2.6.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3bb73c3cccddd294060908acd7d79d619b1af0927aa51b5c7b7ac04aff6dd20
4
- data.tar.gz: ea159d175a5bcdc1bdf71c35264756ee41d7da2d9b53aa7169258c37926279cf
3
+ metadata.gz: '09d470071b18c6859d55874249141ae57bfc68b538fc8a5e5ffb3ba27dfb9d89'
4
+ data.tar.gz: '08fa4240f9f2ab5fe00fbe5509932b9a05d4c5e7254da38aaa249ecee3c60dce'
5
5
  SHA512:
6
- metadata.gz: f052f503bea9ceec1c5010b174680cd9efeb5f657d0db0747018cc232c2a66468e394a574776231472cb3506adf0f3a01def502e0adaa9dd86aa39a42e3328d4
7
- data.tar.gz: 3a5d5d52294d770adc7c73879568c3ccfb88d7e88110bb78d02e7671b883cf8be88ad4e54e2c951d15f8508529d464b5014b4525068982c88598d80ae037830c
6
+ metadata.gz: 9a0f0390cf1f4d74f65a41e4704bca3d618043b6e72ad0a02716e5121276966016d60e9323f8392d77cb4bf07c1abb6289372d95214f575b9a7da3d620b5f993
7
+ data.tar.gz: 9271b796d80b9d0519699ca5f9acc0d26b88f190798474ca2128077324781df7f4205fffc4345f7d225b00635071177ca118d26ae0aacff2fc02e5174c3496e3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # download_tv CHANGELOG
2
2
 
3
+ ## 2.6.6 (2022-01-21)
4
+
5
+ * Improvements
6
+ * The `--dry-run` option now prevents from persisting any configuration, including pending shows, not just the last execution date.
7
+ * Performance improvements when running with the `-t` flag.
8
+
3
9
  ## 2.6.5 (2021-06-10)
4
10
 
5
11
  * Fixes
data/README.md CHANGED
@@ -6,13 +6,13 @@
6
6
 
7
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
- ### Installation
9
+ ## Installation
10
10
 
11
11
  `gem install download_tv`
12
12
 
13
- ### Usage
13
+ ## Usage
14
14
 
15
- Once installed, you can launch the binary *tv*
15
+ Once installed, you can launch the binary `tv`
16
16
 
17
17
  ```
18
18
  Usage: tv [options]
@@ -86,6 +86,10 @@ Upon installation, the default filters exclude 2060p, 1080p or 720p, and include
86
86
 
87
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**.
88
88
 
89
- ### License
89
+ ## Shell completion
90
+
91
+ The provided binary will print completion files to STDOUT by passing the options `--*-completion-bash` and `--*-completion-zsh` (you might have to escape the asterisk). Use your shell's manual to find out how to load these files to get completions.
92
+
93
+ ## License
90
94
 
91
95
  This project is released under the terms of the MIT license. See [LICENSE.md](https://github.com/guille/download_tv/blob/master/LICENSE.md) file for details.
data/bin/tv CHANGED
@@ -47,7 +47,7 @@ opt_parser = OptionParser.new do |opts|
47
47
  options[:cmd] = 'showconfig'
48
48
  end
49
49
 
50
- opts.on('--dry-run', "Don't write to the date file") do |n|
50
+ opts.on('--dry-run', "Don't update the persisted configuration") do |n|
51
51
  options[:dry] = n
52
52
  end
53
53
 
@@ -66,17 +66,16 @@ module DownloadTV
66
66
  # the last run of the program
67
67
  # It connects to MyEpisodes in order to find which shows
68
68
  # to track and which new episodes aired.
69
- # The param +dont_update_last_run+ prevents changing the configuration's date value
69
+ # The param +dry_run+ prevents changing the persisted configuration
70
70
  # The param +offset+ can be used to move the date back that many days in the check
71
71
  # The param +include_tomorrow+ will add the current day to the list of dates to search
72
- def run(dont_update_last_run, offset = 0, include_tomorrow: false)
72
+ def run(dry_run = false, offset = 0, include_tomorrow: false)
73
73
  pending = @config.content[:pending].clone
74
74
  @config.content[:pending].clear
75
75
  pending ||= []
76
76
  date = date_to_check_from(offset)
77
77
 
78
- pending.concat shows_to_download(date) if date < Date.today
79
- pending.concat today_shows_to_download if include_tomorrow && date < Date.today.next
78
+ pending.concat shows_to_download(date, include_tomorrow) if date < (include_tomorrow ? Date.today.next : Date.today)
80
79
 
81
80
  if pending.empty?
82
81
  puts 'Nothing to download'
@@ -85,14 +84,14 @@ module DownloadTV
85
84
  puts 'Completed. Exiting...'
86
85
  end
87
86
 
88
- unless dont_update_last_run
87
+ unless dry_run
89
88
  @config.content[:date] = if include_tomorrow
90
89
  Date.today.next
91
90
  else
92
91
  [Date.today, @config.content[:date]].max
93
92
  end
93
+ @config.serialize
94
94
  end
95
- @config.serialize
96
95
  rescue InvalidLoginError
97
96
  warn 'Wrong username/password combination'
98
97
  end
@@ -126,20 +125,11 @@ module DownloadTV
126
125
  download_t.join
127
126
  end
128
127
 
129
- def shows_to_download(date)
128
+ def shows_to_download(date, include_tomorrow)
130
129
  myepisodes = MyEpisodes.new(@config.content[:myepisodes_user],
131
130
  @config.content[:cookie])
132
131
  myepisodes.load_cookie
133
- shows = myepisodes.get_shows_since(date)
134
- shows = reject_ignored(shows)
135
- fix_names(shows)
136
- end
137
-
138
- def today_shows_to_download
139
- myepisodes = MyEpisodes.new(@config.content[:myepisodes_user],
140
- @config.content[:cookie])
141
- myepisodes.load_cookie
142
- shows = myepisodes.today_shows
132
+ shows = myepisodes.get_shows_since(date, include_tomorrow: include_tomorrow)
143
133
  shows = reject_ignored(shows)
144
134
  fix_names(shows)
145
135
  end
@@ -64,16 +64,11 @@ module DownloadTV
64
64
  @agent
65
65
  end
66
66
 
67
- def get_shows_since(last)
67
+ def get_shows_since(last, include_tomorrow: false)
68
68
  page = @agent.get 'https://www.myepisodes.com/ajax/service.php?mode=view_privatelist'
69
69
  shows = page.parser.css('tr.past')
70
70
  shows = filter_newer_shows(shows, last)
71
- build_show_strings(shows)
72
- end
73
-
74
- def today_shows
75
- page = @agent.get 'https://www.myepisodes.com/ajax/service.php?mode=view_privatelist'
76
- shows = page.parser.css('tr.today')
71
+ shows.concat(page.parser.css('tr.today')) if include_tomorrow
77
72
  build_show_strings(shows)
78
73
  end
79
74
 
@@ -81,7 +76,8 @@ module DownloadTV
81
76
  def filter_newer_shows(shows, date)
82
77
  shows.select do |i|
83
78
  airdate = i.css('td.date')[0].text
84
- Date.parse(airdate) >= date
79
+ viewed_checkbox = i.css('td.status input').last
80
+ Date.parse(airdate) >= date && viewed_checkbox&.attribute('checked').nil?
85
81
  end
86
82
  end
87
83
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DownloadTV
4
- VERSION = '2.6.5'
4
+ VERSION = '2.6.6'
5
5
  end
data/lib/download_tv.rb CHANGED
@@ -14,7 +14,6 @@ require 'download_tv/torrent'
14
14
  require 'download_tv/filterer'
15
15
  require 'download_tv/myepisodes'
16
16
  require 'download_tv/linkgrabber'
17
- require 'download_tv/subtitles'
18
17
 
19
18
  module DownloadTV
20
19
  USER_AGENT = "DownloadTV #{DownloadTV::VERSION}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: download_tv
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.5
4
+ version: 2.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - guille
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-10 00:00:00.000000000 Z
11
+ date: 2022-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,7 +130,6 @@ files:
130
130
  - lib/download_tv/configuration.rb
131
131
  - lib/download_tv/downloader.rb
132
132
  - lib/download_tv/filterer.rb
133
- - lib/download_tv/grabbers/addic7ed.rb
134
133
  - lib/download_tv/grabbers/eztv.rb
135
134
  - lib/download_tv/grabbers/kat.rb
136
135
  - lib/download_tv/grabbers/torrentapi.rb
@@ -138,7 +137,6 @@ files:
138
137
  - lib/download_tv/grabbers/tpb.rb
139
138
  - lib/download_tv/linkgrabber.rb
140
139
  - lib/download_tv/myepisodes.rb
141
- - lib/download_tv/subtitles.rb
142
140
  - lib/download_tv/torrent.rb
143
141
  - lib/download_tv/version.rb
144
142
  - test/config_test.rb
@@ -165,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
163
  - !ruby/object:Gem::Version
166
164
  version: '0'
167
165
  requirements: []
168
- rubygems_version: 3.2.17
166
+ rubygems_version: 3.2.30
169
167
  signing_key:
170
168
  specification_version: 4
171
169
  summary: DownloadTV is a tool that allows the user to find magnet links for tv show
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DownloadTV
4
- ##
5
- # Addic7ed prototype (WIP)
6
- class Addic7ed < LinkGrabber
7
- def initialize
8
- super('http://www.addic7ed.com/search.php?search=%s'\
9
- '&Submit=Search')
10
- end
11
-
12
- def get_subs(show)
13
- url = get_url(show)
14
- download_file(url)
15
- end
16
-
17
- def get_url(show)
18
- # Change spaces for the separator
19
- s = show.gsub(' ', @sep)
20
-
21
- # Format the url
22
- search = Format(@url, s)
23
-
24
- agent = Mechanize.new
25
- res = agent.get(search)
26
-
27
- # No redirection means no subtitle found
28
- raise NoSubtitlesError if res.uri.to_s == search
29
-
30
- ##########
31
- # DO OPENSUBTITLES FIRST (see subtitles.rb)
32
- #####
33
-
34
- # We now have an URL like:
35
- # http://www.addic7ed.com/serie/Mr._Robot/2/3/eps2.1k3rnel-pan1c.ksd
36
-
37
- # To find the real links:
38
- # see comments at the end of file
39
- end
40
-
41
- def download_file(url)
42
- # Url must be like 'http://www.addic7ed.com/updated/1/115337/0'
43
-
44
- # ADDIC7ED PROVIDES RSS
45
-
46
- agent = Mechanize.new
47
- page = agent.get(url, [], @url)
48
- puts page.save('Hi')
49
- end
50
- end
51
- end
52
- # subtitles = {}
53
- # html.css('.tabel95 .newsDate').each do |td|
54
- # if downloads = td.text.match(/\s(\d*)\sDownloads/i)
55
- # done = false
56
- # td.parent.parent.xpath('./tr/td/a[@class='buttonDownload']/@href').each do |link|
57
- # if md = link.value.match(/updated/i)
58
- # subtitles[downloads[1].to_i] = link.value
59
- # done = true
60
- # elsif link.value.match(/original/i) && done == false
61
- # subtitles[downloads[1].to_i] = link.value
62
- # done = true
63
- # end
64
- # end
65
- # end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DownloadTV
4
- ##
5
- # Manages the subtitles (WIP)
6
- class Subtitles
7
- def initialize
8
- @a = Addic7ed.new
9
- end
10
-
11
- def get_subs(show)
12
- @a.get_subs(show)
13
- rescue NoSubtitlesError
14
- puts "No subtitles found for #{show}"
15
- end
16
- end
17
- end