[gnome-music/wip/mschraal/tageditor: 2/16] utils: Add fields to getters mapping



commit 773f4b19ddaa06623b2a0a2ba585eb76241b3f55
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 c6a59ec8..4a8d28a4 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -160,3 +160,13 @@ def seconds_to_string(duration):
     seconds %= 60
 
     return '{:d}:{:02d}'.format(minutes, seconds)
+
+
+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
+}


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