Removed old files thate were not being used

git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@38 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
bjschuma 2009-06-29 13:42:01 +00:00
parent 65210bc029
commit 73395ff511
10 changed files with 23 additions and 447 deletions

View File

@ -9,9 +9,9 @@ class InfoView(gtk.VBox):
def __init__(self,data):
gtk.VBox.__init__(self,False,0)
self.data = data
self.title = self.makeLabel("",13000)
self.album = self.makeLabel("",10000)
self.artist = self.makeLabel("",10000)
self.title = self.makeLabel("",13000,700)
self.album = self.makeLabel("",10000,400)
self.artist = self.makeLabel("",10000,400)
self.changeLabels()
gobject.timeout_add(1000,self.changeLabels)
self.show()
@ -25,17 +25,18 @@ class InfoView(gtk.VBox):
title = self.data.song.info.title
album = self.data.song.info.album
artist = self.data.song.info.artist
self.title.set_text("Title: "+title)
self.album.set_text("Album: "+album)
self.artist.set_text("Artist "+artist)
self.title.set_text(title)
self.album.set_text("from "+album)
self.artist.set_text("by "+artist)
return True
def makeLabel(self,text,size):
def makeLabel(self,text,size,weight):
label = gtk.Label(text)
align = gtk.Alignment(0,1,0,0)
attr = pango.AttrList()
attr.insert(pango.AttrSize(size,0,-1))
attr.insert(pango.AttrWeight(weight,0,-1))
label.set_attributes(attr)
align.add(label)
self.pack_start(align,False,False,0)

View File

@ -9,11 +9,9 @@ from menuItem import MenuItem
#class LibView(gtk.ScrolledWindow):
class LibView(gtk.VBox):
def __init__(self,data):
#gtk.ScrolledWindow.__init__(self)
gtk.VBox.__init__(self,False,0)
self.win = gtk.ScrolledWindow()
self.win.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
#self.data.library = library
self.data = data
self.treeview = None
self.col = None
@ -29,8 +27,6 @@ class LibView(gtk.VBox):
# Use to update the library pane
def update(self):
rval = self.data.library.scanning
#if self.data.library.count == 0:
# return False
if self.treeview:
self.win.remove(self.treeview)
self.treeview.remove_column(self.col)
@ -42,11 +38,10 @@ class LibView(gtk.VBox):
for album in self.data.library.artAlb[artist]:
aliter = tree.append(ariter,[album.title(),-1])
for track in self.data.library.albTrk[(artist,album)]:
#if rval == False:
# print artist,album,self.data.library.files[track].title
tree.append(aliter,[self.data.library.files[track].title,self.data.library.files[track].id])
tree.set_sort_column_id(0,gtk.SORT_ASCENDING)
self.treeview = gtk.TreeView(tree)
self.treeview.set_enable_search(True)
self.treeview.connect("button_release_event",self.clicked)
self.col = gtk.TreeViewColumn('Library ('+str(self.data.library.count)+')')
self.treeview.append_column(self.col)
@ -66,9 +61,8 @@ class LibView(gtk.VBox):
def makeLabel(self):
self.label = gtk.Label("")#str(self.data.library.count)+" tracks in collection")
self.label = gtk.Label("")
self.updateLabel()
#self.label.show()
def updateLabel(self):
@ -106,7 +100,6 @@ class LibView(gtk.VBox):
def popHelper(self,model,iter,count):
if count == 0:
#print model[iter][0],count
self.data.curList+=[model[iter][1]]
return

View File

