summarylogtreecommitdiffstats
path: root/no_update.patch
blob: 17b0b308f5dfbb568d8d58fb91ca4c92bc22e864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
Only in PyIDM: build
diff --color --unified --recursive --text PyIDM.orig/pyidm/config.py PyIDM/pyidm/config.py
--- PyIDM.orig/pyidm/config.py	2020-08-11 09:17:50.841427964 +0200
+++ PyIDM/pyidm/config.py	2020-08-11 08:59:33.694722005 +0200
@@ -138,11 +138,6 @@
 active_downloads = set()  # indexes for active downloading items
 d_list = []
 
-# update
-update_frequency = 7  # 'every day'=1, every week=7, every month=30 and so on
-last_update_check = 0  # day number in the year range from 1 to 366
-update_frequency_map = {'Everyday': 1, 'Every Week': 7, 'Every Month': 30, 'Never': -1}
-
 # store hashes for installed update patches in update_record.info file at current folder
 update_record_path = os.path.join(current_directory, 'update_record.info')
 
@@ -157,7 +152,7 @@
 # settings parameters to be saved on disk
 settings_keys = ['current_theme', 'monitor_clipboard', 'show_download_window', 'auto_close_download_window',
                  'segment_size', 'show_thumbnail', 'speed_limit', 'max_concurrent_downloads', 'max_connections',
-                 'update_frequency', 'last_update_check', 'proxy', 'proxy_type', 'raw_proxy', 'enable_proxy',
+                 'proxy', 'proxy_type', 'raw_proxy', 'enable_proxy',
                  'log_level', 'download_folder', 'manually_select_dash_audio', 'use_referer', 'referer_url',
                  'close_action', 'process_playlist', 'keep_temp', 'auto_rename', 'dynamic_theme_change', 'checksum',
                  'use_proxy_dns', 'use_thread_pool_executor', 'write_metadata']
diff --color --unified --recursive --text PyIDM.orig/pyidm/gui.py PyIDM/pyidm/gui.py
--- PyIDM.orig/pyidm/gui.py	2020-08-11 09:17:50.844761298 +0200
+++ PyIDM/pyidm/gui.py	2020-08-11 09:06:29.088070216 +0200
@@ -469,25 +469,6 @@
             [sg.T('', size=(1, 1))]
         ]
 
-        update = [
-            [sg.T(' ', size=(100, 1))],
-            [sg.T('Check for update:'),
-             sg.Combo(list(config.update_frequency_map.keys()), default_value=[k for k, v in config.update_frequency_map.items() if v == config.update_frequency][0],
-                      size=(15, 1), key='update_frequency', enable_events=True)],
-            [
-                sg.B('', key='update_pyIDM', image_data=refresh_icon, **transparent, tooltip='check for update'),
-                sg.T(f'PyIDM version = {config.APP_VERSION}', size=(50, 1), key='pyIDM_version_note'),
-            ],
-            [
-                sg.B('', key='update_youtube_dl', image_data=refresh_icon, **transparent,
-                     tooltip=' check for update '),
-                sg.T('Youtube-dl version = 00.00.00', size=(50, 1), key='youtube_dl_update_note'),
-                sg.B('', key='rollback_ytdl_update', image_data=delete_icon, **transparent,
-                     tooltip=' rollback youtube-dl update '),
-            ],
-            [sg.T('', size=(1, 14))]  # fill lines
-        ]
-
         advanced = [
 
             [sg.T('')],
@@ -506,8 +487,7 @@
         layout = [
             [sg.T('', size=(70, 1)), ],
             [sg.TabGroup([[sg.Tab('General   ', general), sg.Tab('Network  ', network), sg.Tab('SysTray  ', systray),
-                           sg.Tab('Update    ', update), sg.Tab('Advanced ', advanced)]],
-                         tab_location='lefttop')]
+                           sg.Tab('Advanced ', advanced)]], tab_location='lefttop')]
         ]
 
         return layout
@@ -858,11 +838,6 @@
             speed_limit = size_format(config.speed_limit) if config.speed_limit > 0 else "_no limit_"
             self.window['current_speed_limit'](f'Current value: {speed_limit}')
 
-            self.window['youtube_dl_update_note'](
-                f'Youtube-dl version = {config.ytdl_VERSION}, Latest version = {config.ytdl_LATEST_VERSION}')
-            self.window['pyIDM_version_note'](
-                f'PyIDM version = {config.APP_VERSION}, Latest version = {config.APP_LATEST_VERSION}')
-
             # update total speed
             total_speed = 0
             for i in self.active_downloads:
@@ -1558,22 +1533,6 @@
 
                 # log('user, pass:', config.username, config.password)
 
-            # update -------------------------------------------------
-            elif event == 'update_frequency':
-                selected = values['update_frequency']
-                config.update_frequency = config.update_frequency_map[selected]  # selected
-                # print('config.update_frequency:', config.update_frequency)
-
-            elif event == 'update_youtube_dl':
-                self.update_ytdl()
-
-            elif event == 'rollback_ytdl_update':
-                Thread(target=update.rollback_ytdl_update).start()
-                self.select_tab('Log')
-
-            elif event in ['update_pyIDM']:
-                Thread(target=self.update_app, daemon=True).start()
-
             # systray -------------------------------------------------
             elif event in ('radio_close', 'radio_minimize', 'radio_quit'):
                 config.close_action = event.replace('radio_', '')
