🤬
  • ■ ■ ■ ■ ■ ■
    changedetectionio/__init__.py
    skipped 641 lines
    642 642   enabled_tabs.append('visual-selector')
    643 643   enabled_tabs.append('text-filters-and-triggers')
    644 644   
     645 + if watch.get('fetch_processor') == 'image':
     646 + enabled_tabs.append('visual-selector')
     647 + 
    645 648   output = render_template("edit.html",
    646  - uuid=uuid,
    647  - watch=watch,
     649 + current_base_url=datastore.data['settings']['application']['base_url'],
     650 + emailprefix=os.getenv('NOTIFICATION_MAIL_BUTTON_PREFIX', False),
     651 + enabled_tabs = enabled_tabs,
    648 652   form=form,
    649  - enabled_tabs = enabled_tabs,
     653 + has_default_notification_urls=True if len(datastore.data['settings']['application']['notification_urls']) else False,
    650 654   has_empty_checktime=using_default_check_time,
    651  - has_default_notification_urls=True if len(datastore.data['settings']['application']['notification_urls']) else False,
     655 + playwright_enabled=os.getenv('PLAYWRIGHT_DRIVER_URL', False),
     656 + settings_application=datastore.data['settings']['application'],
    652 657   using_global_webdriver_wait=default['webdriver_delay'] is None,
    653  - current_base_url=datastore.data['settings']['application']['base_url'],
    654  - emailprefix=os.getenv('NOTIFICATION_MAIL_BUTTON_PREFIX', False),
    655  - settings_application=datastore.data['settings']['application'],
     658 + uuid=uuid,
    656 659   visualselector_data_is_ready=visualselector_data_is_ready,
    657 660   visualselector_enabled=visualselector_enabled,
    658  - playwright_enabled=os.getenv('PLAYWRIGHT_DRIVER_URL', False)
     661 + watch=watch,
    659 662   )
    660 663   
    661 664   return output
    skipped 146 lines
    808 811   return redirect(url_for('index'))
    809 812   
    810 813   previous_version = dates[-2]
     814 + 
     815 + datastore.set_last_viewed(uuid, time.time())
    811 816   
    812 817   output = render_template("diff-image.html",
    813 818   watch=watch,
    skipped 260 lines
    1074 1079   new_img = watch.history[watch.newest_history_key]
    1075 1080   prev_img = watch.history[compare_date]
    1076 1081   
    1077  - img = image_diff.render_diff(new_img, prev_img)
     1082 + try:
     1083 + img = image_diff.render_diff(new_img, prev_img)
     1084 + except ValueError as e:
     1085 + print ("EXCEPTION: Diff image - got exception {} reverting to raw image without rendering difference".format(str(e)))
     1086 + with open(new_img, 'rb') as f:
     1087 + img = f.read()
     1088 + 
    1078 1089   
    1079 1090   resp = make_response(img)
    1080 1091   resp.headers['Content-Type'] = 'image/jpeg'
    skipped 531 lines
  • ■ ■ ■ ■ ■ ■
    changedetectionio/content_fetcher.py
    skipped 420 lines
    421 421   # acceptable screenshot quality here
    422 422   try:
    423 423   # Quality set to 1 because it's not used, just used as a work-around for a bug, no need to change this.
    424  - page.screenshot(type='jpeg', clip={'x': 1.0, 'y': 1.0, 'width': 1280, 'height': 1024}, quality=1)
     424 + #page.screenshot(type='jpeg', clip={'x': 1.0, 'y': 1.0, 'width': 1280, 'height': 1024}, quality=1)
    425 425   # The actual screenshot
    426  - self.screenshot = page.screenshot(type='jpeg', full_page=True, quality=int(os.getenv("PLAYWRIGHT_SCREENSHOT_QUALITY", 72)))
     426 + self.screenshot = page.screenshot(type='jpeg', full_page=True, quality=int(os.getenv("PLAYWRIGHT_SCREENSHOT_QUALITY", 82)))
    427 427   except Exception as e:
    428 428   context.close()
    429 429   browser.close()
    skipped 192 lines
  • ■ ■ ■ ■ ■
    changedetectionio/fetch_processor/image.py
    skipped 88 lines
    89 89   if 'image' in fetcher.headers['content-type']:
    90 90   self.contents = fetcher.raw_content
    91 91   else:
     92 + # should be element if the filter is set, no?
    92 93   self.contents = fetcher.screenshot
     94 + 
     95 + # Used for visual-selector
     96 + self.xpath_data = fetcher.xpath_data
     97 + self.screenshot = fetcher.screenshot
    93 98   
    94 99   image = Image.open(io.BytesIO(self.contents))
    95 100   
    skipped 17 lines
  • ■ ■ ■ ■ ■ ■
    changedetectionio/image_diff.py
    skipped 32 lines
    33 33   # bounding box on both input images to represent where the two
    34 34   # images differ
    35 35   (x, y, w, h) = cv2.boundingRect(c)
    36  - cv2.rectangle(imageA, (x, y), (x + w, y + h), (0, 0, 255), 2)
    37  - cv2.rectangle(imageB, (x, y), (x + w, y + h), (0, 0, 255), 2)
     36 + cv2.rectangle(imageA, (x, y), (x + w, y + h), (0, 0, 255), 1)
     37 + cv2.rectangle(imageB, (x, y), (x + w, y + h), (0, 0, 255), 1)
    38 38   
    39 39   #return cv2.imencode('.jpg', imageB)[1].tobytes()
    40 40   return cv2.imencode('.jpg', imageA)[1].tobytes()
    skipped 1 lines
  • changedetectionio/static/images/picture-frame.svg
  • ■ ■ ■ ■ ■ ■
    changedetectionio/static/styles/styles.css
    skipped 578 lines
    579 579   height: 26px;
    580 580   vertical-align: middle; }
    581 581   
     582 +#quickwatch-fetch-processor {
     583 + color: #fff;
     584 + font-size: 80%; }
     585 + #quickwatch-fetch-processor ul {
     586 + padding: 0px;
     587 + list-style-type: none; }
     588 + #quickwatch-fetch-processor ul li {
     589 + display: inline-block;
     590 + margin-right: 1em; }
     591 + #quickwatch-fetch-processor ul li label:hover {
     592 + cursor: pointer; }
     593 + 
  • ■ ■ ■ ■ ■ ■
    changedetectionio/static/styles/styles.scss
    skipped 803 lines
    804 804   border-radius: 5px;
    805 805   color: #ff3300;
    806 806  }
     807 + 
     808 +#quickwatch-fetch-processor {
     809 + color: #fff;
     810 + font-size: 80%;
     811 + 
     812 + ul {
     813 + padding: 0px;
     814 + list-style-type: none;
     815 + li {
     816 + display: inline-block;
     817 + margin-right: 1em;
     818 + label {
     819 + &:hover {
     820 + cursor: pointer;
     821 + }
     822 + }
     823 + }
     824 + }
     825 +}
     826 + 
     827 + 
  • ■ ■ ■ ■ ■
    changedetectionio/templates/edit.html
    skipped 27 lines
    28 28   {% if 'visual-selector' in enabled_tabs %}
    29 29   <li class="tab"><a id="visualselector-tab" href="#visualselector">Visual Filter Selector</a></li>
    30 30   {%endif%}
    31  - {% if 'text-filters-and-triggers' in enabled_tabs %}
    32 31   <li class="tab"><a href="#filters-and-triggers">Filters &amp; Triggers</a></li>
    33  - {%endif%}
    34 32   <li class="tab"><a href="#notifications">Notifications</a></li>
    35 33   </ul>
    36 34   </div>
    skipped 121 lines
    158 156   </div>
    159 157   
    160 158   <div class="tab-pane-inner" id="filters-and-triggers">
     159 + {% if 'text-filters-and-triggers' in enabled_tabs %}
    161 160   <div class="pure-control-group">
    162 161   <strong>Pro-tips:</strong><br/>
    163 162   <ul>
    skipped 5 lines
    169 168   </li>
    170 169   </ul>
    171 170   </div>
     171 + 
    172 172   <fieldset>
    173 173   <div class="pure-control-group">
    174 174   {{ render_checkbox_field(form.check_unique_lines) }}
    175 175   <span class="pure-form-message-inline">Good for websites that just move the content around, and you want to know when NEW content is added, compares new lines against all history for this watch.</span>
    176 176   </div>
    177 177   </fieldset>
     178 + {% endif %}
    178 179   <div class="pure-control-group">
    179 180   {% set field = render_field(form.css_filter,
    180 181   placeholder=".class-name or #some-id, or other CSS selector rule.",
    skipped 20 lines
    201 202   href="https://github.com/dgtlmoon/changedetection.io/wiki/CSS-Selector-help">here for more CSS selector help</a>.<br/>
    202 203   </span>
    203 204   </div>
     205 + 
     206 + {% if 'text-filters-and-triggers' in enabled_tabs %}
     207 + 
    204 208   <div class="pure-control-group">
    205 209   {{ render_field(form.subtractive_selectors, rows=5, placeholder="header
    206 210  footer
    skipped 69 lines
    276 280   </span>
    277 281   </div>
    278 282   </fieldset>
     283 + 
     284 + {% endif %}
    279 285   </div>
    280 286   
    281 287   <div class="tab-pane-inner visual-selector-ui" id="visualselector">
    skipped 56 lines
  • ■ ■ ■ ■ ■ ■
    changedetectionio/templates/watch-overview.html
    skipped 14 lines
    15 15   <div>
    16 16   {{ render_simple_field(form.url, placeholder="https://...", required=true) }}
    17 17   {{ render_simple_field(form.tag, value=active_tag if active_tag else '', placeholder="watch group") }}
     18 + <span>
     19 + {{ render_simple_field(form.watch_submit_button, title="Watch this URL!" ) }}
     20 + {{ render_simple_field(form.edit_and_watch_submit_button, title="Edit first then Watch") }}
     21 + </span>
    18 22   {% if webdriver_enabled %}
    19  - <br/>
    20  - {{ render_field(form.fetch_processor) }}
     23 + <div id="quickwatch-fetch-processor">
     24 + {{ render_field(form.fetch_processor) }}
     25 + </div>
    21 26   {% endif %}
    22 27   </div>
    23 28   <div>
    24  - {{ render_simple_field(form.watch_submit_button, title="Watch this URL!" ) }}
    25  - {{ render_simple_field(form.edit_and_watch_submit_button, title="Edit first then Watch") }}
     29 + 
    26 30   </div>
    27 31   </div>
    28 32   </fieldset>
    skipped 66 lines
    95 99   <a href="{{url_for('form_share_put_watch', uuid=watch.uuid)}}"><img style="height: 1em;display:inline-block;" src="{{url_for('static_content', group='images', filename='spread.svg')}}" /></a>
    96 100   
    97 101   {%if watch.fetch_backend == "html_webdriver" %}<img style="height: 1em; display:inline-block;" src="{{url_for('static_content', group='images', filename='Google-Chrome-icon.png')}}" />{% endif %}
    98  - 
     102 + {%if watch.fetch_processor == "image" %}<img style="height: 1em; display:inline-block;" src="{{url_for('static_content', group='images', filename='picture-frame.svg')}}" />{% endif %}
    99 103   {% if watch.last_error is defined and watch.last_error != False %}
    100 104   <div class="fetch-error">{{ watch.last_error }}</div>
    101 105   {% endif %}
    skipped 63 lines
Please wait...
Page is in error, reload to recover