@ -15,7 +15,8 @@ class PlistView(gtk.ScrolledWindow):
self.tree = None
self.label = gtk.Label("")
self.makeList()
self.loadSong()
#self.next(None,None)
self.loadSong(True)
gobject.timeout_add(1000,self.checkUpdate)
self.show()
@ -54,7 +55,9 @@ class PlistView(gtk.ScrolledWindow):
if cols[i] != "Id":
self.tree.append_column(col)
self.tree.set_rules_hint(True)
self.tree.set_enable_search(True)
self.tree.connect("row-activated",self.selectSong,"clicked",self.trackList)
self.treesel = self.tree.get_selection()
self.tree.show()
self.resizeCols()
self.add(self.tree)
@ -108,7 +111,7 @@ class PlistView(gtk.ScrolledWindow):
# User selected a song with mouse click
def selectSong(self,widgit,iter,path,data,list):
self.data.curSong = self.data.curList.index(list[iter][0])
self.loadSong()
self.loadSong(False)
self.controls.plause(None,None)
@ -120,45 +123,27 @@ class PlistView(gtk.ScrolledWindow):
self.data.curSong+=1
if self.data.curSong >= len(self.data.curList):
self.data.curSong = 0
self.loadSong()
self.loadSong(True)
self.controls.plause(None,None)
# Load a song and begin playback
def loadSong(self):
def loadSong(self,scroll):
if len(self.data.curList) == 0:
return
if self.data.song:
self.data.song.close()
self.data.song.passInfo(self.data.library.files[self.data.curList[self.data.curSong]])
self.gotoCurSong()
if scroll == True:
self.gotoCurSong()
# Scroll window and select row with current song
def gotoCurSong(self):
if len(self.data.curList) == 0:
return
selrow = 0
row = 0
for i in range(len(self.data.curList)):
if self.trackList[i][0] == self.data.song.info.id:
if i > 10:
selrow = i - 10
row = i
break
print selrow,row
self.tree.scroll_to_cell(selrow,None,True,0,0)
treesel = self.tree.get_selection()
treesel.select_path(row)
#model = self.tree.get_model()
#selrow = 0
#row = 0
#for i in range(len(model)):
#if i > 10:
# selrow = self.trackList[i - 10][0]
# if model[i][0] == self.data.curSong:
# row = i
# break
#print model[i][0],self.data.curSong,row
#print self.tree[row][0],self.data.curSong
#self.tree.scroll_to_cell(row,None,False,0,0)
#model.set_cursor(row,None,False)
self.tree.scroll_to_cell(i-10,None,True,0,0)
self.treesel.select_path(i)

View File

@ -1,54 +0,0 @@
class Duration:
def __init__(self):
self.hour=0
self.min=0
self.sec=0
# Set the duration
# Takes nano-seconds
def setTime(self,ns):
# Convert to seconds
time = ns/1000000000
# Hours
if time >= 3600:
self.hour = time/3600
time = time-(self.hour*3600)
# Minutes
if time >= 60:
self.min = time/60
time = time-(self.min*60)
# Seconds
self.sec = time
# Write time to screen
def toStr(self):
time = ""
if self.hour > 0:
time+=str(self.hour)+":"
if self.min > 0:
min = str(self.min)
if self.min < 10:
min = "0"+min
time+=min
else:
time+="00"
time+=":"
if self.sec > 0:
sec = str(self.sec)
if self.sec < 10:
sec = "0"+sec
time += sec
else:
time+="00"
return time
def disp(self,prnt):
time = self.toStr()
prnt([time])

View File

@ -2,7 +2,6 @@ import os
import re
import tagpy
import cPickle as pickle
#from libdata import LibData
from songInfo import SongInfo
import thread
@ -99,8 +98,6 @@ class Library:
a = f.audioProperties()
info.setTime(a.length)
#info.duration = a.length
#info.fixTime()
artist = info.artist.lower()
album = info.album.lower()
@ -117,14 +114,6 @@ class Library:
self.albTrk[(artist,album)] += [index]
# Dump to file
#def dump(self):
# out = open(self.save,'w')
# p = pickle.Pickler(out,2)
# p.dump(self.data)
# out.close()
# Return true if file is in the library
def has(self,file):
words = self.hash(file)
@ -139,19 +128,3 @@ class Library:
if len(indices) > 0:
return indices.pop()
return -1
#def nonBanned(self):
# list = []
# for i in range(len(self.data.files)):
# if self.data.files[i].banned == False:
# list += [i]
# return list
#def translate(self,sid):
# #file = self.data.files[sid]
# return self.data.files[sid]
# #print file.title, file.artist, file.album
# return (sid,file.title,file.artist,file.album,file.playCount)
# #return (file.artist,file.album)

View File

