Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ae8725f authored by Nivesh Krishna's avatar Nivesh Krishna
Browse files

Merge branch 'add-currency' into 'master'

enable currency converter

Closes backlog#684

See merge request !111
parents bddebb44 bae982bb
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -36,19 +36,20 @@ def response(resp):
        conversion_rate = float(json.loads(json_resp)['conversion']['converted-amount'])
    except:
        return results
    answer = '{0} {1} = {2} {3}, 1 {1} ({5}) = {4} {3} ({6})'.format(
        resp.search_params['amount'],
        resp.search_params['from'],
        resp.search_params['amount'] * conversion_rate,
        resp.search_params['to'],
        conversion_rate,
        resp.search_params['from_name'],
        resp.search_params['to_name'],
    )

    url = 'https://duckduckgo.com/js/spice/currency/1/{0}/{1}'.format(
        resp.search_params['from'].upper(), resp.search_params['to'])

    results.append({'answer': answer, 'url': url})
    source_url = 'https://www.xe.com/currencyconverter/convert/?Amount=1&From={0}&To={1}'.format(
        resp.search_params['from'], resp.search_params['to']
    )

    results.append({'template': 'currency.html',
                    'amount': resp.search_params['amount'],
                    'from': resp.search_params['from'],
                    'to': resp.search_params['to'],
                    'value': round(resp.search_params['amount'] * conversion_rate, 2),
                    'conversion_rate': round(conversion_rate, 2),
                    'source_url': source_url,
                    'url': url})
    return results
+1 −1
Original line number Diff line number Diff line
@@ -341,7 +341,7 @@ engines:
    engine : currency_convert
    categories : general
    shortcut : cc
    disabled: True
    disabled: False

  - name : deezer
    engine : deezer
+22 −1
Original line number Diff line number Diff line
@@ -731,7 +731,7 @@ input:checked + .slider:before {
  justify-content: space-between;
  font-size: 14px;
  padding-bottom: 16px;
  padding-top: 16px;
  padding-top: 24px;
  padding-left: 24px;
  padding-right: 24px;
}
@@ -996,6 +996,27 @@ input:checked + .slider:before {
.result.result-torrent {
  margin-bottom: 32px;
}
.result .currency-value {
  font-family: 'Noto Sans';
  color: var(--color-currency-value);
  font-style: normal;
  font-weight: 700;
  font-size: 30px;
  padding-bottom: 15px;
}
.result .currency-info {
  font-family: 'Noto Sans';
  color: var(--color-currency-value);
  font-style: normal;
  font-weight: 400;
  font-size: 18px;
}
.conversion {
  margin-right: 15%;
}
.source {
  display: inline-block;
}
.result.result-images {
  display: inline;
}
+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@
@fontsize_large: 18px;
@fontsize_x-large: 22px;
@fontsize_xx-large: 22px;
@fontsize_xxx-large: 30px;

@spacing_xx-small: 2px;
@spacing_x-small: 4px;
Loading