|
|
Mensaje: #1
Descargar fondos de pantalla para GNOME
Teniendo en cuenta el tip que encontré sobre GNOME ( pueden ver haciendo clic aquí ), decidí por hacer un script en Python que facilitara un poco la tarea...
Es algo sencillo y simple, lo hice sólo para entretenerme un rato.
Código:
#!/usr/bin/python
# -*- coding: utf-8 -*-
from ftplib import FTP
import re, urllib, os
def ArrayFilter(lList, sScreen):
pReg = re.compile(r'.+'+sScreen+'.{4,5}')
nList = []
for i in lList:
iterator = pReg.finditer(i)
for match in iterator:
nList.append(match.group())
return nList
def WriteFileAndDownload(sFilenames):
tFile = open(os.environ['HOME']+'/tmpWall.txt','wb')
for i in sFilenames:
tFile.write('ftp://ftp.gnome.org/pub/GNOME/teams/art.gnome.org/backgrounds/'+i+'\n')
tFile.close()
os.system('wget -i '+os.environ['HOME']+'/tmpWall.txt')
def DownloadWallpapers(sResolution):
ftp = FTP('ftp.gnome.org')
ftp.login()
ftp.cwd('pub/GNOME/teams/art.gnome.org/backgrounds')
lWalls = ArrayFilter(ftp.nlst(),sResolution)
ftp.close()
if len(lWalls) > 0:
print 'Hay un total de: ',len(lWalls),' wallpapers'
opD = raw_input('==> ¿Desea descargarlos todos? (s/n) >>> ')
if opD.upper() == 'S':
WriteFileAndDownload(lWalls)
else:
sLimit = input('==> ¿Cuántos desea descargar? >>> ')
WriteFileAndDownload(lWalls[0:sLimit])
else:
print 'No hay wallpapers con ese tamaño. Adèu'
Resolution = raw_input('\nIngrese la resolución de su pantalla (ej. 1024x768) >>> ')
DownloadWallpapers(Resolution)
P.D.: Lo puse sin GeSHi ya que tuve problemas con él...
Saludos.,
"The only thing they can't take from us are our minds."
(Este mensaje fue modificado por última vez en: 08-07-2011 08:28 AM por .:WindHack:..)
|
|
| 08-07-2011 08:26 AM |
|
|
|
Mensaje: #2
RE: Descargar fondos de pantalla para GNOME
Sehhh, sigo sin poder corregir los problemas que existen con python en el geshi. :(
HTC Desire SLCD: S-OFF, cm7/r2 hboot, CyanogenMod Kernel, CyanogenMod NB 262
Samsung Galaxy S i9000: Chainfire Kernel (CF-ROOT), Value Pack ROM 2.3.6 JVU
SE Xperia x10i: Unlocked Bootloader, FXP052 Kernel, CyanogenMod 7.2.0 FXP052
Motorola Dext MB200: CyanogenMod 7.1 RC1
LG Optimus One P500: Stock ROM 2.3.3
ZTE Racer: Stock
|
|
| 08-07-2011 12:20 PM |
|