[gnome-music/wip/mschraal/tageditor-13feb2020: 22/41] utils: Add fields to getters mapping



commit a4fedc41b2966fa544e96d5dd4a468d4dad1356d
Author: Sumaid Syed <sumaidsyed gmail com>
Date:   Fri Aug 16 16:09:49 2019 +0530

    utils: Add fields to getters mapping
    
    Add a dictionary which allows iterating over
    different getters and filling corresponding entries
    or suggestions in tageditor.

 gnomemusic/utils.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/gnomemusic/utils.py b/gnomemusic/utils.py
index fe2798e6..a8aef985 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -210,3 +210,13 @@ def natural_sort_names(name_a, name_b):
                 for tmp in re.split(r"(\d+)", normalize_caseless(text))]
 
     return _extract_numbers(name_b) < _extract_numbers(name_a)
+
+
+fields_getter = {
+    "album": get_album_title,
+    "artist": get_song_artist,
+    "disc": get_album_disc_nr,
+    "title": get_media_title,
+    "track": get_media_track_nr,
+    "year": get_media_year
+}


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