[gnome-music/wip/mschraal/tageditor: 7/21] coresong: Add fields to setters mapping



commit de3bd14c788bad05854cba250a5b1c3f4a241248
Author: Sumaid Syed <sumaidsyed gmail com>
Date:   Sat Aug 17 18:55:05 2019 +0530

    coresong: Add fields to setters mapping
    
    Add dictionary which allows iterating over
    setters and setting values for each metadata key
    available in dictionary.

 gnomemusic/coresong.py | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gnomemusic/coresong.py b/gnomemusic/coresong.py
index d2ed09d5..07f3b2e9 100644
--- a/gnomemusic/coresong.py
+++ b/gnomemusic/coresong.py
@@ -63,6 +63,15 @@ class CoreSong(GObject.GObject):
         self._favorite = False
         self._selected = False
 
+        self.fields_setter = {
+            "album": self.set_album_title,
+            "artist": self.set_artist_name,
+            "disc": self.set_album_disc_number,
+            "title": self.set_title,
+            "track": self.set_track_number,
+            "year": self.set_creation_year
+        }
+
         self.props.grlid = media.get_source() + media.get_id()
         self._is_tracker = media.get_source() == "grl-tracker-source"
         self.props.validation = CoreSong.Validation.PENDING


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]