Torna indietro   Hardware Upgrade Forum > Software > Linux, Unix, OS alternativi

Marvel's Wolverine, la recensione: Logan torna protagonista in un'avventura brutale e intensa
Marvel's Wolverine, la recensione: Logan torna protagonista in un'avventura brutale e intensa
Marvel's Wolverine porta Logan in un'avventura inedita, violenta e fortemente narrativa, costruita attorno alla sua natura di combattente e al difficile rapporto con il proprio passato. Insomniac Games punta su combattimenti spettacolari, progressione e personalizzazione, inserendo l'azione in un mondo segnato dalla persecuzione dei mutanti. Un viaggio intenso, che alterna mattanza, esplorazione e momenti sorprendentemente emotivi.
DJI Romo 2: tante novità lo rendono un robot completo
DJI Romo 2: tante novità lo rendono un robot completo
Romo 2 è la seconda generazione di robot lavapavimenti di DJI, un modello che si caratterizza per la precisione nel sistema di navigazione e per il funzionamento particolarmente silenzioso. Con le modifiche introdotte in questa seconda versione, e un posizionamento di prezzo più allineato alla concorrenza, rappresenta una valida alternativa sul mercato delle soluzioni di pulizia domestica
Sony Bravia 9 II: il True RGB alla prova, dove l'LCD sfida l'OLED
Sony Bravia 9 II: il True RGB alla prova, dove l'LCD sfida l'OLED
Il primo Sony con retroilluminazione True RGB alla prova del banco di misura e dei contenuti: luminanza enorme, colori accurati in HDR e un antiriflesso molto efficace. I limiti sono due sole HDMI 2.1 e il blooming fuori asse
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 24-10-2005, 21:02   #1
lnessuno
Bannato
 
L'Avatar di lnessuno
 
Iscritto dal: Feb 2000
Città: The city of wasting disease
Messaggi: 7392
In-utility: visualizzare nella signature ciò che sta suonando amarok

se qualcuno fosse interessato... ho modificato uno script che ho trovato da qualche parte.

praticamente installando questo script in amarok, e configurandolo con il proprio nome utente e password, è possibile dire al proprio lettore di scrivere quello che sta suonando nella signature di questo forum... (vedi mia sign).

non serve a nulla però è carino


questo è il codice:

[code]#!/usr/bin/env python

# Depends on ClientForm hacked on line 2853

__module_name__ = "amarok_HWU_nowplaying"
__module_version__ = "0.1"
__module_description__ = "python module for displaying nowplaying on the hwupgrade forum : http://forum.hwupgrade.it"

import ConfigParser
import Queue
import os.path
import sys
import threading
import re
from os import *
# I don't have found pcop for Mandriva :-(
#import pcop
import ClientForm
import cookielib, urllib2
import commands

try:
from qt import *
except:
popen( "kdialog --sorry 'PyQt (Qt bindings for Python) is required for this script.'" )
raise

debug_prefix = "[AmaroK HWUNowPlaying Script]"

class ConfigDialog( QDialog ):
""" Configuration widget """

def __init__( self ):
self.load()
QDialog.__init__( self )
self.setWFlags( Qt.WDestructiveClose )
self.setCaption( "HWU Now Playing - amaroK" )

self.lay = QHBoxLayout( self )

self.vbox = QVBox( self )
self.lay.addWidget( self.vbox )

self.hboxLoginPassText = QHBox( self.vbox )
self.vboxLoginPass = QVBox( self.hboxLoginPassText )
self.vboxLoginPass.setMargin(5)

QLabel( "Username e password del forum", self.vboxLoginPass )

# Nickname
self.hboxLogin = QHBox( self.vboxLoginPass )
self.hboxLogin.setMargin(5)
QLabel( "User name : ", self.hboxLogin )

self.lineEdit1 = QLineEdit(self.hboxLogin,"lineEdit1")
self.lineEdit1.setGeometry(QRect(20,20,131,23))
self.lineEdit1.setText(self.username)

# Password
self.hboxPass = QHBox( self.vboxLoginPass )
self.hboxPass.setMargin(5)
QLabel( "User password : ", self.hboxPass )
self.lineEdit1_2 = QLineEdit(self.hboxPass,"lineEdit1_2")
self.lineEdit1_2.setGeometry(QRect(20,50,131,23))
self.lineEdit1_2.setEchoMode(QLineEdit.Password)
self.lineEdit1_2.setText(self.password)

