HACKERS ELITE
Bienvenido a HACKERS ELITE
porfavor registrate o inicia secion para ver todo el contenido del foro, disfruta tu visita!

Unirse al foro, es rápido y fácil

HACKERS ELITE
Bienvenido a HACKERS ELITE
porfavor registrate o inicia secion para ver todo el contenido del foro, disfruta tu visita!
HACKERS ELITE
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.
Últimos temas
» Me bloquearon mi celular para conectarse a la Red Wifi en Modo Avion
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeVie Sep 05, 2014 6:15 pm por JAVIER_77

» Hacker nostale
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeVie Jul 20, 2012 5:02 pm por Sweet_Boy

» Chrome OS 20.x pasa al canal estable
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeVie Jul 13, 2012 11:15 pm por [D]ement<<<

» Disponible openSUSE 12.2 RC 1
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeVie Jul 13, 2012 12:44 am por [D]ement<<<

» NitroShare, comparte archivos y carpetas entre Linux y Windows
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeVie Jul 13, 2012 12:26 am por [D]ement<<<

» Linux Mint 13 KDE Release Candidate, disponible
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeVie Jul 13, 2012 12:18 am por [D]ement<<<

» LibreOffice 3.5.5, más estabilidad
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeVie Jul 13, 2012 12:06 am por [D]ement<<<

» File History, un Time Machine para Windows 8
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeMiér Jul 11, 2012 9:50 pm por [D]ement<<<

» Como habilitar el logueo automático en Windows
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeMiér Jul 11, 2012 9:44 pm por [D]ement<<<

» Acronis True Image 2012
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeMar Jul 10, 2012 12:15 am por [D]ement<<<

