Organizador de filmes para o IMDB
Publicado por Renan Samuel da Silva (última atualização em 31/01/2013)
[ Hits: 4.691 ]
Homepage: http://chaotic-renan.tumblr.com/
Olá, como um grande fã de filmes estou sempre de olho no IMDB. Recentemente eu estava dando uma olhada no top 250 para procurar alguns bons filmes e senti a falta de um filtro, principalmente por datas. Então como um bom usuário de GNU/Linux, fiz um programa e estou compartilhando.
/*
* This program is intended to sort the movies from top250 of imdb acording to
* the movies date.
*
* There is no warranty that this will work and i am not respossibly for any
* harm that this program may cause(but i doubt it can happen).
*
* I know that there are better ways to do what this program does, i just was
* in a hurry to sort the movies and this come in my head fisrt.
*
* This is a opensource code and you can do whatever you want with it. Be kind
* and keep it opensource.
*
* You can use curl to download the source code of the page and put that in a
* file name 'dump' and the run this program.
*
* You can compile it using gcc sorter.c -o sorter on terminal and running using
* ./sorter case you are using linux. If you use windows, i cannot help you.
* Case you want to put the output in a file you can do something like
* ./sorter > top250_sorted_by_year
*
* This should work for more pages that are not the top250, i havenot tried.
*
* You can emailme on uber.renan@gmail.com to ask anything about this.
*
* Use free software and be cool.
*
* This was made bye Renan Samuel da Silva
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct{
char name[100];
int date;
}_movie;
int main(int argc, char *argv[]){
FILE *file=fopen("dump","rt");
char c;
char date[5];
char name[100];
int cont=0,pivot,w=0;
int i,j;
_movie movie[250];
_movie tmp;
while(!feof(file)){
c=fgetc(file);
if(c=='('){
c=fgetc(file);
if(c>='0' && c<='9'){
date[0]=c;
date[1]=fgetc(file);
date[2]=fgetc(file);
date[3]=fgetc(file);
date[4]='{FONTE}';
if((strcmp(date,"1|2)")==0) || (strcmp(date,"9)) ")==0))
continue;
cont++;
//printf("%s",date);
movie[w].date=atoi(date);
fseek(file,-11,SEEK_CUR);
c=fgetc(file);
while(1){
if(c=='/'){
c=fgetc(file);
if(c=='"'){
c=fgetc(file);
if(c=='>'){
pivot=0;
c=fgetc(file);
while(c!='<'){
name[pivot++]=c;
c=fgetc(file);
}
name[pivot]='{FONTE}';
strcpy(movie[w++].name,name);
break;
}
}
}
fseek(file,-2,SEEK_CUR);
c=fgetc(file);
}
//printf(" -- %s\n",name);
fseek(file,17,SEEK_CUR);
}
}
}
for(i=0;i<250;i++){
for(j=0;j<249;j++){
if(movie[j].date<movie[j+1].date){
tmp=movie[j];
movie[j]=movie[j+1];
movie[j+1]=tmp;
}
}
}
for(i=0;i<250;i++){
printf("%d - %s\n",movie[i].date,movie[i].name);
}
//printf(" -- cont=%d\n",cont);
fclose(file);
return EXIT_SUCCESS;
}
Números de caracteres em arquivo
Listar arquivos e diretórios com suas propriedades
Alfabeto escrito 30 vezes e operação XOR
Nenhum comentário foi encontrado.
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Novos apps de produtividade, avanços em IA e distros em ebulição agitam o universo Linux
Como instalar o repositório do DBeaver no Ubuntu
Como instalar o Plex Media Server no Ubuntu
Digitando underscore com "shift" + "barra de espaços"
Como ativar a lixeira e recuperar aquivos deletados em um servidor Linux
Como mudar o nome de dispositivos Bluetooth via linha de comando
dpkg: erro: gatilho de arquivo duplicado chamado pelo arquivo de nome (6)
Instalação não está resolvendo as dependencias (2)
Captação de áudio no zorin linux começa a diminuir com o tempo (5)
Alternativas ao Multilogin para gerenciamento de múltiplas contas/prof... (0)