explanation = QLabel( "Scrivi qua la tua signature!<br>Le parole racchiuse fra i caratteri '$' saranno interpretate come variabili di AmaroK. Quindi $artista$ visualizza il nome dell'artista, $title$ il titolo etc. Per avere la lista completa di queste variabili, scrivi in una console 'dcop amarok player '.", self.hboxLoginPassText )
explanation.setMargin(8)

# NowPlaying
self.hbox3 = QHBox( self.vbox)
self.hbox3.setMargin(5)
QLabel( "Testo in lettura: ", self.hbox3 )
self.lineEdit3 = QLineEdit(self.hbox3,"lineEdit3")
self.lineEdit3.setGeometry(QRect(20,20,231,23))
self.lineEdit3.setText(self.formatNowPlaying)
self.lineEdit3.setCursorPosition(0)

# NowPlayingPause
self.hbox5 = QHBox( self.vbox)
self.hbox5.setMargin(5)
QLabel( "Testo in pausa: ", self.hbox5 )
self.lineEdit5 = QLineEdit(self.hbox5,"lineEdit5")
self.lineEdit5.setGeometry(QRect(20,20,231,23))
self.lineEdit5.setText(self.formatNowPlayingPause)
self.lineEdit5.setCursorPosition(0)

# lastPlaying
self.hbox7 = QHBox( self.vbox)
self.hbox7.setMargin(5)
QLabel( "Testo fermo: ", self.hbox7 )
self.lineEdit7 = QLineEdit(self.hbox7,"lineEdit7")
self.lineEdit7.setGeometry(QRect(20,20,231,23))
self.lineEdit7.setText(self.formatLastPlaying)
self.lineEdit7.setCursorPosition(0)

# Buttons OK Cancel
self.hboxbuttons = QHBox( self.vbox )
self.hboxbuttons.setMargin(5)

self.ok = QPushButton( self.hboxbuttons )
self.ok.setText( "Ok" )

self.cancel = QPushButton( self.hboxbuttons )
self.cancel.setText( "Cancel" )
self.cancel.setDefault( True )

self.connect( self.ok, SIGNAL( "clicked()" ), self.save )
self.connect( self.cancel, SIGNAL( "clicked()" ), self, SLOT( "reject()" ) )

self.adjustSize()

def load( self ):
# defaults values
self.username = "username"
self.password = "password"
self.formatNowPlaying='Sto ascoltando: $artist$ - $title$'
self.formatNowPlayingPause='Sto ascoltando (pausa): $artist$ - $title$'
self.formatLastPlaying='Ultima canzone ascoltata: $artist$ - $title$'

""" Loads configuration from file """
self.config = ConfigParser.ConfigParser()
self.config.read( "VVnowplayingrc" )
try:
self.username = self.config.get( "General", "username" )
self.password = self.config.get( "General", "password" )
debug( "load :: Loaded from config file : username = " + str(self.username) + " ; password = " + "******\n");#str(self.password)
except:
debug("load :: No user/password found in the config file\n")
try:
self.formatNowPlaying = self.config.get( "General", "formatNowPlaying" )
self.formatNowPlayingPause = self.config.get( "General", "formatNowPlayingPause" )
self.formatLastPlaying = self.config.get( "General", "formatLastPlaying" )
except:
debug("load :: No display settings found in the config file\n")

def save( self ):
""" Saves configuration to file """

self.file = file( "VVnowplayingrc", 'w' )
self.config = ConfigParser.ConfigParser()
self.config.add_section( "General" )
debug( "save :: username = " + str(self.lineEdit1.text()) + " ; password = " + "******\n");
self.config.set( "General", "username", str(self.lineEdit1.text()))
self.config.set( "General", "password", str(self.lineEdit1_2.text()))
self.config.set( "General", "formatNowPlaying", str(self.lineEdit3.text()))
self.config.set( "General", "formatNowPlayingPause", str(self.lineEdit5.text()))
self.config.set( "General", "formatLastPlaying", str(self.lineEdit7.text()))
self.config.write( self.file )
self.file.close()

