[gnome-music/wip/jfelder/modification-date: 27/27] Use publication date instead of creation date for songs
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/modification-date: 27/27] Use publication date instead of creation date for songs
- Date: Sat, 31 Oct 2020 15:08:41 +0000 (UTC)
commit 350dabc9614423bade0ff1c806614d6803260b6f
Author: Jean Felder <jfelder src gnome org>
Date: Wed Sep 2 13:01:46 2020 +0200
Use publication date instead of creation date for songs
The grilo tracker2 plugin maps the nie:contentCreated property (the
date of a song) to the CREATION_DATE key.
However, the CREATION_DATE key is supposed to be used to describe the
creation of a media such as an image.
In the tracker3 plugin, the nie:contentCreated property now also maps
the PUBLICATION_DATE key (CREATION_DATE is kept for backward
compatibility). Music can now use the PUBLICATION_DATE key instead of
the CREATION_DATE one.
gnomemusic/grilowrappers/grlsearchwrapper.py | 2 +-
gnomemusic/grilowrappers/grltrackerwrapper.py | 24 +++++++++++++-----------
gnomemusic/utils.py | 4 ++--
3 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grlsearchwrapper.py b/gnomemusic/grilowrappers/grlsearchwrapper.py
index 3910f065..5a90fa6f 100644
--- a/gnomemusic/grilowrappers/grlsearchwrapper.py
+++ b/gnomemusic/grilowrappers/grlsearchwrapper.py
@@ -42,12 +42,12 @@ class GrlSearchWrapper(GObject.GObject):
Grl.METADATA_KEY_ALBUM_ARTIST,
Grl.METADATA_KEY_ALBUM_DISC_NUMBER,
Grl.METADATA_KEY_ARTIST,
- Grl.METADATA_KEY_CREATION_DATE,
Grl.METADATA_KEY_COMPOSER,
Grl.METADATA_KEY_DURATION,
Grl.METADATA_KEY_FAVOURITE,
Grl.METADATA_KEY_ID,
Grl.METADATA_KEY_PLAY_COUNT,
+ Grl.METADATA_KEY_PUBLICATION_DATE,
Grl.METADATA_KEY_THUMBNAIL,
Grl.METADATA_KEY_TITLE,
Grl.METADATA_KEY_TRACK_NUMBER,
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 92d65cb8..7bfd155f 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -55,8 +55,8 @@ class GrlTrackerWrapper(GObject.GObject):
Grl.METADATA_KEY_ARTIST,
Grl.METADATA_KEY_ALBUM_ARTIST,
Grl.METADATA_KEY_COMPOSER,
- Grl.METADATA_KEY_CREATION_DATE,
Grl.METADATA_KEY_ID,
+ Grl.METADATA_KEY_PUBLICATION_DATE,
Grl.METADATA_KEY_TITLE,
Grl.METADATA_KEY_URL
]
@@ -219,7 +219,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
?type ?id ?title ?composer ?albumArtist
- ?artist ?url ?creationDate
+ ?artist ?url ?publicationDate
WHERE {
SERVICE <dbus:%(miner_fs_busname)s> {
GRAPH tracker:Audio {
@@ -231,7 +231,8 @@ class GrlTrackerWrapper(GObject.GObject):
?albumArtist
nmm:artistName(?artist) AS ?artist
nie:isStoredAs(?song) AS ?url
- YEAR(MAX(nie:contentCreated(?song))) AS ?creationDate
+ YEAR(MAX(nie:contentCreated(?song)))
+ AS ?publicationDate
WHERE {
?album a nmm:MusicAlbum .
?song a nmm:MusicPiece ;
@@ -565,7 +566,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
?type ?id ?title ?composer ?albumArtist
- ?artist ?url ?creationDate
+ ?artist ?url ?publicationDate
WHERE
{
SERVICE <dbus:%(miner_fs_busname)s> {
@@ -578,7 +579,8 @@ class GrlTrackerWrapper(GObject.GObject):
?albumArtist
nmm:artistName(?artist) AS ?artist
nie:isStoredAs(?song) AS ?url
- YEAR(MAX(nie:contentCreated(?song))) AS ?creationDate
+ YEAR(MAX(nie:contentCreated(?song)))
+ AS ?publicationDate
WHERE
{
?album a nmm:MusicAlbum .
@@ -592,7 +594,7 @@ class GrlTrackerWrapper(GObject.GObject):
%(location_filter)s
}
GROUP BY ?album
- ORDER BY ?title ?albumArtist ?artist ?creationDate
+ ORDER BY ?title ?albumArtist ?artist ?publicationDate
}
}
}
@@ -684,7 +686,7 @@ class GrlTrackerWrapper(GObject.GObject):
query = """
SELECT
- ?type ?id ?title ?creationDate
+ ?type ?id ?title ?publicationDate
WHERE {
SERVICE <dbus:%(miner_fs_busname)s> {
GRAPH tracker:Audio {
@@ -692,7 +694,7 @@ class GrlTrackerWrapper(GObject.GObject):
%(media_type)s AS ?type
?album AS ?id
nie:title(?album) AS ?title
- nie:contentCreated(?song) AS ?creationDate
+ nie:contentCreated(?song) AS ?publicationDate
WHERE {
?album a nmm:MusicAlbum .
OPTIONAL { ?album nmm:albumArtist ?album_artist . }
@@ -704,7 +706,7 @@ class GrlTrackerWrapper(GObject.GObject):
%(location_filter)s
}
GROUP BY ?album
- ORDER BY ?creationDate ?album
+ ORDER BY ?publicationDate ?album
}
}
}
@@ -822,7 +824,7 @@ class GrlTrackerWrapper(GObject.GObject):
?type ?id ?url ?title
?artist ?album
?duration ?trackNumber ?albumDiscNumber
- ?creationDate
+ ?publicationDate
nie:usageCounter(?id) AS ?playCount
?tag AS ?favorite
WHERE {
@@ -839,7 +841,7 @@ class GrlTrackerWrapper(GObject.GObject):
nmm:trackNumber(?song) AS ?trackNumber
nmm:setNumber(nmm:musicAlbumDisc(?song))
AS ?albumDiscNumber
- YEAR(?date) AS ?creationDate
+ YEAR(?date) AS ?publicationDate
WHERE {
?song a nmm:MusicPiece ;
nmm:musicAlbum ?album .
diff --git a/gnomemusic/utils.py b/gnomemusic/utils.py
index 5be7e8ca..b244bf07 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -139,10 +139,10 @@ def get_media_year(item):
"""Returns the year when the media was created.
:param Grl.Media item: A Grilo Media object
- :return: The creation year or '----' if not defined
+ :return: The publication year or '----' if not defined
:rtype: str
"""
- date = item.get_creation_date()
+ date = item.get_publication_date()
if not date:
return "----"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]