PGFernandes.pt

Tool Maker

0 notes

RSS to WebHooks

image

“Is hard to keep tracking all your Tv Series?”
Why not code a script to do that for you and notifies you on new releases.
Ok, I also wanted to play with RSS and WebHooks and that would be perfect to this project.

Idea: I will check a RSS feed for new items and notify of those changes.
For notifications I will use: desktop popups, slack (webhook) & discord (webhook).

So this is how I setup the script:

Configs:

I found a website that releases that information, every time an episode is out but they have lots of tv shows on that list and I only want some of them.

  • Solution: Have a config file where I select witch ones I want.

“<name of the show / part of the name on the feed>”: {
 "slack": [ "https://hooks.slack.com/services/…“],
 "discord”: [ “https://discordapp.com/api/webhooks/…”  ],
 "popup”: <if you want to popup a notification on desktop>,
 "open": <if you want to open in your default program>,
 "color": “<color related to the show>”,
 "pic": “<img that represents this show>”,
 "link": “<for the infos about this show>”,
 "epd": <current epd>

as an example for this post, I will be using one anime called “Boruto”:

image


RSS Feed:

RSS (Rich Site Summary; originally RDF Site Summary; often called Really Simple Syndication) is a type of web feed[2] which allows users to access updates to online content in a standardized, computer-readable format.

For the RSS feed reader, I’m using this awesome lib “feedparser

def downloadFeed(settings):
rss = feedparser.parse(settings[“rss”][“url”])
for post in rss.entries:
   for serie in settings[“series”]:
       if serie in post.title:

From there I:
# clean/parse the title so I can get the episode for that serie
# check if the episode is bigger then the current one on the configs
# return the clean feed to next phase


Actions:

- Slack & Discord WebHooks

These platforms have the ability of setup webhooks and send especial formatted messages (First picture, right Discord and left Slack)

WebHook:
is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST. A web application implementing WebHooks will POST a message to a URL when certain things happen.


- Open & Desktop Notifications:

I made so I can select 2 more options on the config file, “open” and “popup”.
For the “open with default program”, I found a simple solution:

image

For the “popup notifications”, I’m using “pync” that let you customize the popup with text and links and other fields.

image


- Timer / AutoRun

Now you just setup a timer to run it. So I’m using “crontab”

*/15 * * * * [script here] > [log file] 

This will run every 15mins and save a log if anything goes bad.

… and that’s it! a Simple way to keep track of your Tv Shows.

I still have some ideas for this project and there still room to improve it, but is a nice base for future project using RSS and Webhooks.



Have a nice day

Filed under RSS webhook discord slack dev

1 note

So today I saw this..
A couple of friends, saw my “version” of “PokeVision” and they ask me to give them those scripts.
To give some context, “Pokevision” is a website to help a “pokemon master” to find pokemons in the real world (at this moment, the...

So today I saw this..
A couple of friends, saw my “version” of “PokeVision” and they ask me to give them those scripts.

To give some context, “Pokevision” is a website to help a “pokemon master” to find pokemons in the real world (at this moment, the “nearby” sensor is glitch’ed so people are forced to use maps like those).

I decided to go a step further and made a chrome extension app with all the styling and scripts in one package and easy to install. I sent the link and thats it. End of the history.. I though.

Today I saw that “pokevision” decided to close. (Tweet: https://twitter.com/PokeVisionGo/status/759666743115513856 )
and I went to remove the app and I was surprised that I had 232 people using it!

Nice I guess. I was working on a new update but looks like I’m going to end this small project for now.

Filed under pokemon chrome extension pokevision dev app maps pokemonGo project

0 notes

Do you guys remember this project? [ Matriz de Led’s ]

I got this Rasbperry Pi Zero and a panel of 11x5 led panel and if was fun to send text to it. But I need it more… then I remember of my “Big led panel code” and saw the potential to adapt it so I could draw on my new “Mini led panel”.

I just used the same code that I made of it and change some vars X, Y, Color Array (to white and black) and the function to generate the output code (in this case didn’t need to send to an Arduino) and BAM!

The only “new thing” I made was an web API, to receive a JSON string with the command and data needed for that command. Now I can send messages, draw and run loaded scripts for everywhere to my new “mini led panel”.

I even let some friends control while I was changing the UI, so I could be surprised with the results. Here one of those drawing… I think it’s a boat :)

image

PLUS:
I also did a web crawler to get #EURO2016 result from a website. I wanted to see the score for Portugal games  on my panel. So I mad the crawler program to send and display the score using the LedPanel webAPI that I also made.

(Portugal goal)

image

Where the result: 

(island goal)

image

Spoiler: Portugal Won ;) 

When you’re curious, you find lots of interesting things to do. - Walt Disney

Filed under dev development UI API webAPI leds led panel software euro2016 portugal pixel art raspberry pi rpi

0 notes

LightLog.status

image

- Ideia: know when a room is being used and make a log of how much was used.
- Why: This is for a room used by several people, but they can only use if someone from the administration is there to open the door (aka inside the room). Then I’ve this idea for a system that warns/tell users if there is anyone on the room.
- Resources: I only used what was available in that room and that’s was an old webcam and an old pc.
- Location: Room (in basement, so you need to have the light on every time you use)

I already had some basic’s about python and I never use openCV, so this project was all an excuse to learn a little more.


Tools: Python (w/ openCV) + Bash + Twitter + iOS Notification + GoogleCal  

Python (w/opencv) | https://www.python.org/ |  http://opencv.org/

Logs & Notification (Twitter), iOS Notification (Prowl), Calendar (GoogleCal):
- I was already using all this programs on my system, so I used all the tools that I already made (so just an interaction with my bash script)

Crontab - Since is an old pc, I made so it check/run every “x” minutes.


The result: 
- Render the img from the webcam, using a threshold that transforms the picture in black & white and then I make a 3 regions, 2 for control and one for the whites. 

image

Read more …

Filed under python opencv twitter push googlecal dev lightlog

0 notes

Projecto | Matriz de Led’s

[ IN PORTUGUESE ]
imageSó um exemplo, com esta aplicação é possível mudar a cor dos led’s entre outras funções. 

A aplicação que estou a criar permite que varias pessoas ao mesmo tempo, possam escrever/desenhar na matriz usando apenas o seu Portatil, MacBook, iPad, iPhone, Android, WindowsPhone, etc, e possam  mostrar aos seus colegas e amigos a sua mensagem/desenho na sede do NEI.

>> Para isso basta estar conectado a Eduroam e aceder aqui: PixelDraw  [LINK AQUI BREVEMENTE!] 

Nota: O projecto ainda é beta, o que quer dizer que com o tempo ainda vai melhorar, tanto o aspecto como funcionalidades.

F.A.Q____________________________________________

  • Porque varias pessoas ao mesmo tempo?

Achei que seria uma boa experiência social, ver se as pessoas ajudam umas as outras a criar algo mais ou simplesmente uma anarquia para ver quem controla mais área da matriz :)

  • Porque que só consigo aceder na UALG?

Porque programei para ser necessário estar conectado a “Eduroam” (rede wifi da UAlg), desta maneira podemos controlar o acesso e só permitir a pessoas que realmente podem ver o resultado na matriz. 
Se for o caso de não sejas estudante ou professor da UAlg e quereres usar a matriz podes sempre passar pelo NEI, que nos damos te acesso :)

  • O que que usas-te para programar esta aplicação?