@ -11,14 +11,8 @@ from options import Options
from saveddata import SavedData
from song import Song
#from duration import Duration
#from library import Library
#from operations import Operations
#from playlist import Playlist
#from songInfo import SongInfo
from window import Window
#gtk.gdk.threads_init()
gobject.threads_init()

View File

@ -1,121 +0,0 @@
from song import Song
CONTINUE = 0
QUIT = 1
PAUSE = 2
# Use to define various operations
class Operations:
def __init__(self,exit):
self.song = None
self.plist = None
self.library = None
self.setInfo = None
self.resetInfo = None
self.scrollSong = None
self.exit = exit
self.after = CONTINUE
# Begin playback
def play(self,widget,data):
if self.song == None:
return
self.song.play()
# Pause playback
def pause(self,widget,data):
if self.song == None:
return
self.song.pause()
def stop(self,widget,data):
if self.song == None:
return
self.song.stop()
def afterTrack(self,widget,data,changeFrame):
str = ""
if (data=="qafter") and not (self.after==1):
self.after = QUIT
str = "Quitting "
elif (data=="pafter") and not (self.after==2):
self.after = PAUSE
str = "Pausing"
else:
self.after = CONTINUE
if str != "":
str += " After "
changeFrame(str)
# Advance to the next song
def next(self,widget,data):
# Close open songs
if self.song != None:
self.song.info.count+=1
self.song.close()
# Are we exiting?
if self.after == QUIT:
self.exit(None,None)
# Get next song
index = self.plist.next()
self.resetInfo()
if index > -1:
self.song = None
info = self.library.data.files[index]
self.song = Song(info,self.next)
if index > -2:
self.song.setInfo = self.setInfo
# Do we begin playback?
#if self.after != 2:
self.song.play()
if self.after == PAUSE:
self.song.pause()
self.after = CONTINUE
self.library.dump()
self.scrollSong()
# Mark progress on the progress bar
def markProgress(self,widget,data):
time = (False,None)
while time[0] == False:
time = self.song.curTime()
widget.set_fraction(float(self.song.current)/float(self.song.total))
widget.set_text(time[1].toStr()+" / "+self.song.info.length.toStr())
#print float(self.song.current)/float(self.song.total)
return True
# Print detailed song info
def info(self,widget,data):
# Return if no song found
if self.song == None:
return
# Return if no tags found
if self.song.info.tags == None:
print "Could not find any tags"
return
for tag in self.song.info.tags.keys():
print tag+":",self.song.info.tags[tag]
print self.song.info.filename
# Toggle random
def random(self,widget,data):
self.plist.random = not self.plist.random
def scanLib(self,thread,dir):
self.library.scan(dir)
def click(self,widget,data,event,list,selection):
if data.button == 3:
(l,rows) = selection.get_selected_rows()
iter = l.get_iter(rows[0])
self.plist.queueSong(list[iter][0])

View File

@ -1,113 +0,0 @@
import Queue
import random
import pygtk
pygtk.require('2.0')
import gtk
class Playlist:
#def __init__(self,prnt):
def __init__(self):
#self.prnt = prnt
self.list = []
self.queue = Queue.Queue()
self.curSong = 0
self.random = True
self.translate = None
self.opsNext = None
#self.makeWindow()
# Enqueue a song
# Takes songid
def queueSong(self,song):
self.queue.put(song)
# Insert the list of songs
def insert(self,list):
self.list = list
# Return the next song
def next(self):
if self.queue.empty() == False:
self.curSong = self.queue.get()
return self.curSong
if len(self.list) == 0:
return -2
if self.random==True:
self.curSong = random.randint(0,len(self.list)-1)
else:
self.curSong += 1
if self.curSong > len(self.list):
self.curSong = 0
song = self.list[self.curSong]
return song
# Play the selected song
def selectSong(self,module,iter,path,data,list):
self.queueSong(list[iter][0])
self.opsNext(None,None)
#self.hideWindow(None,None)
# Make the playlist window
#def makeWindow(self):
# self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# self.window.connect("delete_event",self.hideWindow)
# self.window.set_size_request(200,300)
# self.scroll = gtk.ScrolledWindow()
# self.scroll.set_border_width(0)
# self.scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
# self.window.add(self.scroll)
# self.populateList()
# Fill in rows in the playlist
#def populateList(self):
# liststore = gtk.ListStore(int,str,str,str,int)
#liststore = gtk.ListStore(str,str)
# for num in self.list:
# liststore.append(self.translate(num))
# treeview = gtk.TreeView(liststore)
# cell = gtk.CellRendererText()
# cols = ["Id","Title","Artist","Album","Count"]
# for i in range(len(cols)):
# col = gtk.TreeViewColumn(cols[i],cell)
# col.add_attribute(cell,'text',i)
# col.set_resizable(True)
# col.set_sort_column_id(i)
# treeview.append_column(col)
# treeview.set_search_column(1)
# treeview.connect("row-activated",self.selectSong,"clicked",liststore)
# treeview.show()
# treeview.columns_autosize()
# self.scroll.add(treeview)
# self.scroll.show()
# Go to current song, enable grid lines
# selrowthe golden sun rises = self.curSong-10
# if selrow < 0:
# selrow = 0
# treeview.scroll_to_cell(selrow,None,False,0,0)
# treeview.set_grid_lines(True)
# treesel = treeview.get_selection()
# treesel.select_path(self.curSong)
# Hide the playlist
#def hideWindow(self,widget,data):
#self.scroll.hide()
# self.window.hide()
# self.window = None
# Show the playlist
#def showWindow(self,widget,data):
#self.populateList()
# self.makeWindow()
# self.window.show()
# self.window.maximize()

