[gnome-music/wip/jfelder/tag-test: 6/22] utils: Map grilo tags and utils functions



commit fd1eace7393e39b24fdfbc9dc34c839f743b7b06
Author: Sumaid Syed <sumaidsyed gmail com>
Date:   Wed Jul 17 16:23:11 2019 +0530

    utils: Map grilo tags and utils functions
    
    Add a dictionnary to map a tag name with the corresponding utils
    function to get it or set it.
    
    Based on patches by Jean Felder
    
    https://gitlab.gnome.org/GNOME/gnome-music/issues/293

 gnomemusic/utils.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/gnomemusic/utils.py b/gnomemusic/utils.py
index bf1df231..3a024ef9 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -223,3 +223,23 @@ def set_creation_year(item, creation_year):
         updated_creation_date = GLib.DateTime(timezone, int(creation_year), month, day, hour, minute, second)
         return ( item.set_creation_date(updated_creation_date) and
                  grilo.set_metadata_key(item, Grl.METADATA_KEY_CREATION_DATE) )
+
+
+
+fields_getter = {
+    'album': get_album_title,
+    'artist': get_artist_name,
+    'disc': get_album_disc_nr,
+    'title': get_media_title,
+    'track': get_media_track_nr,
+    'year': get_media_year
+}
+
+fields_setter = {
+    'album': set_album_title,
+    'artist': set_artist_name,
+    'disc': set_album_disc_number,
+    'title': set_title,
+    'track': set_track_number,
+    'year': set_creation_year
+}


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