self.accept()

class Notification( QCustomEvent ):
__super_init = QCustomEvent.__init__
def __init__( self, str ):
self.__super_init(QCustomEvent.User + 1)
self.string = str


class VVNowPlaying( QApplication ):
""" The main application, also sets up the Qt event loop """

def __init__( self, args ):
QApplication.__init__( self, args )
debug( "Started.\n" )

self.queue = Queue.Queue()
self.startTimer( 100 )

# Start separate thread for reading data from stdin
self.stdinReader = threading.Thread( target = self.readStdin )
self.stdinReader.start()

self.username = "username"
self.password = "password"
self.formatNowPlaying='NP : $artist$ - $title$'
self.formatNowPlayingPause='NP (paused) : $artist$ - $title$'
self.formatLastPlaying='Last Played : $artist$ - $title$'

self.tags = {}
self.readSettings()

def readSettings( self ):
""" Reads settings from configuration file """
self.config = ConfigParser.ConfigParser()
self.config.read( "VVnowplayingrc" )
try:
self.username = self.config.get( "General", "username" )
self.password = self.config.get( "General", "password" )
debug( "readSettings :: Loaded from config file : username = " + str(self.username) + " ; password = " + "******\n");#str(self.password)
except:
debug("readSettings :: No user/password found in the config file\n")
try:
self.formatNowPlaying = self.config.get( "General", "formatNowPlaying" )
self.formatNowPlayingPause = self.config.get( "General", "formatNowPlayingPause" )
self.formatLastPlaying = self.config.get( "General", "formatLastPlaying" )
except:
debug("readSettings :: No display settings found in the config file\n")

############################################################################
# Stdin-Reader Thread
############################################################################

def readStdin( self ):
""" Reads incoming notifications from stdin """
while True:
# Read data from stdin. Will block until data arrives.
line = sys.stdin.readline()
if line:
self.queue.put_nowait( line )
else:
break

############################################################################
# Notification Handling
############################################################################

def timerEvent( self, event ):
""" Polls the notification queue at regular interval """
if not self.queue.empty():
string = QString( self.queue.get_nowait() )
debug( "Received notification: " + str( string ) )
if string.contains( "configure" ):
self.dia = ConfigDialog()
self.dia.show()
self.connect( self.dia, SIGNAL( "destroyed()" ), self.readSettings )
if string.contains( "engineStateChange: play" ):
self.nowplaying()
if string.contains( "engineStateChange: idle" ):
self.lastplaying()
if string.contains( "engineStateChange: pause" ):
self.nowplaying_pause()
if string.contains( "engineStateChange: empty" ):
self.lastplaying()
if string.contains( "trackChange" ):
pass

def nowplaying(self):
self.fetchTags();
self.formatDisplay(self.formatNowPlaying);
self.updateVVSignature(self.username,self.password,self.nowPlaying);

def nowplaying_pause(self):
self.formatDisplay(self.formatNowPlayingPause);
self.updateVVSignature(self.username,self.password,self.nowPlaying);

def lastplaying(self):
self.formatDisplay(self.formatLastPlaying);
self.updateVVSignature(self.username,self.password,self.nowPlaying);

# fetch info tags needed for displaying according to the format
def fetchTags(self):
self.tags['plop']='plop'
# fetch all formats, because some tags could be in other than the basic formatNowPlaying
for code in re.findall(r'\$[^\$]*\$',self.formatNowPlaying):
self.tags[code] = commands.getoutput('dcop amarok player '+code[1:-1]);
for code in re.findall(r'\$[^\$]*\$',self.formatNowPlayingPause):
self.tags[code] = commands.getoutput('dcop amarok player '+code[1:-1]);
for code in re.findall(r'\$[^\$]*\$',self.formatLastPlaying):
self.tags[code] = commands.getoutput('dcop amarok player '+code[1:-1]);

# build the string to be displayed according to the format
def formatDisplay(self,format):
self.nowPlaying = format
for code in re.findall(r'\$[^\$]*\$',self.nowPlaying):
try :
self.tags[code]
except:
# Occurs if running scripts when playing, and press pause or stop
self.fetchTags();
self.nowPlaying = self.nowPlaying.replace(code,self.tags
Codice:
);
		debug("fetchAmarokNP : " + str(self.nowPlaying) + "\n")
	
	def updateVVSignature(self,identifiant,password,signature) :