“Um pouco de tudo”, a maior para te do projecto foi feito usando  html5, javascript e css3, para que pudesse ser usado em qualquer plataforma tanto no telemovel do pedro como o portatil da ana.
  

Acerca deste projecto____________________________

Desenvolvido na Universidade do Algarve pelo “Núcleo de Electrónica e Informática” o qual faço parte.

Utilizando a própria sala da sede como matriz foi feita uma armação em madeira e plástico em que o objectivo seria colocar os led de forma a que ficassem alinhados com cada quadrado da janela. 
A matriz consiste em 8 linhas e 16 colunas de Led’s RGB, controlados por um arduino e atraves da porta COM podemos controlar tanto a cor dos leds como a posição. 
image

imageUm exemplo de um dos quadrantes, com os leds todos ligados e com a cor azul.

Filed under leds matriz programming

0 notes

Update: Nei App - Closed Project

I’m very sad to announce that this app is shutting down. 
After many weeks of codding on this project will be discontinued. Despite the devotion of partners giving me motivation to continue developing, it has become difficult to keep up with the database, changing all the time because of security measure’s. I’m incredibly thankful for the support the partners had over the weeks and hope that new system that they’re working on, stay more stable then the last one.


____For the users with last version of NEI App (in Portuguese)____

Como usar:

  1. Para usar a aplicação  basta simplesmente clicar no botão com o icone “NEI app”, perto da barra de endereços.
  2. Se for a primeira vez, será pedido o seu nome (o nome do sócio) para registar a Aplicação.
  3. A partir desse momento vai poder ver as suas informações e registar novos cafés com um único botão, directamente do seu browser.
     
    Informações disponíveis:
  • Lugar no Top Sócios
  • Lista de todos os registos de café/chá tirados
  • Quanto poupou/gastou no ultimo mês  
  • Quanto poupou/gastou no total (desde que consumiu pela 1ª vez)

    …e muito mais.

Filed under nei app closed over