diff --git a/MANIFEST.in b/MANIFEST.in index ace5309f..16459b79 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,6 @@ recursive-include changedetectionio/templates * recursive-include changedetectionio/static * include changedetection.py -global-exclude *.pyc \ No newline at end of file +global-exclude *.pyc +global-exclude *node_modules* +global-exclude venv \ No newline at end of file diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 40593aba..f678adaf 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -411,7 +411,9 @@ def changedetection_app(config=None, datastore_o=None): 'fetch_backend': form.fetch_backend.data, 'trigger_text': form.trigger_text.data, 'notification_title': form.notification_title.data, - 'notification_body': form.notification_body.data + 'notification_body': form.notification_body.data, + 'extract_title_as_title': form.extract_title_as_title.data + } # Notification URLs diff --git a/changedetectionio/fetch_site_status.py b/changedetectionio/fetch_site_status.py index 18f2b0bd..fc8c1e6e 100644 --- a/changedetectionio/fetch_site_status.py +++ b/changedetectionio/fetch_site_status.py @@ -170,9 +170,10 @@ class perform_site_check(): update_obj["previous_md5"] = fetched_md5 # Extract title as title - if is_html and self.datastore.data['settings']['application']['extract_title_as_title']: - if not watch['title'] or not len(watch['title']): - update_obj['title'] = html_tools.extract_element(find='title', html_content=fetcher.content) + if is_html: + if self.datastore.data['settings']['application']['extract_title_as_title'] or watch['extract_title_as_title']: + if not watch['title'] or not len(watch['title']): + update_obj['title'] = html_tools.extract_element(find='title', html_content=fetcher.content) return changed_detected, update_obj, stripped_text_from_html diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index 4bc39215..62b30b20 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -203,6 +203,7 @@ class commonSettingsForm(Form): notification_body = TextAreaField('Notification Body', default='{watch_url} had a change.', validators=[validators.Optional(), ValidateTokensList()]) trigger_check = BooleanField('Send test notification on save') fetch_backend = RadioField(u'Fetch Method', choices=content_fetcher.available_fetchers(), validators=[ValidateContentFetcherIsReady()]) + extract_title_as_title = BooleanField('Extract from document and use as watch title', default=False) class watchForm(commonSettingsForm): @@ -225,4 +226,3 @@ class globalSettingsForm(commonSettingsForm): minutes_between_check = html5.IntegerField('Maximum time in minutes until recheck', [validators.NumberRange(min=1)]) - extract_title_as_title = BooleanField('Extract <title> from document and use as watch title') diff --git a/changedetectionio/store.py b/changedetectionio/store.py index 45fc9c95..25bcf613 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -73,6 +73,7 @@ class ChangeDetectionStore: 'css_filter': "", 'trigger_text': [], # List of text or regex to wait for until a change is detected 'fetch_backend': None, + 'extract_title_as_title': False } if path.isfile('changedetectionio/source.txt'): diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 4a3c02f9..95c6b14d 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -56,6 +56,9 @@ User-Agent: wonderbra 1.0") }} <p>The <strong>Chrome/Javascript</strong> method requires a network connection to a running WebDriver+Chrome server. </p> </span> </div> + <div class="pure-control-group"> + {{ render_field(form.extract_title_as_title) }} + </div> </fieldset> </div>