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

L'Europa conta nella tecnologia e può essere autonoma. Cosa si è detto al Nextcloud Summit 2026
L'Europa conta nella tecnologia e può essere autonoma. Cosa si è detto al Nextcloud Summit 2026
La parola d'ordine al Nextcloud Summit 2026, che si è tenuto a Monaco, è stata "sovranità". Non come è spesso usato questo termine in politica ma, al contrario, come capacità positiva di decidere il proprio destino tecnologico, con modalità collaborative e aperte. L'Europa dice già molto nel mondo open source, che viene visto come mezzo per ottenere la tanto agognata autonomia digitale
Dreame X60 Pro Ultra Complete: i bracci si estendono sempre di più
Dreame X60 Pro Ultra Complete: i bracci si estendono sempre di più
Dreame X60 Pro Ultra Complete implementa due bracci estensibili, per spazzola e moccio, che si spingono ben oltre quanto visto sino ad oggi permettendo una pulizia di casa ancor più capillare e precisa
TCL 65C8L, la recensione del SQD-Mini LED da 4400 nit misurati
TCL 65C8L, la recensione del SQD-Mini LED da 4400 nit misurati
La tecnologia SQD-Mini LED di TCL arriva sul taglio da 65 pollici con la serie C8L: 2040 zone, pannello WHVA 2.0 e un picco che alle rilevazioni delle sonde tocca i 4400 nit nel profilo Filmmaker e un HDR quasi perfetto
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


L'Europa conta nella tecnologia e può essere autonoma. Cosa si è detto al Nextcloud Summit 2026 L'Europa conta nella tecnologia e può ess...
Dreame X60 Pro Ultra Complete: i bracci si estendono sempre di più Dreame X60 Pro Ultra Complete: i bracci si esten...
TCL 65C8L, la recensione del SQD-Mini LED da 4400 nit misurati TCL 65C8L, la recensione del SQD-Mini LED da 440...
MSI Maestro 500 Wireless: ANC e 90 ore di autonomia a 70 euro MSI Maestro 500 Wireless: ANC e 90 ore di autono...
NL-LC1 è il primo dissipatore a liquido AIO di Noctua: silenzio è la parola d'ordine NL-LC1 è il primo dissipatore a liquido A...
Lenovo Idea Tab Plus in offerta al Prime...
Hisense: il Prime Day sorprende con un T...
Reolink apre il Prime Day 2026 con scont...
Android 17 sui Pixel con qualche intoppo...
Prime Day, le offerte per i giocatori: M...
Una Tesla Model 3 sfonda una casa e ucci...
La cometa 3I/Atlas è una finestra sul "m...
NVIDIA punta sui data center AI raffredd...
Galaxy Watch Ultra 2 protagonista dei nu...
Valve svela i prezzi ufficiali di Steam ...
CORSAIR accelera per il Prime Day: scont...
Un commento di YouTube alimenta le specu...
GM lascia a casa 1300 operai della Facto...
Microsoft Kilby: il datacenter AI che di...
Recensione HONOR Earbuds 4: un nuovo rif...
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: 14:05.


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