» Virus Informaticos
[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo I_icon_minitimeMar Mayo 08, 2012 7:10 am por Sokoleonardo

Buscar
 
 

Resultados por:
 


Rechercher Búsqueda avanzada

Marzo 2024
LunMarMiérJueVieSábDom
    123
45678910
11121314151617
18192021222324
25262728293031

Calendario Calendario


[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo

Ir abajo

[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo Empty [Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo

Mensaje por Sokoleonardo Vie Ene 13, 2012 12:15 pm

Tube que fucionar la aplicacion (unir la ventana de "lista de reproduccion" con la ventana principal porque me saltaba errores en las librerias Visual C.

Este reproductor te da 9 listas para agregar musica y cambiar de lista para escuchar una diferente xD



#USE IN PYTHON 2.5.0
#Requiere PyWin32
#Numpy
#PyAudiere
#mutagen-1.20
#eyeD3-0.6.17

Código:

 # -*- coding: utf-8 -*-
#CUH-F1Sound By Sokoleonardo
from Tkinter import *
from tkFont import Font
from sys import argv
from glob import glob
from tkFileDialog import askopenfilenames, askopenfilename, askdirectory
from tkMessageBox import showwarning, showerror
from os.path import splitext, getsize, splitdrive, exists
from os import getcwd
from eyeD3 import Mp3AudioFile
from mutagen.mp3 import EasyMP3, MPEGInfo
from time import clock
from random import randrange
from re import split
from cPickle import dump, load
from platform import system as OperatingSystem
try: from audiere import open_device
except: from audiere import open_device #pyaudiere falla al ser compilado a *.exe

    #USE IN PYTHON 2.5.0
    #Requiere PyWin32
    #Numpy
    #PyAudiere
    #mutagen-1.20
    #eyeD3-0.6.17

OpenerAudio = open_device()

if not exists("SAVE.CUH-F1Sound"):
    #Estos datos deben existir en un archivo (datos por defecto)
    FILE = open("SAVE.CUH-F1Sound", "w")
    dump([[40,100,0], [0,1,0], [[],[],[],[],[],[],[],[],[]], ["1",0], "600x375+230+230", 0], FILE)
    FILE.close()
    # ->> [volume, tone, balanc], [buttonCheck1,buttonCheck2, buttonCheck3], [listadosDirS], [listSeleccionada, trackActual], [geometryWindow], [intposttrack]

def EyeD3Data(filename):
    tag = Mp3AudioFile(filename)
    cifra1, cifra2 = str(getsize(filename) / 1024.0 / 1024.0).split(".")
    MB = cifra1+"." + (cifra2[1] if len(cifra2) < 2 else cifra2[:2]) + "MB"
    Freq = str(tag.getSampleFreq()/1000)+"KHz"
    return tag.getPlayTime(), tag.getBitRateString(), Freq, MB, tag.getPlayTimeString()

def MutagenData(filename):
    try:
        tag = EasyMP3(filename)
        artista = tag["artist"][0] if tag.has_key("artist") else "N/A" #0
        titulo = tag["title"][0] if tag.has_key("title") else "N/A"    #1
        NameTrack = artista+" - "+titulo if artista!="N/A" and titulo!="N/A" else splitext(split("[\\\/]", filename)[-1])[0]#2
        album = tag["album"][0] if tag.has_key("album") else "N/A"    #3
        genero = tag["genre"][0] if tag.has_key("genre") else "N/A"    #4
        anyo = tag["date"][0] if tag.has_key("date") else "N/A"        #5
        return artista, titulo, NameTrack, album, genero, anyo
    except: return ("Error",) * 6

def GetTimeNormalTrack(inSegs):
    """enconvert segs 377 to 06:17
        >>> GetTimeNormalTrack(3600) #1 HS
        1:00:00"""
    hours = 0
    mins = 0
    segs = 0
    for i in range(int(inSegs)):
        segs += 1
        if segs > 59:
            segs = 0
            mins += 1
            if mins > 59:
                mins = 0
                hours += 1
    return (str(hours)+":" if hours != 0 else "")+(str(mins) if mins > 9 else "0"+str(mins))+":"+(str(segs) if segs > 9 else "0"+str(segs))

def LightButton(button, colorON, colorOFF):
    def ON(*e):
        button["bg"] = colorON
    button.bind("<Enter>", ON)
    def OFF(*e):
        button["bg"] = colorOFF
    button.bind("<Leave>", OFF)

def LauncherError(FileFail):
    textError = '''
Se produjo un error dado las siguientes posibilidades:
    1 - El archivo ya no existe.
    2 - El nombre del archivo contiene caracteres como: Ññ´. etc.
    3 - El archivo no puede ser leido por PyAudiere.
    4 - El archivo es corrupto o vacio.
Porfavor abra otro *.mp3 y no el archivo:
    "'''+FileFail+'"\n\nGracias.'
    showwarning("Error en CUH-F1Sound", textError)

class ListReproductions:
    """Methods of List Right"""

    def ActualizationSizeWin(self):
        listaDir = eval("self.List"+self.ListSelectActual)
        if listaDir:
            cantidad = str(len(listaDir))
            tamanyo = 0
            for bytes in [getsize(mp3) for mp3 in listaDir]:
                tamanyo += bytes
            segundos = 0
            for segs in [EyeD3Data(mp3)[0] for mp3 in listaDir]:
                segundos += segs
            duracion = GetTimeNormalTrack(segundos)
            cifra1, cifra2 = str(tamanyo / 1024.0 / 1024.0).split(".")
            TamanioMemoria = ("MB: " if int(cifra1) < 1000 else "GB: ")+(cifra1 if int(cifra1) < 1000 else str(int(cifra1)/1000))+"." + (cifra2[0] if len(cifra2) < 2 else cifra2[:2])
            self.ResultSizeList["text"] = "Pistas: "+str(cantidad)+", "+TamanioMemoria+", Duracion: "+duracion
        else:
                self.ResultSizeList["text"] = "Pistas: 0, MB: 0.00, Duracion: 00:00"

    def ActivateTrackInList(self, *e):
        select = self.ListTracks.curselection()
        if len(select) == 1:
            if self.SelectActualTrack[1] == self.ListSelectActual:
                self.ListTracks.itemconfig(self.SelectActualTrack[0], fg="red")
            self.ListTracks.itemconfig(select, fg="#009600")
            self.SelectActualTrack = [int(select[0]), self.ListSelectActual]
            self.RenameSound(1)

    def ActualizationTaggerReport(self, *e):
        FileSelect = eval("self.List"+self.ListSelectActual)[int(self.SelectActualTrack[0])]
        Dates = MutagenData(FileSelect)
        DatesTamanyo = EyeD3Data(FileSelect)
        self.TituloDeNombre["text"] = "Grupo: "+Dates[0]
        self.TituloDeCancion["text"] = "Cancion: "+Dates[1]
        self.TituloDeAlbum["text"] = "Album: "+Dates[3]
        self.TituloDeGenero["text"] = "Genero: "+Dates[4]
        self.TituloAnyo["text"] = "Edad: "+Dates[5]
        self.TituloTamanyos["text"] = "Tamaños: "+str(DatesTamanyo[4])+", "+str(DatesTamanyo[1])+", "+DatesTamanyo[2]+", "+str(DatesTamanyo[3])
        FILEOBJ = file(FileSelect)
        self.ventana.title("CUH-F1Sound :: "+MPEGInfo(FILEOBJ).pprint())
        FILEOBJ.close()

    def Change(self, numL):
        ColorListaDejada = eval("self.List"+self.ListSelectActual+"_Button")
        ColorListaDejada["fg"] = "black"
        self.ListTracks.delete(0, "end")
        self.ListSelectActual = numL
        numTrack = 1
        for track in eval("self.List"+numL):
            self.ListTracks.insert("end", str(numTrack)+" - "+MutagenData(track)[2])
            numTrack+=1
        ColorListaActual = eval("self.List"+numL+"_Button")
        ColorListaActual["fg"] = "#009600"
        if self.SelectActualTrack[1] == numL and self.ListTracks.size():
                self.ListTracks.itemconfig(int(self.SelectActualTrack[0]), fg="#009600")
        self.ActualizationSizeWin()
    def ChangeL1(self):
        self.Change("1")
    def ChangeL2(self):
        self.Change("2")
    def ChangeL3(self):
        self.Change("3")
    def ChangeL4(self):
        self.Change("4")
    def ChangeL5(self):
        self.Change("5")
    def ChangeL6(self):
        self.Change("6")
    def ChangeL7(self):
        self.Change("7")
    def ChangeL8(self):
        self.Change("8")
    def ChangeL9(self):
        self.Change("9")

    def RemoveSoundSelect(self, *e):
        """Remove pistas de la lista (1 o mas dependiendo de la cantidad seleccionada)"""
        select = list(self.ListTracks.curselection())
        if select:
            self.ListTracks.delete(select[0], select[-1])
            select.reverse()
            for index in select:
                del eval("self.List"+self.ListSelectActual)[int(index)]
                if int(index) < self.SelectActualTrack[0]:
                    self.SelectActualTrack[0] -= 1
            self.Change(self.ListSelectActual)
            self.ActualizationSizeWin()

    def RemoveSoundDouble(self, *e):
        """Elimina los sonidos repetidos en la lista"""
        List = list(set(eval("self.List"+self.ListSelectActual)))
        diference =  eval("self.List"+self.ListSelectActual).__len__() - List.__len__()
        self.ListTracks.delete(0,"end")
        del eval("self.List"+self.ListSelectActual)[0:]
        for track in List:
            eval("self.List"+self.ListSelectActual).append(track)
        self.SelectActualTrack[0] -= diference
        if self.SelectActualTrack[0] < 0: self.SelectActualTrack[0] = 0
        self.Change(self.ListSelectActual)
        self.ActualizationSizeWin()

    def RemoveAllSounds(self):
        self.ListTracks.delete(0,"end")
        del eval("self.List"+self.ListSelectActual)[0:]
        self.ActualizationSizeWin()

#####LOAD#####
FILE = open("SAVE.CUH-F1Sound", "r")
DATA_SAVE = load(FILE)
DATA_SCALES = DATA_SAVE[0]
DATA_BUTTONS = DATA_SAVE[1]
DATA_LISTS = DATA_SAVE[2]
DATA_SELECTS = DATA_SAVE[3]
DATA_GEOMETRY = DATA_SAVE[4]
DATA_POSITION_TRACK = DATA_SAVE[5]
FILE.close()
###END_LOAD###

class Body_Master(ListReproductions):
    def __init__(self):
        self.ventana = Tk()
        self.ventana.geometry(DATA_GEOMETRY)
        self.ventana.title("CUH-F1Sound :: Teclea F1 para informacion")
        self.ventana.resizable(False, False)
        fontSpecial = Font(size=8, weight="bold")
        fontTitles = Font(size=10, weight="bold", underline=True)
        icon = "iconHeavy"+(".ico" if OperatingSystem() == "Windows" else ".png")
        try:
            self.ventana.iconbitmap(icon)
            ICON_ERROR = False
        except: ICON_ERROR = True
        self.GeometryWin = self.ventana.geometry()
        self.Track = None
        self.BoolMovePosition = False
        self.fondo = Frame(self.ventana, bg="gray70", width=300, height=375)
        self.fondo.place(x=0, y=0)
        self.MarcoBotonesClip = Frame(self.fondo, bg="gray80", width=300, height=50)
        self.MarcoBotonesClip.place(x=0,y=0)
        self.BotonPlay = Button(self.MarcoBotonesClip, bg="gray40", activebackground="gray30", text="►", font=("Lucida","20"), command=self.PlayMP3)
        self.BotonPlay.place(x=0,y=0, width=50, height=50)
        self.BotonPausa = Button(self.MarcoBotonesClip, bg="gray40", activebackground="gray30", text="▌▐", font=("Lucida","20"), command=self.PauseMP3)
        self.BotonPausa.place(x=50,y=0, width=50, height=50)
        self.BotonDetener = Button(self.MarcoBotonesClip, bg="gray40", activebackground="gray30", text="██", font=("Lucida","14"), command=self.StopMP3)
        self.BotonDetener.place(x=100,y=0, width=50, height=50)
        self.BotonPistaArriba = Button(self.MarcoBotonesClip, bg="gray40", activebackground="gray30", text="|▐◄", font=("Lucida","14"), command=self.ChangeTrackUp)
        self.BotonPistaArriba.place(x=150,y=0, width=50, height=50)
        self.BotonPistaAbajo = Button(self.MarcoBotonesClip, bg="gray40", activebackground="gray30", text="►▌|", font=("Lucida","14"), command=self.ChangeTrackDown)
        self.BotonPistaAbajo.place(x=200,y=0, width=50, height=50)
        self.BotonAbrirPistaS = Button(self.MarcoBotonesClip, bg="gray40", activebackground="gray30", text="▲\n▬", font=("Lucida","14"), command=self.OpenSoundsFromDisk)
        self.BotonAbrirPistaS.place(x=250,y=0, width=50, height=50)
        self.ScalaVolumen = Scale(self.fondo, bg="gray50", length=89, highlightbackground="red", showvalue=False, orient="horizontal", repeatinterval=2, tickinterval=50, troughcolor="gray70", activebackground="gray20", sliderlength=15, font=fontSpecial, command=self.ControlVolumen)
        self.ScalaVolumen.place(x=2, y=52, width=97, height=61)
        self.ScalaVolumen.set(DATA_SCALES[0])
        self.ScalaTone = Scale(self.fondo, bg="gray50", length=89, highlightbackground="red", showvalue=False, orient="horizontal", repeatinterval=2, tickinterval=50, troughcolor="gray70", activebackground="gray20", sliderlength=15, font=fontSpecial, command=self.ControlTone)
        self.ScalaTone.place(x=101, y=52, width=97, height=61)
        self.ScalaTone.set(DATA_SCALES[1])
        self.ScalaBalance = Scale(self.fondo, bg="gray50", length=89, highlightbackground="red", showvalue=False, orient="horizontal", repeatinterval=2, tickinterval=100, troughcolor="gray70", activebackground="gray20", sliderlength=15, font=fontSpecial, command=self.ControlBalance)
        self.ScalaBalance.place(x=200, y=52, width=97, height=61)
        self.ScalaBalance["from"] = -100
        self.ScalaBalance["to"] = 100
        self.ScalaBalance.set(DATA_SCALES[2])
        self.ScalaPosicion = Scale(self.fondo, bg="gray50", length=287, highlightbackground="red", showvalue=False, orient="horizontal", repeatinterval=2, troughcolor="gray70", activebackground="gray20", to=0, font=fontSpecial, command=self.ControlPosicion)
        self.ScalaPosicion.place(x=2, y=115, width=295, height=62)
        self.NombreAudio = Label(self.ScalaPosicion, bg="gray50", text=OpenerAudio.name, font=fontSpecial)
        self.NombreAudio.place(x=170, y=38, height=15)
        self.BordeInforme = Frame(self.fondo, bg="red")
        self.BordeInforme.place(x=2, y=179, width=295, height=139)
        self.Informe = Frame(self.fondo, bg="gray50")
        self.Informe.place(x=4, y=181, width=291, height=135)
        self.TituloInforme = Label(self.Informe, bg="gray50", text="Informe", font=fontTitles)
        self.TituloInforme.place(x=110, y=-4, width=70)
        self.TituloDeNombre = Label(self.Informe, bg="gray50", text="Grupo:", font=fontSpecial)
        self.TituloDeNombre.place(x=6, y=15)
        self.TituloDeCancion = Label(self.Informe, bg="gray50", text="Canción:", font=fontSpecial)
        self.TituloDeCancion.place(x=6, y=35)
        self.TituloDeAlbum = Label(self.Informe, bg="gray50", text="Album:", font=fontSpecial)
        self.TituloDeAlbum.place(x=6, y=55)
        self.TituloDeGenero = Label(self.Informe, bg="gray50", text="Genero:", font=fontSpecial)
        self.TituloDeGenero.place(x=6, y=75)
        self.TituloAnyo = Label(self.Informe, bg="gray50", text="Edad:", font=fontSpecial)
        self.TituloAnyo.place(x=6, y=95)
        self.TituloTamanyos = Label(self.Informe, bg="gray50", text="Tamaños:", font=fontSpecial)
        self.TituloTamanyos.place(x=6, y=115)
        self.BordeOpciones = Frame(self.fondo, bg="red", width=295, height=51)
        self.BordeOpciones.place(x=2, y=321)
        self.Opciones = Frame(self.fondo, bg="gray50", width=291, height=47)
        self.Opciones.place(x=4, y=323)
        self.TituloOpciones = Label(self.Opciones, bg="gray50", text="Opciones de pista", font=fontTitles)
        self.TituloOpciones.place(x=85, y=-4, width=120)
        self.IntRepetir = IntVar(value=DATA_BUTTONS[0])
        self.BotonCheckRepeatTrack = Checkbutton(self.Opciones, text="Repetir Pista", bg="gray40", selectcolor="gray70", activebackground="gray60", fg="blue", relief="ridge", variable=self.IntRepetir, command=self.CheckRepeat)
        self.BotonCheckRepeatTrack.place(x=4, y=25, width=85, height=20)
        self.IntChangeAutoDown = IntVar(value=DATA_BUTTONS[1])
        self.BotonCheckChangeAutoDown = Checkbutton(self.Opciones, text="Cambiar Debajo", bg="gray40", selectcolor="gray70", activebackground="gray60", fg="blue", relief="ridge", variable=self.IntChangeAutoDown, command=self.CheckChangeDown)
        self.BotonCheckChangeAutoDown.place(x=91, y=25, width=115, height=20)
        self.IntChangeRandom = IntVar(value=DATA_BUTTONS[2])
        self.BotonCheckChangeRandom = Checkbutton(self.Opciones, text="Cambio rnd", bg="gray40", selectcolor="gray70", activebackground="gray60", fg="blue", relief="ridge", variable=self.IntChangeRandom, command=self.CheckChangeRandom)
        self.BotonCheckChangeRandom.place(x=208, y=25, width=80, height=20)
        for optbutton in (self.BotonCheckRepeatTrack, self.BotonCheckChangeAutoDown, self.BotonCheckChangeRandom):
            LightButton(optbutton, "gray50", "gray40")
        for button in (self.BotonPlay, self.BotonPausa, self.BotonDetener, self.BotonPistaArriba, self.BotonPistaAbajo, self.BotonAbrirPistaS):
            LightButton(button, "gray50", "gray40")
        #--------Lista a la derecha--------:
        self.Dibujos = Canvas(self.ventana, bg="gray50", highlightbackground="gray70")
        self.Dibujos.place(x=300,y=0, width=300, height=375)
        for y in range(0, 375, 5):#dibuja lineas hasta el final de la ventana
            self.Dibujos.create_line(0,y, 300,y, fill="gray", tags="ListLines")
        self.List1 = DATA_LISTS[0]
        self.List2 = DATA_LISTS[1]
        self.List3 = DATA_LISTS[2]
        self.List4 = DATA_LISTS[3]
        self.List5 = DATA_LISTS[4]
        self.List6 = DATA_LISTS[5]
        self.List7 = DATA_LISTS[6]
        self.List8 = DATA_LISTS[7]
        self.List9 = DATA_LISTS[8]
        self.ListSelectActual = DATA_SELECTS[0]
        self.List1_Button = Button(self.ventana, text="L1", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL1)
        self.List1_Button.place(x=315, y=10, width=30, height=20)
        self.List2_Button = Button(self.ventana, text="L2", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL2)
        self.List2_Button.place(x=345, y=10, width=30, height=20)
        self.List3_Button = Button(self.ventana, text="L3", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL3)
        self.List3_Button.place(x=375, y=10, width=30, height=20)
        self.List4_Button = Button(self.ventana, text="L4", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL4)
        self.List4_Button.place(x=405, y=10, width=30, height=20)
        self.List5_Button = Button(self.ventana, text="L5", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL5)
        self.List5_Button.place(x=435, y=10, width=30, height=20)
        self.List6_Button = Button(self.ventana, text="L6", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL6)
        self.List6_Button.place(x=465, y=10, width=30, height=20)
        self.List7_Button = Button(self.ventana, text="L7", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL7)
        self.List7_Button.place(x=495, y=10, width=30, height=20)
        self.List8_Button = Button(self.ventana, text="L8", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL8)
        self.List8_Button.place(x=525, y=10, width=30, height=20)
        self.List9_Button = Button(self.ventana, text="L9", bg="gray80", relief="solid", activebackground="gray15", font="system", command=self.ChangeL9)
        self.List9_Button.place(x=555, y=10, width=30, height=20)
        self.ListTracks = Listbox(self.ventana, bg="gray10", fg="red", highlightbackground="red", font=fontSpecial, selectforeground="blue")
        self.ListTracks.place(x=310, y=40, width=280, height=230)
        self.scrollListY = Scrollbar(self.ListTracks, command=self.ListTracks.yview)
        self.scrollListY.pack(side="right", fill="y")
        self.ListTracks.configure(yscrollcommand=self.scrollListY.set)
        self.BaseButtons = Canvas(self.ventana, bg="gray70", relief="ridge", highlightbackground="red")
        self.BaseButtons.place(x=310, y=281, width=280, height=90)
        self.ButtonOpenTracks = Button(self.ventana, text="+Abrir archivos", bg="gray50", fg="blue", activebackground="gray35", font=fontSpecial, overrelief="ridge", command=self.OpenSoundsFromDisk)
        self.ButtonOpenTracks.place(x=314, y=285, width=89, height=20)
        self.ButtonOpenTrack = Button(self.ventana, text="+Abrir archivo", bg="gray50", fg="blue", activebackground="gray35", font=fontSpecial, overrelief="ridge", command=self.OpenSoundFromDisk)
        self.ButtonOpenTrack.place(x=405, y=285, width=89, height=20)
        self.ButtonOpenPath = Button(self.ventana, text="+Abrir carpeta", bg="gray50", fg="blue", activebackground="gray35", font=fontSpecial, overrelief="ridge", command=self.OpenDirectory)
        self.ButtonOpenPath.place(x=496, y=285, width=89, height=20)
        self.ButtonDelSelectTrack = Button(self.ventana, text="- Eliminar", bg="gray50", fg="red", activebackground="gray35", font=fontSpecial, overrelief="ridge", command=self.RemoveSoundSelect)
        self.ButtonDelSelectTrack.place(x=314, y=307, width=89, height=20)
        self.ButtonDelRepetingsTracks = Button(self.ventana, text="- Repetido", bg="gray50", fg="red", activebackground="gray35", font=fontSpecial, overrelief="ridge", command=self.RemoveSoundDouble)
        self.ButtonDelRepetingsTracks.place(x=405, y=307, width=89, height=20)
        self.ButtonDelAllTracks = Button(self.ventana, text="- Todos", bg="gray50", fg="red", activebackground="gray35", font=fontSpecial, overrelief="ridge", command=self.RemoveAllSounds)
        self.ButtonDelAllTracks.place(x=496, y=307, width=89, height=20)
        self.ResultSizeList = Label(self.ventana, bg="gray40", fg="gold", relief="sunken", font=fontSpecial, text="Pistas: 0, MB: 0.00, Duracion: 00:00")
        self.ResultSizeList.place(x=313, y=350, width=275)
        for ButtonOpt in (self.ButtonOpenTracks, self.ButtonOpenTrack, self.ButtonOpenPath, self.ButtonDelSelectTrack, self.ButtonDelRepetingsTracks, self.ButtonDelAllTracks):
            LightButton(ButtonOpt, "gray60", "gray50")
        self.ListTracks.bind("<Double-Button-1>", self.ActivateTrackInList)
        self.ventana.bind("<KeyPress-Return>", self.ActivateTrackInList)
        for buttonL in range(1,10):
            LightButton(eval("self.List"+str(buttonL)+"_Button"), "gray90", "gray80")
        self.SelectActualTrack = [DATA_SELECTS[1], self.ListSelectActual]
        self.Change(self.ListSelectActual)
        #Elegir varius elementos de la lista pero con el boton "shift" apretado:
        def Press(*e):
            self.ListTracks["selectmode"] = "extended"
        def DePress(*e):
            self.ListTracks["selectmode"] = "single"
        self.ventana.bind("<KeyPress-Shift_L>", Press)
        self.ventana.bind("<KeyRelease-Shift_L>", DePress)
        self.ventana.bind("<KeyPress-Shift_R>", Press)
        self.ventana.bind("<KeyRelease-Shift_R>", DePress)
        self.ventana.bind("<Destroy>", self.SaveAndExit)
        #remover track en lista con la tecla suprimir:
        self.ventana.bind("<KeyPress-Delete>", self.RemoveSoundSelect)
        ## System of Track UUuuuuuuuuuuuuuuu..
        self.IntVolume = self.ScalaVolumen.get()
        self.IntTone = self.ScalaTone.get()
        self.IntBalance = self.ScalaBalance.get()
        self.IntPosition = DATA_POSITION_TRACK
        self.RelojContador = clock()
        self.ventana.after(100, self.MovePosition)
        self.ventana.after(100, self.ViewStateTrack)
        self.ventana.bind("<Configure>", self.CaptureGeometryWin)
        self.ventana.bind("<Up>", self.UpVolume)
        self.ventana.bind("<Down>", self.DownVolume)
        self.ventana.bind("<Right>", self.RightPosition)
        self.ventana.bind("<Left>", self.LeftPosition)
        #Revisar si el icono del programa se encuentra:
        def CheckError():
            if ICON_ERROR:
                if exists(icon):
                    TextErrorIcon = '"'+getcwd()+'\\'+icon+'" es corrupto.'
                else:
                    TextErrorIcon = '"'+getcwd()+'\\'+icon+'" no existe.'
                showerror("CUH-F1Sound - error", TextErrorIcon)
        self.ventana.after(2000, CheckError)
        #Abrir ventana de informacion sobre el autor: Sokoleonardo
        self.AboutON = True
        self.ventana.bind("<F1>", self.AboutInfo)
        self.LoadTrackPlaying(1)

    def LoadTrackPlaying(self, play=True):
        if self.ListTracks.size():
            FileSelect = eval("self.List"+self.ListSelectActual)[int(self.SelectActualTrack[0])]
            try:
                self.Track = OpenerAudio.open_file(FileSelect, True)
                self.CheckValsAudio(False)
                self.ScalaPosicion["to"] = EyeD3Data(FileSelect)[0]
                self.ScalaPosicion.set(DATA_POSITION_TRACK)
                self.ActualizationTaggerReport()
                if play: self.PlayMP3()
                self.SetPosition()
            except:
                LauncherError(FileSelect)
            self.ventana.mainloop()

    def ViewStateTrack(self):#esta funcion revisa las opciones de track
        self.ventana.after(1000, self.ViewStateTrack)
        if self.Track:
            if self.Track.position == 0 and not self.Track.playing:
                if self.IntRepetir.get():
                    self.StopMP3("NotTitle")
                    self.PlayMP3()
                elif self.IntChangeAutoDown.get():
                    self.ChangeTrackDown()
                elif self.IntChangeRandom.get():
                    self.ChangeTrackRandom()

    def CheckRepeat(self):
        if self.IntRepetir.get():
            (self.IntChangeAutoDown.set(0), self.IntChangeRandom.set(0))
    def CheckChangeDown(self):
        if self.IntChangeAutoDown.get():
            (self.IntRepetir.set(0), self.IntChangeRandom.set(0))
    def CheckChangeRandom(self):
        if self.IntChangeRandom.get():
            (self.IntRepetir.set(0), self.IntChangeAutoDown.set(0))

    def PlayMP3(self, *e):
        if self.Track:
            self.CheckValsAudio(False)
            if self.Track.playing:
                self.ScalaPosicion.set(0)
                self.Track.reset()
            else:
                self.Track.play()
        else:
            if self.ListTracks.size():
                self.RenameSound(1)

    def PauseMP3(self, *e):
        if self.Track:
            if self.Track.playing:
                self.Track.pause()
            else:
                self.PlayMP3()

    def StopMP3(self, *e):
        if self.Track:
            self.Track.stop()
            self.Track = None
            self.ScalaPosicion["to"] = 0
            if not e:
                self.ventana.title("CUH-F1Sound :: Teclea F1 para informacion")
            elif e:
                if e[0] != "NotTitle":
                    self.ventana.title("CUH-F1Sound :: Teclea F1 para informacion")

    def ChangeTrackUp(self, *e):
        if self.ListTracks.size():
            ActualSelect = int(self.SelectActualTrack[0])
            if self.SelectActualTrack[1] != self.ListSelectActual: ActualSelect = 0
            select = ActualSelect-1 if ActualSelect > 0 else self.ListTracks.size()-1
            self.ListTracks.itemconfig(ActualSelect, fg="red")
            self.ListTracks.itemconfig(select, fg="#009600")
            self.SelectActualTrack[0] = select
            self.SelectActualTrack[1] = self.ListSelectActual
            self.RenameSound(1)

    def ChangeTrackDown(self, *e):
        if self.ListTracks.size():
            ActualSelect = int(self.SelectActualTrack[0])
            if self.SelectActualTrack[1] != self.ListSelectActual: ActualSelect = 0
            if ActualSelect == self.ListTracks.size()-1: ActualSelect = 0
            select = ActualSelect+1 if self.ListTracks.size()-1 else 0
            self.ListTracks.itemconfig(ActualSelect, fg="red")
            self.ListTracks.itemconfig(select, fg="#009600")
            self.SelectActualTrack[0] = select
            self.SelectActualTrack[1] = self.ListSelectActual
            self.RenameSound(1)

    def ChangeTrackRandom(self, *e):
        if self.ListTracks.size():
            ActualSelect = int(self.SelectActualTrack[0])
            if self.SelectActualTrack[1] != self.ListSelectActual: ActualSelect = 0
            else:
                self.ListTracks.itemconfig(ActualSelect, fg="red")
            select = randrange(0, self.ListTracks.size())
            while select == ActualSelect:
                select = randrange(0, self.ListTracks.size())
                if self.ListTracks.size() < 2:
                    break
            self.ListTracks.itemconfig(select, fg="#009600")
        self.SelectActualTrack[0] = select
        self.SelectActualTrack[1] = self.ListSelectActual
        self.RenameSound(1)

    def RenameSound(self, play=True):
        if self.ListTracks.size():
            FileSelect = eval("self.List"+self.ListSelectActual)[int(self.SelectActualTrack[0])]
            try:
                self.Track = OpenerAudio.open_file(FileSelect, True)
                self.CheckValsAudio(False)
                self.ScalaPosicion["to"] = EyeD3Data(FileSelect)[0]
                self.ScalaPosicion.set(0)
                self.ControlPosicion()
                self.ActualizationTaggerReport()
                if play: self.PlayMP3()
            except:
                LauncherError(FileSelect)
            self.ventana.mainloop()

    def CheckValsAudio(self, position):
        if self.Track:
            self.IntVolume = self.ScalaVolumen.get()
            self.IntTone = self.ScalaTone.get()
            self.IntBalance = self.ScalaBalance.get()
            self.IntPosition = self.ScalaPosicion.get()
            self.Track.volume = self.IntVolume / 100.0
            self.Track.pitchshift = self.IntTone / 100.0
            self.Track.pan = self.IntBalance / 100.0
            if position:
                self.Track.position = self.IntPosition

    def SetVolume(self, *e):
        if self.Track:
            self.IntVolume = self.ScalaVolumen.get()
            self.Track.volume = self.IntVolume / 100.0
    def SetTone(self, *e):
        if self.Track:
            self.IntTone = self.ScalaTone.get()
            self.Track.pitchshift = self.IntTone / 100.0
    def SetBalance(self, *e):
        if self.Track:
            self.IntBalance = self.ScalaBalance.get()
            self.Track.pan = self.IntBalance / 100.0
    def SetPosition(self):
        if self.Track:
            pos = self.Track.length / self.ScalaPosicion["to"]
            self.Track.position = self.ScalaPosicion.get() * pos

    def UpVolume(self, *e):
        self.ScalaVolumen.set(self.ScalaVolumen.get()+2)
    def DownVolume(self, *e):
        self.ScalaVolumen.set(self.ScalaVolumen.get()-2)
    def RightPosition(self, *e):
        self.ScalaPosicion.set(self.ScalaPosicion.get()+2)
    def LeftPosition(self, *e):
        self.ScalaPosicion.set(self.ScalaPosicion.get()-2)

    def OpenSoundsFromDisk(self):
        RouteMP3 = askopenfilenames(title="Abrir mas de un archivo", initialdir=splitdrive(argv[0])[0]+"\\", filetypes = (("Sounds","*.mp3"),))
        if RouteMP3:
            for track in RouteMP3:
                eval("self.List"+self.ListSelectActual).append(track)
            self.Change(self.ListSelectActual)

    def OpenSoundFromDisk(self):
        RouteMP3 = askopenfilename(title="Abrir un solo archivo", initialdir = splitdrive(argv[0])[0]+"\\", filetypes = (("Sound","*.mp3"),))
        if RouteMP3:
            eval("self.List"+self.ListSelectActual).append(RouteMP3)
            self.Change(self.ListSelectActual)

    def OpenDirectory(self):
        RoutePath = askdirectory(title = "Carpeta junto con sus subcarpetas", initialdir = splitdrive(argv[0])[0]+"\\")
        if RoutePath:
            def Searcher(path):
                path = [path]
                for nwpath in path:
                    for file in glob(nwpath+"*.mp3"):
                        yield file
                    for otherpath in glob(nwpath+"*\\"):
                        path.append(otherpath)
            for Mp3 in Searcher(RoutePath):
                eval("self.List"+self.ListSelectActual).append(Mp3)
            self.Change(self.ListSelectActual)

    def MovePosition(self, *e):
        self.ventana.after(10, self.MovePosition)
        if self.Track:
            if self.Track.playing:
                if clock() - 1 > self.RelojContador:
                    self.RelojContador = clock()
                    def Volver():
                        self.BoolMovePosition = True
                    self.BoolMovePosition = False
                    self.ScalaPosicion.set(self.ScalaPosicion.get()+1)
                    self.ventana.after(4,  Volver)

    def ControlVolumen(self, *e):
        self.ScalaVolumen["label"] = "Volumen: "+str(self.ScalaVolumen.get())+"%"
        self.SetVolume()

    def ControlTone(self, *e):
        self.ScalaTone["label"] = "Tono: "+str(self.ScalaTone.get())+"%"
        self.SetTone()

    def ControlBalance(self, *e):
        Salida = self.ScalaBalance.get()
        if Salida == 0:
            Frase = "Cent"
        elif Salida == -100:
            Frase = "Izq"
        elif Salida == 100:
            Frase = "Der"
        else:
            Frase = self.ScalaBalance.get()
        self.ScalaBalance["label"] = "Balance: "+str(Frase)
        self.SetBalance()

    def ControlPosicion(self, *e):
        self.ScalaPosicion["label"] = "Tiempo: "+GetTimeNormalTrack(self.ScalaPosicion.get()) +" / "+ GetTimeNormalTrack(self.ScalaPosicion["to"])
        self.IntPosition = self.ScalaPosicion.get()
        if self.BoolMovePosition:
            self.SetPosition()

    def CaptureGeometryWin(self, *e):
        self.GeometryWin = self.ventana.geometry()

    def AboutInfo(self, *e):
        if self.AboutON:
            self.AboutON = False
            def ExitAbout(*e):
                self.AboutON = True
                ventana.destroy()
            ventana = Tk()
            icon = "iconHeavy"+(".ico" if OperatingSystem() == "Windows" else ".png")
            try: ventana.iconbitmap(icon)
            except: pass
            ventana.title("CUH-F1Sound :: Informacion...")
            ventana.geometry("300x270+%d+%d" % (self.ventana.winfo_x()+150, self.ventana.winfo_y()+80))
            ventana.resizable(False, False)
            Frame(ventana, bg="gray").place(x=0, y=0, width=300, height=270)
            Label(ventana, bg="gray", fg="red", text="v1.0.0", font="system").place(x=250, y=0)
            Label(ventana, bg="gray", fg="blue", text=".::CUH-F1Sound::.", font=("small fonts", 19)).place(x=50, y=10, width=200)
            Label(ventana, bg="gray", fg="black", text="Creador de CUH-F1Sound v1.0.0:\nLeonardo A. Reichert\nen los foros/sitios es Sokoleonardo.", font="system").place(x=25, y=60, width=250)
            Texto = Text(ventana, bg="gray", fg="black")
            Texto.place(x=20, y=120, width=260, height=100)
            Texto.insert("0.0", "Novedades:\n")
            Texto.insert("end", "Se espera que en la siguiente version se pueda cam-biar el color (skins).\nLenguaje de programacion usado: Python 2.5.0.\nMuchas gracias por usar CUH-F1Sound.\n\nSaludos!")
            Texto["state"] = "disable"
            Button(ventana, bg="gray55", activeforeground="black", activebackground="gray40", fg="black", font="system", text="Ok", command=ExitAbout).place(x=135, y=230, width=30, height=30)
            ventana.bind("<Destroy>", ExitAbout)

    def SaveAndExit(self, *e):
        if self.Track:
            if self.Track.playing:
                self.Track.stop()
                self.Track = None
        FILE = open("SAVE.CUH-F1Sound", "w")
        dump([[self.IntVolume, self.IntTone, self.IntBalance],
                [self.IntRepetir.get(), self.IntChangeAutoDown.get(), self.IntChangeRandom.get()],
                [self.List1,self.List2,self.List3,self.List4,self.List5,self.List6,self.List7,self.List8,self.List9],
                [self.SelectActualTrack[1], self.SelectActualTrack[0]], self.GeometryWin, self.IntPosition], FILE)
        FILE.close()

Machine = Body_Master()
Machine.ventana.mainloop()


[Tienes que estar registrado y conectado para ver este vínculo]

Saludos!

[Tienes que estar registrado y conectado para ver esa imagen]
Sokoleonardo
Sokoleonardo
Moderador de Seccion
Moderador de Seccion

Mensajes : 52
Nivel : 138
Reputación : 4
Fecha de inscripción : 04/08/2011
Vive en Vive en : Argentina

Volver arriba Ir abajo

[Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo Empty Re: [Tkinter Python]CUH-F1Sound 1.0.0(Reproductor de *.mp3 en Python)By Sokoleonardo

Mensaje por Sokoleonardo Lun Feb 06, 2012 8:50 am

Me gustaria que alguien se descargara el ejecutable para windows con independencia de Python: [Tienes que estar registrado y conectado para ver este vínculo] y me comentara que tal esta el programa.

Saludos!
Sokoleonardo
Sokoleonardo
Moderador de Seccion
Moderador de Seccion

Mensajes : 52
Nivel : 138
Reputación : 4
Fecha de inscripción : 04/08/2011
Vive en Vive en : Argentina

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.