replace accents when getting thetvdb series - rss

I'm trying to replace accent mark so I can search properly at my rss:
TVDB name: Cómo vender drogas online (a toda pastilla)
RSS title name: Como vender drogas online (a toda pastilla)
and I want to match this so it can be replaced, but isn't working
manipulate:
- title:
replace:
regexp: 'á'
format: 'a'
- title:
replace:
regexp: 'é'
format: 'e'
- title:
replace:
regexp: 'í'
format: 'i'
- title:
replace:
regexp: 'ó'
format: 'o'
- title:
replace:
regexp: 'ú'
format: 'u'
My config.yml:
tv:
thetvdb_lookup:
language: es
configure_series:
from:
thetvdb_list:
username: '{? TvDB.username ?}'
account_id: '{? TvDB.account_id ?}'
api_key: '{? TvDB.api_key ?}'
strip_dates: yes
set:
path: {? path.externaldrive ?}
I want to replace accent mark like this:
á = a
So I can search properly

Related

HOT template for cinder volume with or without volume_type

I am trying to write a HOT template for Openstack volume, and need to have the volume_type as a parameter. I also need to support a case when the parameter is not given, and default to the Cinder default volume type.
First attempt was to pass null to the volume_type , hoping it would give the default volume type. However no matter what I pass (null, ~, default, "" ) , seems there is no way to get the default volume type.
type: OS::Cinder::Volume
properties:
name: test
size: 1
volume_type: { if: ["voltype_given" , {get_param:[typename]} , null] }
Is there any way to get the default volume type , when you have the "volume_type" property defined?
Alternatively, is there any way to have the "volume_type" property itself behind a conditional? I tried several ways, but no luck. Something like:
type: OS::Cinder::Volume
properties:
if: ["voltype_given" , [ volume_type: {get_param:[typename]} ] , ""]
name: test
size: 1
ERROR: TypeError: : resources.kk-test-vol: : 'If' object is not iterable
Could you do something like this?
---
parameters:
typename:
type: string
conditions:
use_default_type: {equals: [{get_param: typename}, '']}
resources:
MyVolumeWithDefault:
condition: use_default_type
type: OS::Cinder::Volume
properties:
name: test
size: 1
MyVolumeWithExplicit:
condition: {not: use_default_type}
type: OS::Cinder::Volume
properties:
name: test
size: 1
volume_type: {get_param: typename}
# e.g. if you need to refer to the volume from another resource
MyVolumeAttachment:
type: OS::Cinder::VolumeAttachment
properties:
instance_uid: some-instance-uuid
volume_id:
if:
- use_default_type
- get_resource: MyVolumeWithDefault
- get_resource: MyVolumeWithExplicit

Symfony Assert validation with yaml

I have mapped my entity with yaml and I'm using the assert to add some constraint for certain field.
So I follow the documentation and put my validation in this file:
# src/AppBundle/Resources/config/validation.yml
it works...
But I want to separate my validation. I need one file for one entity.
So I did it that way:
# src/AppBundle/Resources/config/validation/DeliveryAddress
# src/AppBundle/Resources/config/validation/BillingAddress
But it does not seem to work that way.
Here one of my file:
# src/AppBundle/Resources/config/validation/DeliveryAddress.yml
AppBundle\Entity\DeliveryAddress:
properties:
address:
- NotBlank: ~
zipCode:
- NotBlank: ~
- Regex:
pattern: '/^[0-9]{5}$/'
match: false
message: 'Le code postal que vous avez saisi n’est pas valide'
town:
- NotBlank: ~
firstName:
- NotBlank: ~
lastName:
- NotBlank: ~
How can I do that?
This works natively since symfony 2.7
https://github.com/symfony/symfony/pull/13855
The problem was because match was to false
zipCode:
- NotBlank: ~
- Regex:
pattern: '/^[0-9]{5}$/'
match: false

ansible flattened map filter results

I'm using Ansible's map filter to extract data, but the output is a list of lists; what I need is a flattened list. The closest I've come is illustrated by the "energy.yml" playbook below. Invoke as
ansible-playbook ./energy.yml --extra-vars='src=solar'
---
- hosts: localhost
vars:
region: [ 'east', 'west' ]
sources:
wind:
east:
filenames:
- noreaster.txt
- gusts.txt
- drafty.txt
west:
filenames:
- zephyr.txt
- jetstream.txt
solar:
east:
filenames:
- sunny.txt
- cloudy.txt
west:
filenames:
- blazing.txt
- frybaby.txt
- skynuke.txt
src: wind
tasks:
- name: Do the {{ src }} data
debug:
msg: "tweak file '/energy/{{src}}/{{ item[0] }}/{{ item[1] }}'."
with_nested:
- "{{ region }}"
- "{{
(region|map('extract',sources[src],'filenames')|list)[0] +
(region|map('extract',sources[src],'filenames')|list)[1]
}}"
when: "item[1] in sources[src][item[0]].filenames"
The output of the map() filter is a number of lists the same length as "region". Jinja's "+" operator is the only mechanism I've found to join lists, but since it's a binary operator rather than a filter, I can't apply it to an arbitrary number of lists. The code above depends on "region" having length 2, and having to map() multiple times is ugly in the extreme.
Restructuring the data (or the problem) is not an option. The aspect I'd like to focus on is flattening the map() output, or some other way of generating the correct "msg:" lines the code above does
sum filter with start=[] is your friend:
region | map('extract',sources[src],'filenames') | sum(start=[])
From this:
[
[
"noreaster.txt",
"gusts.txt",
"drafty.txt"
],
[
"zephyr.txt",
"jetstream.txt"
]
]
It will do this:
[
"noreaster.txt",
"gusts.txt",
"drafty.txt",
"zephyr.txt",
"jetstream.txt"
]

