Skip to content

Commit

Permalink
the view is correctly erased when the directory is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
lachhebo committed Jun 9, 2019
1 parent 27218d5 commit 4a94504
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
## Description :

GabTag is a GTK software written in Python, it allows user to add or modify tags on audio files.
It uses Mutagen to handle tags. I hope to make it available on Flathub as soon as possible.
It uses Mutagen to handle tags.

Gabtag is available on flathub, at the link :
[link to Gabtag FlatHub Page!](https://flathub.org/apps/details/com.github.lachhebo.Gabtag)

## Features :

Expand Down
36 changes: 16 additions & 20 deletions src/Crawler_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,27 @@ def run(self):
thread_mbz3.start()
thread_mbz4.start()

'''
while not self.data_crawler.is_finished(filelist):
time.sleep(0.3)
selection = self.model.selection
if selection != None :
model, listiter = selection.get_selected_rows()
print("model", len(listiter))
if len(listiter) == 1:
if model[listiter][0] in self.data_crawler.tag_finder and model[listiter][0] in self.data_crawler.lyrics:
data_scrapped = self.data_crawler.get_tags(model, listiter, 0)
lyrics_scrapped = self.data_crawler.get_lyrics(model, listiter, 0)
print("data scrapped", data_scrapped)
self.model.view.show_mbz(data_scrapped)
self.model.view.show_lyrics(lyrics_scrapped)
'''

thread_mbz1.join()
thread_mbz2.join()
thread_mbz3.join()
thread_mbz4.join()


def isselectionequal(self,selec1,selec2):
model, listiter = selec1.get_selected_rows()
model2, listiter2 = selec2.get_selected_rows()
#print("la taille est :", len(listiter) )
#print("la taille autorisée :",self.lenselection )

if len(listiter) == len(listiter2) :
for i in range(len(listiter)):
namefilei = model[listiter[i]][0]
if namefilei != model2[listiter2[i]][0]:
return False
else :
#print("why size ?")
return False

return True

6 changes: 5 additions & 1 deletion src/data_crawler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from os import walk

from threading import RLock

verrou = RLock()

import musicbrainzngs as mb
from PyLyrics import *

Expand All @@ -16,7 +20,7 @@ class __Data_Crawler :

def __init__(self):
try :
mb.set_useragent("GabTag", version = "1.0.5", contact = "[email protected]")
mb.set_useragent("GabTag", version = "1.3.1", contact = "[email protected]")
self.internet = True
except :
self.internet = False
Expand Down
6 changes: 1 addition & 5 deletions src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def update_directory(self,directory,store):
'''
self.directory = directory
self.update_list(store)
self.selection = None
self.modification = {}

def reset_all(self,selection):
Expand Down Expand Up @@ -230,11 +231,6 @@ def file_modified(self,namefile):
return False







def set_data_lyrics(self,selection):

model, listiter = selection.get_selected_rows()
Expand Down
5 changes: 4 additions & 1 deletion src/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def erase(self):
self.artist.set_text("")
self.year.set_text("")
self.track.set_text("")

self.cover.set_from_icon_name('gtk-missing-image',6)
self.last_cover = ""
self.show_lyrics("")
self.show_mbz({ 'title':"", 'track':"",'album':"",'genre':"","artist":"","cover":"","year":""})

def set_editibility_title(self, multiple_rows, title):
if multiple_rows == 1 :
Expand Down
4 changes: 1 addition & 3 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,12 @@ def open_clicked(self, widget):
model = Model.getInstance()
if response == Gtk.ResponseType.OK:
self.opened_directory = True
model.view.erase()
self.data_crawler.update_directory(dialog.get_filename())
model.update_directory(dialog.get_filename(),self.liststore1)
thread = Crawler_Dir(model.directory,self.liststore1)
thread.start()

model.save_modifications(self.selectionned)


dialog.destroy()

# List mp3 file on the folder on the tree view :
Expand Down

0 comments on commit 4a94504

Please sign in to comment.