@@ -1641,44 +1600,6 @@
                 # check availability of ffmpeg in the system or in same folder with this script
                 self.ffmpeg_check()
 
-                # print last check for update
-                if config.update_frequency < 0:
-                    log('check for update is disabled!')
-
-            # check for update block, negative values for config.last_update_check mean never check for update
-            if config.update_frequency >= 0 and time.time() - self.check_for_update_timer >= 60:
-                self.check_for_update_timer = time.time()
-
-                t = time.localtime()
-                today = t.tm_yday  # today number in the year range (1 to 366)
-
-                if config.last_update_check == 0:  # no setting.cfg file found / fresh start
-                    config.last_update_check = today
-                else:
-                    try:
-                        if today < config.last_update_check:  # new year
-                            days_since_last_update = today + 366 - config.last_update_check
-                        else:
-                            days_since_last_update = today - config.last_update_check
-
-                        if days_since_last_update >= config.update_frequency:
-                            log('days since last check for update:', days_since_last_update, 'day(s).')
-                            log('asking user permission to check for update')
-                            response = sg.PopupOKCancel('PyIDM reminder to check for updates!',
-                                                        f'days since last check: {days_since_last_update} day(s).',
-                                                        'you can change frequency or disable check for update from settings\n', title='Reminder')
-                            if response == 'OK':
-                                # it will check for updates and offer auto-update for frozen app. version
-                                Thread(target=self.update_app, daemon=True).start()
-                                # Thread(target=self.check_for_update, daemon=True).start()
-                                config.last_update_check = today
-                            else:
-                                config.last_update_check = 0
-                                log('check for update cancelled by user, next reminder will be after',
-                                    config.update_frequency, 'day(s).')
-                    except Exception as e:
-                        log('MainWindow.run()>', e)
-
             # reset statusbar periodically
             if time.time() - self.statusbar_timer >= 10:
                 self.statusbar_timer = time.time()
@@ -2893,59 +2814,6 @@
 
     # endregion
 
-    # region update
-    def update_app(self):
-        """
-        check for new version or update patch and show update window,
-        this method is time consuming and should run from a thread
-        """
-
-        # check for new App. version
-        changelog = update.check_for_new_version()
-        if changelog:
-            self.active_windows.append(UpdateWindow(changelog))
-
-        else:
-            # check for update patch -- for frozen versions only --
-            batch_info = update.check_for_new_patch() if config.FROZEN else None
-
-            if batch_info:
-                self.active_windows.append(UpdateWindow(batch_info.get('description', 'No description available')))
-            else:
-                log('No Update available', showpopup=True, start='')
-
-    def check_for_ytdl_update(self):
-        config.ytdl_LATEST_VERSION = update.check_for_ytdl_update()
-        log('youtube-dl, latest version = ', config.ytdl_LATEST_VERSION, ' - current version = ', config.ytdl_VERSION)
-
-    def update_ytdl(self):
-        current_version = config.ytdl_VERSION
-        latest_version = config.ytdl_LATEST_VERSION or update.check_for_ytdl_update()
-        if latest_version:
-            config.ytdl_LATEST_VERSION = latest_version
-            log('youtube-dl, latest version = ', latest_version, ' - current version = ', current_version)
-
-            if latest_version != current_version:
-                # select log tab
-                self.select_tab('Log')
-
-                response = sg.popup_ok_cancel(
-                    f'Found new version of youtube-dl on github \n'
-                    f'new version     =  {latest_version}\n'
-                    f'current version =  {current_version} \n'
-                    'Install new version?',
-                    title='youtube-dl module update')
-
-                if response == 'OK':
-                    try:
-                        Thread(target=update.update_youtube_dl).start()
-                    except Exception as e:
-                        log('failed to update youtube-dl module:', e)
-            else:
-                sg.popup_ok(f'youtube_dl is up-to-date, current version = {current_version}')
-    # endregion
-
-
 # Note every window class must have self.active property and close method
 class DownloadWindow:
 
@@ -3598,58 +3466,6 @@
 
         self.window.close()
 
-
-class UpdateWindow:
-
-    def __init__(self, update_description):
-        self.active = True  # if False, object will be removed from "active windows list"
-        self.update_description = update_description
-        self.window = None
-
-    def setup(self):
-
-        # create gui
-        buttons = []
-        if config.FROZEN: # show update button for Frozen versions only i.e. "windows portable version"
-            buttons.append(sg.B('Update'))
-
-        buttons += [sg.B('website'), sg.Cancel()]
-
-        layout = [
-            [sg.T('New update available:')],
-            [sg.Multiline(self.update_description, size=(70, 10))],
-            buttons
-        ]
-
-        self.window = sg.Window('Update Application', layout, finalize=True, keep_on_top=True)
-
-    def focus(self):
-        self.window.BringToFront()
-
-    def run(self):
-
-        # using this technique we can start gui window from a thread
-        if not self.window:
-            self.setup()
-
-        # read events
-        event, values = self.window.read(timeout=10, timeout_key='_TIMEOUT_')
-
-        if event == 'Update':
-            Thread(target=update.update).start()
-            execute_command('select_tab', 'Log')
-
-        elif event == 'website':
-            update.open_update_link()
-
-        if event != '_TIMEOUT_':
-            self.close()
-
-    def close(self):
-        self.active = False
-        self.window.Close()
-
-
 class SysTray:
     """
     systray icon using pystray package