View File

@ -56,3 +56,4 @@ class SavedData:
self.colSizes = data.colSizes
self.path = data.path
self.random = data.random
self.curSong = data.curSong

View File

@ -36,89 +36,6 @@ class Window(gtk.Window):
self.show()
'''
# Make initial info pane
def makeInfoPane(self):
self.infoFrame = gtk.Frame("Current Song:")
box = gtk.VBox(False,0)
self.infoFrame.add(box)
attr = pango.AttrList()
attr.insert(pango.AttrSize(12000, 0, -1))
self.tagLabels["title"] = self.makeLabel("Title: ?",box,attr)
self.tagLabels["artist"] = self.makeLabel("Artist: ?",box,attr)
self.tagLabels["album"] = self.makeLabel("Album: ?",box,attr)
box.show()
self.infoFrame.show()
#self.mainLayout.add(self.infoFrame)
self.mainLayout.pack_start(self.infoFrame,False,False,0)
# Set up a new label, add to container
# Goes into a HBox so that it is left justified
def makeLabel(self,text,container,attr):
box = gtk.HBox(False,0)
label = gtk.Label(text)
s = label.get_style().copy()
self.tooltip.set_tip(label,text,tip_private=None)
#label.set_max_width_chars(35)
label.set_attributes(attr)
label.show()
box.pack_start(label,False,False,0)
box.show()
container.pack_start(box,False,False,0)
return label
# Change label info
def changeInfo(self,tags):
keys = tags.keys()
labels = self.tagLabels.keys()
for key in keys:
if (key in labels) == True:
str = key.title()+": "+tags[key]
self.tagLabels[key].set_label(str)
self.tooltip.set_tip(self.tagLabels[key],str,tip_private=None)
self.tagLabels[key].show()
def changeFrameTitle(self,label):
self.infoFrame.set_label(label+"Current Track:")
# Reset label info
def resetInfo(self):
labels = self.tagLabels.keys()
for key in labels:
self.tagLabels[key].set_label(key.title()+": ?")
self.tooltip.set_tip(self.tagLabels[key],key.title()+": ?")
self.tagLabels[key].show()
def gotoCurSong(self):
#return
if len(self.list) == 0:
return
#print self.list[0][0]
#print len(self.list)
selrow = 0
row = 0
for i in range(len(self.list)):
#print i
if self.list[i].id == self.ops.plist.curSong:
if i > 10:
selrow = i - 10
row = i
break
self.list.select(self.list[row],True)
#selrow = self.ops.plist.curSong - 10
#if selrow < 0:
# selrow = 0
#print selrow,row
#self.tree.scroll_to_cell(selrow,None,True,0,0)
#treesel = self.tree.get_selection()
#treesel.select_path(row)
'''
# Used to make the top row menu bar
def makeMenuBar(self):
# Make a menu bar