Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: Pythonscript probleempje; Exaile G15Track: Plug-inarchief bevat een onveilig pad  (gelezen 720 keer)

Offline Willy4

  • Lid
Ik heb een Exaile plugin gedownload en probeer die nu aan de praat te krijgen. Als ik 'm wil installeren in Exaile krijg ik de melding: Installatie plug-inbestand mislukt!
Plug-inarchief bevat een onveilig pad.

misschien is er iemand hier die bekend is met python en kan zien waaraan dit ligt.
Dit is de inhoud van het python-script:

"""
    This plugin will display a GTK+ dialog with information about a song when
    it starts playing in Exaile
"""
from xl import event, common, trax, metadata
import os
import signal
import gobject
from subprocess import Popen

g15=None

def enable(exaile):
    global g15
    g15 = lcd(exaile)
   
def disable(exaile):
    global g15
    g15.destroy()

def teardown(exaile):
    global g15
    g15.destroy()
   
class lcd:
def __init__(self, exaile):
"""
Set everything up.
"""
import os
                self.exaile = exaile
self.path=os.environ['HOME']+'/.local/share/exaile/g15'
if (os.access(self.path,os.F_OK)): os.unlink(self.path)
os.mkfifo(self.path)
self.comp=Popen(['g15composer',self.path])
self.pipe=os.open(self.path, os.O_WRONLY)
self.updating = False
self.posstr=None
self.pos=None
self.pix=None
self.dur=None
if os.path.exists('/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf') and \
   os.path.exists('/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf'):
self.font=True
os.write(self.pipe,'FL 0 10 \"/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf\"\n')
os.write(self.pipe,'FL 1 9 \"/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf\"\n')
else: self.font=False
                event.add_callback(self.update_track, "playback_track_start")
                self.timer_id = gobject.timeout_add(1000, self.update_bar)
self.stopped()

def destroy(self):
                gobject.source_remove(self.timer_id)
                event.remove_callback(self.update_track, "playback_track_start")
os.kill(self.comp.pid+1,signal.SIGKILL)
if os.path.exists(self.path): os.unlink(self.path)

def stopped(self):
os.write(self.pipe,'PC 0\n')
if self.font:
os.write(self.pipe,'FP 0 10 0 0 1 1 \"Stopped\"\n')
else:
os.write(self.pipe,'TO 0 0 1 1 \"Stopped\"\n')

def update_pos(self):
posm=int(self.pos/60)
poss=self.pos%60
self.posstr='%(posm)d:%(poss)02d'%{'posm': posm, 'poss': poss}
                if self.font:
os.write(self.pipe,'FP 1 9 0 25 1 0 \"'+self.posstr+'\"\n')
else:
os.write(self.pipe,'TO 0 25 0 0 \"'+self.posstr+'\"\n')

def draw_bar(self):
os.write(self.pipe,'PF 0 25 20 33 0\n')
os.write(self.pipe,'PF 3 35 156 41 0\n')
os.write(self.pipe,'PF 3 35 '+str(self.pix)+' 41 1\n')

def update_track(self, atype, player, track):
title = track['title']
                if not title: title = ""
                elif type(title) == list or type(title) == tuple:
                    title = metadata.j(title)
                artist = track['artist']
                if not artist: artist = ""
                elif type(artist) == list or type(artist) == tuple:
                    artist = metadata.j(artist)
                album = track['album']
                if not album: album = ""
                elif type(album) == list or type(album) == tuple:
                    album = metadata.j(album)
                self.dur=self.exaile.player.current.get_duration()
durm=int(self.dur/60)
durs=self.dur%60
durstr='%(durm)d:%(durs)02d'%{'durm': durm, 'durs': durs}
os.write(self.pipe,'PC 0\n')
if self.font:
os.write(self.pipe,'FP 0 10 0 0 1 1 \"'+title+'\"\n')
os.write(self.pipe,'FP 1 9 0 11 1 1 \"'+artist+'\"\n')
os.write(self.pipe,'FP 1 9 0 21 1 1 \"'+album+'\"\n')
                        if(self.exaile.player.current.is_local()):
                            os.write(self.pipe,'FP 1 9 0 25 1 2 \"'+durstr+'\"\n')
                        else:
                            os.write(self.pipe, 'FP 2 34 157 42 1 1 \"Streaming...\"\n')
else:
os.write(self.pipe,'TO 0 0 1 1 \"'+title+'\"\n')
os.write(self.pipe,'TO 0 11 0 1 \"'+artist+'\"\n')
os.write(self.pipe,'TO 0 21 0 1 \"'+album+'\"\n')
                        if(self.exaile.player.current.is_local()):
                            os.write(self.pipe,'TO 0 25 0 2 \"'+durstr+'\"\n')
                        else:
                            os.write(self.pipe, 'TO 0 30 1 1  \"Streaming...\"\n')
                           
                if(self.exaile.player.current.is_local()):
                    os.write(self.pipe,'PB 2 34 157 42 1 1 0\n')

def update_bar(self, *e):
if self.exaile.player.is_playing():
                        if not self.exaile.player.current.is_local():
                            self.update_track(None, None, self.exaile.player.current)
perc=self.exaile.player.get_progress()
self.pos=self.exaile.player.get_time()
self.pix=int(round(perc*153)+3)
self.update_pos()
                        if self.exaile.player.current.is_local():
                            self.draw_bar()
elif self.exaile.player.is_paused() != True:
                        self.stopped()
                return True
Alvast bedankt voor het meedenken :)

Groet, Willy
1)Asus N53SV, Intel Core I7 - 2630QM - 2.0Ghz , 6GB RAM, 750GB HD / Optimus: nVidia GeForce GT540M / Intel VGA controler /Ubuntu 14.04/ Windows7
2)2× Intel(R) Pentium(R) 4 / CPU: 3.00GHz /  Samsung SyncMaster 930BF /  nVidia GeForce 7300 GT / Logitech Z-10 USB Speakers / 300GHz Sata350 (Ubuntu 12.04 / Xubuntu 14.04) / 250GHz Sata1 (opslag)

Offline Willy4

  • Lid
'k Gooi deze nog even in de herhaling.
Je weet maar nooit. :)
1)Asus N53SV, Intel Core I7 - 2630QM - 2.0Ghz , 6GB RAM, 750GB HD / Optimus: nVidia GeForce GT540M / Intel VGA controler /Ubuntu 14.04/ Windows7
2)2× Intel(R) Pentium(R) 4 / CPU: 3.00GHz /  Samsung SyncMaster 930BF /  nVidia GeForce 7300 GT / Logitech Z-10 USB Speakers / 300GHz Sata350 (Ubuntu 12.04 / Xubuntu 14.04) / 250GHz Sata1 (opslag)