# 		debug("updateVVSignature : "+str(identifiant)+" - " + "******\n");
# 		debug("updateVVSignature : signature = "+str(signature)+"\n")
		# utilisation de cookie
		cj = cookielib.CookieJar()
		# ouverture de la connexion	
		opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
		
		# ouverture de la page d'identification
		responseIdentification = opener.open("http://www.hwupgrade.it/forum/index.php");
		# recuperation du formulaire
		formsIdentification = ClientForm.ParseResponse(responseIdentification);
		responseIdentification.close();
		formIdentification = formsIdentification[0];
		# remplissage du formulaire
		formIdentification["vb_login_username"] = identifiant;
		formIdentification["vb_login_password"] = password;
	
		# envoie du formulaire rempli
		requestAfterIdentification = formIdentification.click(type="submit")
		opener.open(requestAfterIdentification).close()
		
		# ouverture de la page de modification de la signature
		responseEditSignature = opener.open("http://www.hwupgrade.it/forum/profile.php?do=editsignature")
		# recuperation du formulaire
		formsEditProfile = ClientForm.ParseResponse(responseEditSignature);
		responseEditSignature.close();
		formEditProfile = formsEditProfile[0];
		# modification de la signature	
		formEditProfile["message"]=signature;
		# envoie du formulaire rempli
		requestAfterProfileUpdate = formEditProfile.click(type="submit")
		responseAfterProfileUpdate= opener.open(requestAfterProfileUpdate)
		responseAfterProfileUpdate.close()

############################################################################

def debug( message ):
	""" Prints debug message to stdout """
	sys.stderr.write(debug_prefix + " " + message)

def main( args ):
	app = VVNowPlaying( args )
	app.exec_loop()

if __name__ == "__main__":
	main( sys.argv )

salvare con il nome AmarokHWUnowPlaying.py e compattarlo con tar. poi da strumenti - gestione script si va su installa script, si punta il file et voilà... (una volta lanciato bisogna configurarlo cmq!)

boh a me serviva e l'ho fatto, se serve anche a qualcun altro... tanto meglio
lnessuno è offline   Rispondi citando il messaggio o parte di esso
Old 24-10-2005, 22:42   #2
SilverXXX
Senior Member
 
L'Avatar di SilverXXX
 
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
Truzzo il giusto
Io aspette la nuova release dikopete che permetta di usare i commenti, così lì caccio lì le canzoni. La mi asignature è personale e guai a chi la tocca
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror.
SilverXXX è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Marvel's Wolverine, la recensione: Logan torna protagonista in un'avventura brutale e intensa Marvel's Wolverine, la recensione: Logan torna p...
DJI Romo 2: tante novità lo rendono un robot completo DJI Romo 2: tante novità lo rendono un ro...
Sony Bravia 9 II: il True RGB alla prova, dove l'LCD sfida l'OLED Sony Bravia 9 II: il True RGB alla prova, dove l...
Geely EX5, un mese al volante: il SUV elettrico cinese che ci ha sorpreso (quasi) senza riserve Geely EX5, un mese al volante: il SUV elettrico ...
Mova Z70 Ultra Roller Complete: motore potente, rullo di lavaggio e l'IA a guidare Mova Z70 Ultra Roller Complete: motore potente, ...
Phanteks EX5: disponibile il case a bloc...
Broadcom rimuove l'accesso a uno strumen...
Italo porta Starlink sui treni ad Alta V...
Le GPU costano sempre di più, ma ...
IBM e NASA hanno insegnato a un'IA a leg...
Desktop Remoto non funziona su Windows S...
Offerte Amazon del giorno: da AirPods 5 ...
Motorola anticipa la sua prossima mossa ...
La manovra di Picard di Star Trek funzio...
EA Sports FC 27, pubblicata su Spotify l...
NSBProject misura quanto una startup &eg...
Instagram permette ora di aggiungere all...
Zuckoff scopre gli occhiali Meta attorno...
Samsung potrebbe lanciare i suoi primi o...
DLSS con Multi Frame Generation su RTX 2...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 13:00.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Served by www3v