Esempio n. 1
0
	def play_pause(self, filepath):
		selected = self.builder.get_object('treeview-selection1')

		if selected.get_selected()[1] != None:
			modeliter = selected.get_selected()[1]
			self.set_playmark(modeliter)
		elif self.model.get_iter_first() != None:
			modeliter = self.model.get_iter_first()
			self.set_playmark(0)

		try: filepath = self.model.get_value(modeliter, 7)
		except: return

		toolplayimg = self.builder.get_object('image3')
		playstate = self.player.get_state()[1]
		if (playstate == gst.STATE_PLAYING):
			self.player.set_state(gst.STATE_PAUSED)

			toolplayimg.set_from_icon_name('media-playback-start', Gtk.IconSize.LARGE_TOOLBAR)			
		elif os.path.isfile(filepath):
			self.player.set_property("uri", "file://" + filepath)
			self.player.set_state(gst.STATE_PLAYING)

			getmesumdatabruv = TrackMetaData()
			x = getmesumdatabruv.getTrackType(filepath)

			try: self.titleText.set_text(x[1])
			except: self.titleText.set_text('No Artist')
			try: self.infoText.set_text(x[2])
			except: self.infoText.set_text('No Album')
			toolplayimg.set_from_icon_name('media-playback-pause', Gtk.IconSize.LARGE_TOOLBAR)
Esempio n. 2
0
	def add_row(self, action):
		action = action.replace('%20',' ')
		getmesumdatabruv = TrackMetaData()
		x = getmesumdatabruv.getTrackType(action)		
		#print x
		if x != False:
			x.insert(0, None)
			self.model.append(x)
Esempio n. 3
0
#nosklo from stackoverflow i love you for this class!
class AutoVivification(dict):
    """Implementation of perl's autovivification feature."""
    def __getitem__(self, item):
        try:
            return dict.__getitem__(self, item)
        except KeyError:
            value = self[item] = type(self)()
            return value


aviv = AutoVivification()

resultArray = {}
metaData = TrackMetaData()
songList = get_music_library()
for i in songList:
    Title = metaData.getTrackType(i)[1]
    Artist = metaData.getTrackType(i)[2]
    Album = metaData.getTrackType(i)[3]
    if Artist == None:
        Artist = 'Unknown Artist'
    if Album == None:
        Album = 'Unknown Album'
    if Title == None:
        Title = 'Unknown Album'

    aviv[Artist][Album][Title][i]
print aviv
Esempio n. 4
0
##called for each directory encountered.

#nosklo from stackoverflow i love you for this class!
class AutoVivification(dict):
    """Implementation of perl's autovivification feature."""
    def __getitem__(self, item):
        try:
            return dict.__getitem__(self, item)
        except KeyError:
            value = self[item] = type(self)()
            return value

aviv = AutoVivification()

resultArray = {}
metaData = TrackMetaData()
songList = get_music_library()
for i in songList:
	Title = metaData.getTrackType(i)[1]
	Artist = metaData.getTrackType(i)[2]
	Album = metaData.getTrackType(i)[3]
	if Artist == None:
		Artist = 'Unknown Artist'
	if Album == None:
		Album = 'Unknown Album'
	if Title == None:
		Title = 'Unknown Album'

	aviv[Artist][Album][Title][i]
print aviv