diff --git a/README.md b/README.md index b8c961d..c0ac704 100644 --- a/README.md +++ b/README.md @@ -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 : diff --git a/src/Crawler_dir.py b/src/Crawler_dir.py index eb944dc..1422540 100644 --- a/src/Crawler_dir.py +++ b/src/Crawler_dir.py @@ -52,26 +52,6 @@ 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() @@ -79,4 +59,20 @@ def run(self): 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 diff --git a/src/data_crawler.py b/src/data_crawler.py index 5fb6076..1827bba 100644 --- a/src/data_crawler.py +++ b/src/data_crawler.py @@ -1,5 +1,9 @@ from os import walk +from threading import RLock + +verrou = RLock() + import musicbrainzngs as mb from PyLyrics import * @@ -16,7 +20,7 @@ class __Data_Crawler : def __init__(self): try : - mb.set_useragent("GabTag", version = "1.0.5", contact = "ismael.lachheb@protonmail.com") + mb.set_useragent("GabTag", version = "1.3.1", contact = "ismael.lachheb@protonmail.com") self.internet = True except : self.internet = False diff --git a/src/model.py b/src/model.py index 9f440d2..a638c0a 100644 --- a/src/model.py +++ b/src/model.py @@ -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): @@ -230,11 +231,6 @@ def file_modified(self,namefile): return False - - - - - def set_data_lyrics(self,selection): model, listiter = selection.get_selected_rows() diff --git a/src/view.py b/src/view.py index 9842585..6f1e257 100644 --- a/src/view.py +++ b/src/view.py @@ -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 : diff --git a/src/window.py b/src/window.py index 0cd8db0..567edf4 100644 --- a/src/window.py +++ b/src/window.py @@ -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 :