RMarkdown: citecolor LaTeX option not being used

I am trying to create a JSS article using RMarkdown, but am not able to get options that typically get used with pdf_document, in particular, the citecolor option.
Here is an MWE, which is the standard JSS template that ships with the rticles package:
---
author:
- name: FirstName LastName
affiliation: University/Company
address: >
First line
Second line
email: name#company.com
url: http://rstudio.com
- name: Second Author
affiliation: Affiliation
title:
formatted: "A Capitalized Title: Something about a Package \\pkg{foo}"
# If you use tex in the formatted title, also supply version without
plain: "A Capitalized Title: Something about a Package foo"
# For running headers, if needed
short: "\\pkg{foo}: A Capitalized Title"
abstract: >
The abstract of the article.
keywords:
# at least one keyword must be supplied
formatted: [keywords, not capitalized, "\\proglang{Java}"]
plain: [keywords, not capitalized, Java]
preamble: >
\usepackage{amsmath}
output: rticles::jss_article
citecolor: blue
references:
- id: fenner2012a
title: One-click science marketing
author:
- family: Fenner
given: Martin
container-title: Nature Materials
volume: 11
URL: 'http://dx.doi.org/10.1038/nmat3283'
DOI: 10.1038/nmat3283
issue: 4
publisher: Nature Publishing Group
page: 261-263
type: article-journal
issued:
year: 2012
month: 3
---
# Introduction
[#fenner2012a]
# References
This does not highlight the reference to be blue. Do I have to adapt the entire template to change the one parameter?

Import DateTime using Nemo/Alice bundle

My question is about this bundle: https://github.com/nelmio/alice in combination with Symfony2.
I have some fixture i want to load in my new website, and this bundle is great for that. I created some YML files and consider the following YML as my fixturedata:
DateTime (local):
news-date-1:
__construct: ['2014-07-01']
Stef\BVBundle\Entity\Blog:
StefBVBundle-Blog-1:
title: 'A day with blah'
blog: 'e5645646'
image: 'beach.jpg'
author: 'dsyph3r'
tags: 'symfony2, php, paradise, symblog'
created: #news-date-1
updated: #news-date-1
StefBVBundle-Blog-2:
id: 1
title: 'meeeh'
author: dsyph3r
blog: '5rw5425'
image: beach.jpg
tags: 'symfony2, php, paradise, symblog'
created: '2014-07-01T00:00:00+0200'
updated: '2014-07-01T00:00:00+0200'
The one labelled with 'StefBVBundle-Blog-1' works like a charm, it knows 'created' and 'updated' are \DateTime values.
But 'StefBVBundle-Blog-2' causes an error, because the Nemo/Alice bundle consider it as a string, instead of a DateTime. Is it possible to do the DateTime-part inline?
PHP Expressions inside <( )> are simply passed to Doctrine, so this will do the work :
Stef\BVBundle\Entity\Blog:
StefBVBundle-Blog-2:
created: <(new \DateTime('2014-02-02'))>
Regarding the doc of Faker library, you have to specify a DateTime instance, or DateTimeBetween with no time-laps if you want an exact date.
Your code, with correction:
DateTime (local):
news-date-1:
__construct: ['2014-07-01']
Stef\BVBundle\Entity\Blog:
StefBVBundle-Blog-1:
title: 'A day with blah'
blog: 'e5645646'
image: 'beach.jpg'
author: 'dsyph3r'
tags: 'symfony2, php, paradise, symblog'
created: #news-date-1
updated: #news-date-1
StefBVBundle-Blog-2:
id: 1
title: 'meeeh'
author: dsyph3r
blog: '5rw5425'
image: beach.jpg
tags: 'symfony2, php, paradise, symblog'
created: <dateTimeBetween('0 days', '2014-07-01T00:00:00+0200')>
updated: <dateTimeBetween('0 days', '2014-07-01T00:00:00+0200')>
Didn't try, but should work.

Resources